Skip to content

Commit

Permalink
Fix links to the github repos
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko committed Oct 13, 2020
1 parent 6625b73 commit 49dfab8
Show file tree
Hide file tree
Showing 43 changed files with 54 additions and 58 deletions.
15 changes: 5 additions & 10 deletions npm/react/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# @cypress/react [![CircleCI](https://circleci.com/gh/bahmutov/@cypress/react/tree/main.svg?style=svg)](https://circleci.com/gh/bahmutov/@cypress/react/tree/main) [![Cypress.io tests](https://img.shields.io/badge/cypress.io-tests-green.svg?style=flat-square)](https://dashboard.cypress.io/#/projects/z9dxah) [![renovate-app badge][renovate-badge]][renovate-app]

> A little helper to unit test React components in the open source [Cypress.io](https://www.cypress.io/) E2E test runner **v4.5.0+**
**Jump to:** [Comparison](#comparison), [Blog posts](#blog-posts), [Install](#install), Examples: [basic](#basic-examples), [advanced](#advanced-examples), [full](#full-examples), [external](#external-examples), [Style options](#options), [Code coverage](#code-coverage), [Visual testing](#visual-testing), [Common problems](#common-problems), [Chat](#chat)
Expand Down Expand Up @@ -58,10 +56,6 @@ If you are coming from Enzyme world, check out the [enzyme](cypress/component/ba
- [Test The Interface Not The Implementation](https://glebbahmutov.com/blog/test-the-interface/) compares Jest + React Testing Library to @cypress/react + Cypress Testing Library
- [Components People Test](https://glebbahmutov.com/blog/components-people-test/) about testing a component inside a Next.js-powered blog

## Known problems

See issues labeled [v4](https://github.com/bahmutov/@cypress/react/labels/v4)

## Install

Requires [Node](https://nodejs.org/en/) version 8 or above.
Expand Down Expand Up @@ -392,7 +386,8 @@ const webpackOptions = {
}
```

Keep your eye on issue [#156](https://github.com/bahmutov/@cypress/react/issues/156) for more information.
<!-- TODO FIX THE LINK -->
Keep your eye on issue [#156](https://github.com/bahmutov/cypress-react-unut-test/issues/156) for more information.

</details>

Expand All @@ -401,14 +396,14 @@ Keep your eye on issue [#156](https://github.com/bahmutov/@cypress/react/issues/

If you are using your custom Webpack, this plugin might be missing code coverage information because the code was not instrumented. We try to insert the `babel-plugin-istanbul` plugin automatically, but your bundling might not use Babel, or configure it differently, preventing plugin insertion. Please let us know by opening an issue with full reproducible details.

See related issue [#141](https://github.com/bahmutov/@cypress/react/issues/141). You can also debug the plugin's behavior by running it with `DEBUG` environment variable, see [#debugging](#debugging) section.
See related issue [#141](https://github.com/bahmutov/cypress-react-unit-test/issues/141). You can also debug the plugin's behavior by running it with `DEBUG` environment variable, see [#debugging](#debugging) section.

</details>

<details id="gatsby-not-supported">
<summary>Gatsby.js projects not supported</summary>

Currently, this project cannot find Webpack settings used by Gatsby.js, thus it cannot bundle specs and application code correctly. Keep an eye on [#307](https://github.com/bahmutov/@cypress/react/issues/307)
Currently, this project cannot find Webpack settings used by Gatsby.js, thus it cannot bundle specs and application code correctly. Keep an eye on [#307](https://github.com/bahmutov/cypress-react-unit-test/issues/307)

</details>

Expand Down Expand Up @@ -442,7 +437,7 @@ DEBUG=@cypress/react,find-webpack

### From v3 to v4

The old v3 `main` branch is available as branch [v3](https://github.com/bahmutov/@cypress/react/tree/v3)
The old v3 `main` branch is available as branch [v3](https://github.com/bahmutov/cypress-react-unit-test/tree/v3)

- the `cy.mount` is now simply `import { mount } from '@cypress/react'`
- the support file is simply `require('@cypress/react/support')`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react'
import { mount } from '@cypress/react'

// https://github.com/bahmutov/@cypress/react/issues/184
// https://github.com/bahmutov/cypress-react-unit-test/issues/184
Cypress.Commands.add('myMount', () => {
return mount(<div>My mount</div>)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('framer-motion', () => {
cy.get('[data-testid=\'motion\']').should('have.css', 'border-radius', '20%')
})

// NOTE: looks like cy.tick issue. Refer to the https://github.com/bahmutov/@cypress/react/issues/420
// NOTE: looks like cy.tick issue. Refer to the https://github.com/bahmutov/cypress-react-unit-test/issues/420
it.skip('Mocks setTimeout and requestAnimationFrame', () => {
cy.clock()
mount(<Motion />)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { mount } from '@cypress/react'
import App from './App'

// NOTE: https://github.com/bahmutov/@cypress/react/issues/136
// NOTE: https://github.com/bahmutov/cypress-react-unit-test/issues/136
describe.skip('App loads', () => {
it('renders lazy component', () => {
mount(<App />)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// NOTE: https://github.com/bahmutov/@cypress/react/issues/136
// NOTE: https://github.com/bahmutov/cypress-react-unit-test/issues/136
// dynamic imports like this work in example projects, but not inside this repo
// probably due to webpack plugins not set up correctly ☹️
describe.skip('dynamic import', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Mocking Axios', () => {
cy.get('li').should('have.length', 3)
})

// https://github.com/bahmutov/@cypress/react/issues/338
// https://github.com/bahmutov/cypress-react-unit-test/issues/338
it('mocks axios.get', () => {
cy.stub(Axios, 'get')
.resolves({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class UserControls extends React.Component {

UserControls.displayName = 'UserControls'

// https://github.com/bahmutov/@cypress/react/issues/99
// https://github.com/bahmutov/cypress-react-unit-test/issues/99
describe('react-bootstrap Dropdown', () => {
it('works', () => {
mount(<UserControls />, {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/cypress/component/advanced/timers/card-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react'
import { mount } from '@cypress/react'

// looking at the clock control from component's hook
// https://github.com/bahmutov/@cypress/react/issues/200
// https://github.com/bahmutov/cypress-react-unit-test/issues/200
it('should select null after timing out (fast)', {
retries: {
runMode: 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React from 'react'
import { mount } from '@cypress/react'

// example from https://github.com/bahmutov/@cypress/react/issues/52
// example from https://github.com/bahmutov/cypress-react-unit-test/issues/52
const DocumentTest = ({ reportHeight }) => {
return (
<div>
Expand Down
4 changes: 2 additions & 2 deletions npm/react/cypress/component/basic/enzyme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ This folder shows several examples from [Enzyme docs](https://enzymejs.github.io
In general if you are migrating from Enzyme to `@cypress/react`:

- there is no shallow mounting, only the full mounting. Thus `@cypress/react` has `mount` which is similar to the Enzyme's `render`. It renders the full HTML and CSS output of your component.
- you can mock [children components](https://github.com/bahmutov/@cypress/react/tree/main/cypress/component/advanced/mocking-component) if you want to avoid running "expensive" components during tests
- the test is running as a "mini" web application. Thus if you want to set a context around component, then set the [context around the component](https://github.com/bahmutov/@cypress/react/tree/main/cypress/component/advanced/context)
- you can mock [children components](https://github.com/bahmutov/cypress-react-unit-test/tree/main/cypress/component/advanced/mocking-component) if you want to avoid running "expensive" components during tests
- the test is running as a "mini" web application. Thus if you want to set a context around component, then set the [context around the component](https://github.com/bahmutov/cypress-react-unit-test/tree/main/cypress/component/advanced/context)

## setState

Expand Down
2 changes: 1 addition & 1 deletion npm/react/cypress/component/basic/mount-div/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('mounting a div', () => {
cy.contains('Works').should('be.visible')
})

// https://github.com/bahmutov/@cypress/react/issues/98
// https://github.com/bahmutov/cypress-react-unit-test/issues/98
it('mount multiple components', function () {
mount(
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Users with Fetch', () => {
cy.get('li', { timeout: 20000 }).should('have.length', 3)
})

// https://github.com/bahmutov/@cypress/react/issues/347
// https://github.com/bahmutov/cypress-react-unit-test/issues/347
context('mocking', () => {
beforeEach(() => {
cy.server()
Expand Down
2 changes: 1 addition & 1 deletion npm/react/cypress/component/basic/no-visit/spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="cypress" />
describe('Trying to use cy.visit in component spec', () => {
it('throws an error', () => {
// https://github.com/bahmutov/@cypress/react/issues/286
// https://github.com/bahmutov/cypress-react-unit-test/issues/286
expect(() => {
cy.visit('index.html')
}).to.throw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { mount } from '@cypress/react'
import MyComponent from './my-component.jsx'

// example from https://github.com/bahmutov/@cypress/react/issues/172
// example from https://github.com/bahmutov/cypress-react-unit-test/issues/172
it('is a test', () => {
mount(<MyComponent name="some text" />)
cy.contains('Hello').should('be.visible')
Expand Down
2 changes: 1 addition & 1 deletion npm/react/examples/a11y/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// load file preprocessor that comes with this plugin
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/react-scripts')

module.exports = (on, config) => {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/examples/nextjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ Find more examples in [Router.spec.jsx](./cypress/components/Router.spec.jsx)

## Mocking imports

Mocking imports is not working yet, seems the plugin we are inserting for loose mode causes problems, see issue [439](https://github.com/bahmutov/@cypress/react/issues/439).
Mocking imports is not working yet, seems the plugin we are inserting for loose mode causes problems, see issue [439](https://github.com/bahmutov/cypress-react-unit-test/issues/439).
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// load file preprocessor that comes with this plugin
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/react-scripts')

module.exports = (on, config) => {
Expand Down
1 change: 1 addition & 0 deletions npm/react/examples/react-scripts-folder/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "example-react-scripts-folder",
"version": "1.0.0",
"description": "Handles component tests from cypress folder",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/examples/react-scripts/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// load file preprocessor that comes with this plugin
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/react-scripts')

module.exports = (on, config) => {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/examples/react-scripts/src/resources.cy-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('static resources', () => {
})

it('loads font', () => {
// https://github.com/bahmutov/@cypress/react/issues/284
// https://github.com/bahmutov/cypress-react-unit-test/issues/284
mount(<App />)

cy.wrap().should(() => {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/examples/sass-and-ts/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// load Webpack file preprocessor that comes with this plugin
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/load-webpack')

module.exports = (on, config) => {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/examples/snapshots/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// load file preprocessor that comes with this plugin
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/react-scripts')
const { initPlugin: initSnapshots } = require('cypress-plugin-snapshots/plugin')

Expand Down
2 changes: 1 addition & 1 deletion npm/react/examples/tailwind/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// load file preprocessor that comes with this plugin
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/react-scripts')

module.exports = (on, config) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// let's bundle spec files and the components they include using
// the same bundling settings as the project by loading .babelrc
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/babelrc')

module.exports = (on, config) => {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/examples/using-babel/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// let's bundle spec files and the components they include using
// the same bundling settings as the project by loading .babelrc
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/babelrc')

module.exports = (on, config) => {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/examples/visual-sudoku/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// load file preprocessor that comes with this plugin
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/react-scripts')
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// load file preprocessor that comes with this plugin
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/react-scripts')

module.exports = (on, config) => {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/examples/visual-testing-with-happo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ npm test

## Notes

Here's an example PR with code a change where we forgot to update the styles with additional classes: [#210](https://github.com/bahmutov/@cypress/react/pull/210)
Here's an example PR with code a change where we forgot to update the styles with additional classes: [#210](https://github.com/bahmutov/cypress-react-unit-test/pull/210)

Notice that CircleCI passes the test, because functionally it worked, but the Happo CI check shows a failure:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// load file preprocessor that comes with this plugin
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const preprocessor = require('@cypress/react/plugins/react-scripts')
const happoTask = require('happo-cypress/task')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const toDate = (yyyyMmDd) => Cypress.moment(yyyyMmDd, 'YYYY-MM-DD').utc()
describe('Calendar heatmap', () => {
// NOTE: Skipping the test because the tooltip does not get cleaned correctly
// when the next test starts, see issue
// https://github.com/bahmutov/@cypress/react/issues/206
// https://github.com/bahmutov/cypress-react-unit-test/issues/206
it.skip('random data', () => {
// we cannot really screenshot random data for visual testing
mount(<Calendar />)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// load file preprocessor that comes with this plugin
// https://github.com/bahmutov/@cypress/react#install
// https://github.com/bahmutov/cypress-react-unit-test#install
const percyHealthCheck = require('@percy/cypress/task')
const preprocessor = require('@cypress/react/plugins/react-scripts')

Expand Down
2 changes: 1 addition & 1 deletion npm/react/init/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('init script', () => {

return call.includes('create-react-app') &&
call.includes(
'https://github.com/bahmutov/@cypress/react/tree/main/examples/react-scripts',
'https://github.com/cypress-io/cypress/tree/develop/npm/react/examples/react-scripts',
)
},
),
Expand Down
4 changes: 2 additions & 2 deletions npm/react/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async function getCypressConfig () {

console.log(
`\nFind more information about installation at: ${chalk.bold.underline(
'https://github.com/bahmutov/@cypress/react#init',
'https://github.com/cypress-io/cypress/tree/develop/npm/react#init',
)}`,
)

Expand Down Expand Up @@ -233,7 +233,7 @@ export async function main<T> () {

console.log(
`Docs for different recipes of bundling tools: ${chalk.bold.underline(
'https://github.com/bahmutov/@cypress/react/blob/main/docs/recipes.md',
'https://github.com/cypress-io/cypress/tree/develop/npm/react/docs/recipes.md',
)}`,
)

Expand Down
2 changes: 1 addition & 1 deletion npm/react/init/templates/babel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const BabelTemplate: Template = {
'webpack',
)} to bundle the components for testing.`,
getExampleUrl: () => {
return 'https://github.com/bahmutov/@cypress/react/tree/main/examples/babel'
return 'https://github.com/cypress-io/cypress/tree/develop/npm/react/examples/babel'
},
recommendedComponentFolder: 'cypress/component',
getPluginsCode: () => {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/init/templates/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { MIN_SUPPORTED_VERSION } from '../versions'
export const NextTemplate: Template = {
message: 'It looks like you are using next.js.',
getExampleUrl: () => {
return 'https://github.com/bahmutov/@cypress/react/tree/main/examples/nextjs'
return 'https://github.com/cypress-io/cypress/tree/develop/npm/react/examples/nextjs'
},
recommendedComponentFolder: 'cypress/component',
getPluginsCode: () => {
Expand Down
4 changes: 2 additions & 2 deletions npm/react/init/templates/react-scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const ReactScriptsTemplate: Template = {
message: 'It looks like you are using create-react-app.',
getExampleUrl: ({ componentFolder }) => {
return componentFolder === 'src'
? 'https://github.com/bahmutov/@cypress/react/tree/main/examples/react-scripts'
: 'https://github.com/bahmutov/@cypress/react/tree/main/examples/react-scripts-folder'
? 'https://github.com/cypress-io/cypress/tree/develop/npm/react/examples/react-scripts'
: 'https://github.com/cypress-io/cypress/tree/develop/npm/react/examples/react-scripts-folder'
},
getPluginsCode: () => {
return [
Expand Down
2 changes: 1 addition & 1 deletion npm/react/init/templates/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const RollupTemplate: Template<{ rollupConfigPath: string }> = {
message:
'It looks like you have custom `rollup.config.js`. We can use it to bundle the components for testing.',
getExampleUrl: () => {
return 'https://github.com/bahmutov/@cypress/react/tree/main/examples/rollup'
return 'https://github.com/cypress-io/cypress/tree/develop/npm/react/examples/rollup'
},
recommendedComponentFolder: 'src',
getPluginsCode: (payload, { cypressProjectRoot }) => {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/init/templates/webpack-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const WebpackTemplate: Template<{ webpackConfigPath: string }> = {
message:
'It looks like you have custom `webpack.config.js`. We can use it to bundle the components for testing.',
getExampleUrl: () => {
return 'https://github.com/bahmutov/@cypress/react/tree/main/examples/webpack-file'
return 'https://github.com/cypress-io/cypress/tree/develop/npm/react/examples/webpack-file'
},
recommendedComponentFolder: 'cypress/component',
getPluginsCode: (payload, { cypressProjectRoot }) => {
Expand Down
2 changes: 1 addition & 1 deletion npm/react/init/templates/webpack-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const WebpackOptions: Template = {
// this should never show ideally
message: `Unable to detect where webpack options are.`,
getExampleUrl: () => {
return 'https://github.com/bahmutov/@cypress/react/tree/main/examples/webpack-options'
return 'https://github.com/cypress-io/cypress/tree/develop/npm/react/examples/webpack-options'
},
test: () => ({ success: false }),
recommendedComponentFolder: 'src',
Expand Down
2 changes: 1 addition & 1 deletion npm/react/lib/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Cypress.Commands.overwrite('visit', (visit, ...args: any[]) => {
if (isComponentSpec()) {
throw new Error(
'cy.visit from a component spec is not allowed\n' +
'see https://github.com/bahmutov/@cypress/react/issues/286',
'see https://github.com/bahmutov/cypress-react-unit-test/issues/286',
)
} else {
// allow regular visit to proceed
Expand Down
Loading

0 comments on commit 49dfab8

Please sign in to comment.