diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index a44faff2d3b7..376afea7e4de 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -12,6 +12,6 @@ about: If you have questions, please check Reactiflux or StackOverflow For questions or help please see: -- [The Jest help page](https://jestjs.io/en/help.html) +- [The Jest help page](https://jestjs.io/help) - [Our `#testing` channel in Reactiflux](https://discord.gg/j6FKKQQrW9) - The [jestjs](https://stackoverflow.com/questions/tagged/jestjs) tag on [StackOverflow](https://stackoverflow.com/questions/ask) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9721a6e4cb56..7f621f66b734 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2272,7 +2272,7 @@ We skipped 24.2.0 because a draft was accidentally published. Please use `24.3.0 ## jest 18.0.0 -See https://jestjs.io/blog/2016/12/15/2016-in-jest.html +See https://jestjs.io/blog/2016/12/15/2016-in-jest - The testResultsProcessor function is now required to return the modified results. - Removed `pit` and `mockImpl`. Use `it` or `mockImplementation` instead. @@ -2409,7 +2409,7 @@ See https://jestjs.io/blog/2016/12/15/2016-in-jest.html ## jest 15.0.0 -- See https://jestjs.io/blog/2016/09/01/jest-15.html +- See https://jestjs.io/blog/2016/09/01/jest-15 - Jest by default now also recognizes files ending in `.spec.js` and `.test.js` as test files. - Completely replaced most Jasmine matchers with new Jest matchers. - Rewrote Jest's CLI output for test failures and summaries. diff --git a/e2e/__tests__/__snapshots__/customReporters.test.ts.snap b/e2e/__tests__/__snapshots__/customReporters.test.ts.snap index 86db90781b48..42ac5525f00e 100644 --- a/e2e/__tests__/__snapshots__/customReporters.test.ts.snap +++ b/e2e/__tests__/__snapshots__/customReporters.test.ts.snap @@ -115,7 +115,7 @@ exports[`Custom Reporters Integration invalid format for adding reporters 1`] = ] Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration `; diff --git a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap index e809f577ae94..a5d9190d9b19 100644 --- a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap +++ b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap @@ -9,7 +9,7 @@ exports[`show error message when no js moduleFileExtensions 1`] = ` Please change your configuration to include 'js'. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration `; diff --git a/packages/jest-changed-files/README.md b/packages/jest-changed-files/README.md index 795ebe7398cc..c8ed86436d07 100644 --- a/packages/jest-changed-files/README.md +++ b/packages/jest-changed-files/README.md @@ -16,7 +16,7 @@ Get the list of files and repos that have changed since the last commit. #### Parameters -roots: Array of string paths gathered from [jest roots](https://jestjs.io/docs/configuration.html#roots-array-string). +roots: Array of string paths gathered from [jest roots](https://jestjs.io/docs/configuration#roots-array-string). options: Object literal with keys @@ -29,7 +29,7 @@ Get a set of git and hg repositories. #### Parameters -roots: Array of string paths gathered from [jest roots](https://jestjs.io/docs/configuration.html#roots-array-string). +roots: Array of string paths gathered from [jest roots](https://jestjs.io/docs/configuration#roots-array-string). ## Usage diff --git a/packages/jest-cli/README.md b/packages/jest-cli/README.md index 4e02089b45ac..9c3d31ef67ef 100644 --- a/packages/jest-cli/README.md +++ b/packages/jest-cli/README.md @@ -6,6 +6,6 @@ - **🏃🏽 Instant Feedback**: Failed tests run first. Fast interactive mode can switch between running all tests or only test files related to changed files. -- **📸 Snapshot Testing**: Jest can [capture snapshots](https://jestjs.io/docs/snapshot-testing.html) of React trees or other serializable values to simplify UI testing. +- **📸 Snapshot Testing**: Jest can [capture snapshots](https://jestjs.io/docs/snapshot-testing) of React trees or other serializable values to simplify UI testing. Read More: https://jestjs.io/ diff --git a/packages/jest-config/src/__tests__/__snapshots__/normalize.test.ts.snap b/packages/jest-config/src/__tests__/__snapshots__/normalize.test.ts.snap index e34137553cec..ac8587abd024 100644 --- a/packages/jest-config/src/__tests__/__snapshots__/normalize.test.ts.snap +++ b/packages/jest-config/src/__tests__/__snapshots__/normalize.test.ts.snap @@ -13,7 +13,7 @@ exports[`Upgrade help logs a warning when \`scriptPreprocessor\` and/or \`prepro Please update your configuration. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -39,7 +39,7 @@ exports[`displayName should throw an error when displayName is is an empty objec Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -55,7 +55,7 @@ exports[`displayName should throw an error when displayName is missing color 1`] Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -71,7 +71,7 @@ exports[`displayName should throw an error when displayName is missing name 1`] Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -87,7 +87,7 @@ exports[`displayName should throw an error when displayName is using invalid val Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -98,7 +98,7 @@ exports[`extensionsToTreatAsEsm should enforce leading dots 1`] = ` Please change your configuration to extensionsToTreatAsEsm: ['.ts']. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration `; exports[`extensionsToTreatAsEsm throws on .cjs 1`] = ` @@ -107,7 +107,7 @@ exports[`extensionsToTreatAsEsm throws on .cjs 1`] = ` Option: extensionsToTreatAsEsm: ['.cjs'] includes '.cjs' which is always treated as CommonJS. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration `; exports[`extensionsToTreatAsEsm throws on .js 1`] = ` @@ -116,7 +116,7 @@ exports[`extensionsToTreatAsEsm throws on .js 1`] = ` Option: extensionsToTreatAsEsm: ['.js'] includes '.js' which is always inferred based on type in its nearest package.json. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration `; exports[`extensionsToTreatAsEsm throws on .mjs 1`] = ` @@ -125,7 +125,7 @@ exports[`extensionsToTreatAsEsm throws on .mjs 1`] = ` Option: extensionsToTreatAsEsm: ['.mjs'] includes '.mjs' which is always treated as an ECMAScript Module. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration `; exports[`preset throws when module was found but no "jest-preset.js" or "jest-preset.json" files 1`] = ` @@ -134,7 +134,7 @@ exports[`preset throws when module was found but no "jest-preset.js" or "jest-pr Module exist-but-no-jest-preset should have \\"jest-preset.js\\" or \\"jest-preset.json\\" file at the root. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -144,7 +144,7 @@ exports[`preset throws when preset not found 1`] = ` Preset doesnt-exist not found. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -154,7 +154,7 @@ exports[`rootDir throws if the options is missing a rootDir property 1`] = ` Configuration option rootDir must be specified. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -164,7 +164,7 @@ exports[`runner throw error when a runner is not found 1`] = ` Jest Runner missing-runner cannot be found. Make sure the runner configuration option points to an existing node module. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -176,7 +176,7 @@ exports[`setupTestFrameworkScriptFile logs a deprecation warning when \`setupTes Please update your configuration. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -187,7 +187,7 @@ exports[`setupTestFrameworkScriptFile logs an error when \`setupTestFrameworkScr Please change your configuration to only use setupFilesAfterEnv. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -197,7 +197,7 @@ exports[`testEnvironment throws on invalid environment names 1`] = ` Test environment phantom cannot be found. Make sure the testEnvironment configuration option points to an existing node module. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -207,7 +207,7 @@ exports[`testMatch throws if testRegex and testMatch are both specified 1`] = ` Configuration options testMatch and testRegex cannot be used together. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -221,7 +221,7 @@ exports[`testTimeout should throw an error if timeout is a negative number 1`] = Option \\"testTimeout\\" must be a natural number. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; @@ -231,6 +231,6 @@ exports[`watchPlugins throw error when a watch plugin is not found 1`] = ` Watch plugin missing-plugin cannot be found. Make sure the watchPlugins configuration option points to an existing node module. Configuration Documentation: - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration " `; diff --git a/packages/jest-config/src/utils.ts b/packages/jest-config/src/utils.ts index b931c78f914f..9b7e17ccd609 100644 --- a/packages/jest-config/src/utils.ts +++ b/packages/jest-config/src/utils.ts @@ -22,7 +22,7 @@ export const BULLET: string = chalk.bold('\u25cf '); export const DOCUMENTATION_NOTE = ` ${chalk.bold( 'Configuration Documentation:', )} - https://jestjs.io/docs/configuration.html + https://jestjs.io/docs/configuration `; const createValidationError = (message: string) => diff --git a/packages/jest-core/src/getNoTestFoundVerbose.ts b/packages/jest-core/src/getNoTestFoundVerbose.ts index a79cf5f371a6..422a0925ecd2 100644 --- a/packages/jest-core/src/getNoTestFoundVerbose.ts +++ b/packages/jest-core/src/getNoTestFoundVerbose.ts @@ -43,7 +43,7 @@ export default function getNoTestFoundVerbose( `Make sure Jest's configuration does not exclude this directory.` + `\nTo set up Jest, make sure a package.json file exists.\n` + `Jest Documentation: ` + - `facebook.github.io/jest/docs/configuration.html`; + `https://jestjs.io/docs/configuration`; }); let dataMessage; diff --git a/packages/jest-fake-timers/src/__tests__/__snapshots__/legacyFakeTimers.test.ts.snap b/packages/jest-fake-timers/src/__tests__/__snapshots__/legacyFakeTimers.test.ts.snap index 2bc445636456..d1148bf32e57 100644 --- a/packages/jest-fake-timers/src/__tests__/__snapshots__/legacyFakeTimers.test.ts.snap +++ b/packages/jest-fake-timers/src/__tests__/__snapshots__/legacyFakeTimers.test.ts.snap @@ -3,5 +3,5 @@ exports[`FakeTimers runAllTimers warns when trying to advance timers while real timers are used 1`] = ` A function to advance timers was called but the timers API is not mocked with fake timers. Call \`jest.useFakeTimers()\` in this test or enable fake timers globally by setting \`"timers": "fake"\` in the configuration file. This warning is likely a result of a default configuration change in Jest 15. -Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15.html +Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15 `; diff --git a/packages/jest-fake-timers/src/legacyFakeTimers.ts b/packages/jest-fake-timers/src/legacyFakeTimers.ts index cd94923d00fe..ab918f89b3c9 100644 --- a/packages/jest-fake-timers/src/legacyFakeTimers.ts +++ b/packages/jest-fake-timers/src/legacyFakeTimers.ts @@ -356,7 +356,7 @@ export default class FakeTimers { `\`"timers": "fake"\` in ` + `the configuration file. This warning is likely a result of a ` + `default configuration change in Jest 15.\n\n` + - `Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15.html\n` + + `Release Blog Post: https://jestjs.io/blog/2016/09/01/jest-15\n` + `Stack Trace:\n` + formatStackTrace(new Error().stack!, this._config, { noStackTrace: false, diff --git a/packages/jest-runtime/src/index.ts b/packages/jest-runtime/src/index.ts index e32ddc1b2a81..0838e25d5b5c 100644 --- a/packages/jest-runtime/src/index.ts +++ b/packages/jest-runtime/src/index.ts @@ -1463,7 +1463,7 @@ export default class Runtime { if (mockMetadata == null) { throw new Error( `Failed to get mock metadata: ${modulePath}\n\n` + - `See: https://jestjs.io/docs/manual-mocks.html#content`, + `See: https://jestjs.io/docs/manual-mocks#content`, ); } this._mockMetaDataCache.set(modulePath, mockMetadata); diff --git a/packages/jest-snapshot/src/SnapshotResolver.ts b/packages/jest-snapshot/src/SnapshotResolver.ts index 5a2d3036f181..d029ae3b5815 100644 --- a/packages/jest-snapshot/src/SnapshotResolver.ts +++ b/packages/jest-snapshot/src/SnapshotResolver.ts @@ -97,7 +97,7 @@ function mustImplement(propName: string, requiredType: string) { chalk.bold( `Custom snapshot resolver must implement a \`${propName}\` as a ${requiredType}.`, ) + - '\nDocumentation: https://facebook.github.io/jest/docs/configuration.html#snapshotResolver' + '\nDocumentation: https://jestjs.io/docs/configuration#snapshotresolver-string' ); } diff --git a/packages/jest-snapshot/src/__tests__/__snapshots__/SnapshotResolver.test.ts.snap b/packages/jest-snapshot/src/__tests__/__snapshots__/SnapshotResolver.test.ts.snap index 455b923c8fb8..99b0240c2bdc 100644 --- a/packages/jest-snapshot/src/__tests__/__snapshots__/SnapshotResolver.test.ts.snap +++ b/packages/jest-snapshot/src/__tests__/__snapshots__/SnapshotResolver.test.ts.snap @@ -4,15 +4,15 @@ exports[`malformed custom resolver in project config inconsistent functions thro exports[`malformed custom resolver in project config missing resolveSnapshotPath throws 1`] = ` "Custom snapshot resolver must implement a \`resolveSnapshotPath\` as a function. -Documentation: https://facebook.github.io/jest/docs/configuration.html#snapshotResolver" +Documentation: https://jestjs.io/docs/configuration#snapshotresolver-string" `; exports[`malformed custom resolver in project config missing resolveTestPath throws 1`] = ` "Custom snapshot resolver must implement a \`resolveTestPath\` as a function. -Documentation: https://facebook.github.io/jest/docs/configuration.html#snapshotResolver" +Documentation: https://jestjs.io/docs/configuration#snapshotresolver-string" `; exports[`malformed custom resolver in project config missing testPathForConsistencyCheck throws 1`] = ` "Custom snapshot resolver must implement a \`testPathForConsistencyCheck\` as a string. -Documentation: https://facebook.github.io/jest/docs/configuration.html#snapshotResolver" +Documentation: https://jestjs.io/docs/configuration#snapshotresolver-string" `; diff --git a/packages/jest/README.md b/packages/jest/README.md index 4e02089b45ac..9c3d31ef67ef 100644 --- a/packages/jest/README.md +++ b/packages/jest/README.md @@ -6,6 +6,6 @@ - **🏃🏽 Instant Feedback**: Failed tests run first. Fast interactive mode can switch between running all tests or only test files related to changed files. -- **📸 Snapshot Testing**: Jest can [capture snapshots](https://jestjs.io/docs/snapshot-testing.html) of React trees or other serializable values to simplify UI testing. +- **📸 Snapshot Testing**: Jest can [capture snapshots](https://jestjs.io/docs/snapshot-testing) of React trees or other serializable values to simplify UI testing. Read More: https://jestjs.io/ diff --git a/website/versioned_docs/version-25.x/ExpectAPI.md b/website/versioned_docs/version-25.x/ExpectAPI.md index 30f3f4ad95fd..e90c7921fbf0 100644 --- a/website/versioned_docs/version-25.x/ExpectAPI.md +++ b/website/versioned_docs/version-25.x/ExpectAPI.md @@ -1286,7 +1286,7 @@ And it will generate the following snapshot: exports[`drinking flavors throws on octopus 1`] = `"yuck, octopus flavor"`; ``` -Check out [React Tree Snapshot Testing](https://jestjs.io/blog/2016/07/27/jest-14.html) for more information on snapshot testing. +Check out [React Tree Snapshot Testing](https://jestjs.io/blog/2016/07/27/jest-14) for more information on snapshot testing. ### `.toThrowErrorMatchingInlineSnapshot(inlineSnapshot)` diff --git a/website/versioned_docs/version-25.x/SnapshotTesting.md b/website/versioned_docs/version-25.x/SnapshotTesting.md index c55fc86c1a08..6907cbdea53a 100644 --- a/website/versioned_docs/version-25.x/SnapshotTesting.md +++ b/website/versioned_docs/version-25.x/SnapshotTesting.md @@ -43,7 +43,7 @@ The snapshot artifact should be committed alongside code changes, and reviewed a > Note: The snapshot is directly scoped to the data you render – in our example the `` component with `page` prop passed to it. This implies that even if any other file has missing props (Say, `App.js`) in the `` component, it will still pass the test as the test doesn't know the usage of `` component and it's scoped only to the `Link.react.js`. Also, Rendering the same component with different props in other snapshot tests will not affect the first one, as the tests don't know about each other. -More information on how snapshot testing works and why we built it can be found on the [release blog post](https://jestjs.io/blog/2016/07/27/jest-14.html). We recommend reading [this blog post](http://benmccormick.org/2016/09/19/testing-with-jest-snapshots-first-impressions/) to get a good sense of when you should use snapshot testing. We also recommend watching this [egghead video](https://egghead.io/lessons/javascript-use-jest-s-snapshot-testing-feature?pl=testing-javascript-with-jest-a36c4074) on Snapshot Testing with Jest. +More information on how snapshot testing works and why we built it can be found on the [release blog post](https://jestjs.io/blog/2016/07/27/jest-14). We recommend reading [this blog post](http://benmccormick.org/2016/09/19/testing-with-jest-snapshots-first-impressions/) to get a good sense of when you should use snapshot testing. We also recommend watching this [egghead video](https://egghead.io/lessons/javascript-use-jest-s-snapshot-testing-feature?pl=testing-javascript-with-jest-a36c4074) on Snapshot Testing with Jest. ### Updating Snapshots @@ -295,7 +295,7 @@ Yes, all snapshot files should be committed alongside the modules they are cover ### What's the difference between snapshot testing and visual regression testing? -Snapshot testing and visual regression testing are two distinct ways of testing UIs, and they serve different purposes. Visual regression testing tools take screenshots of web pages and compare the resulting images pixel by pixel. With Snapshot testing values are serialized, stored within text files, and compared using a diff algorithm. There are different trade-offs to consider and we listed the reasons why snapshot testing was built in the [Jest blog](https://jestjs.io/blog/2016/07/27/jest-14.html#why-snapshot-testing). +Snapshot testing and visual regression testing are two distinct ways of testing UIs, and they serve different purposes. Visual regression testing tools take screenshots of web pages and compare the resulting images pixel by pixel. With Snapshot testing values are serialized, stored within text files, and compared using a diff algorithm. There are different trade-offs to consider and we listed the reasons why snapshot testing was built in the [Jest blog](https://jestjs.io/blog/2016/07/27/jest-14#why-snapshot-testing). ### Does snapshot testing replace unit testing? diff --git a/website/versioned_docs/version-26.x/SnapshotTesting.md b/website/versioned_docs/version-26.x/SnapshotTesting.md index c55fc86c1a08..6907cbdea53a 100644 --- a/website/versioned_docs/version-26.x/SnapshotTesting.md +++ b/website/versioned_docs/version-26.x/SnapshotTesting.md @@ -43,7 +43,7 @@ The snapshot artifact should be committed alongside code changes, and reviewed a > Note: The snapshot is directly scoped to the data you render – in our example the `` component with `page` prop passed to it. This implies that even if any other file has missing props (Say, `App.js`) in the `` component, it will still pass the test as the test doesn't know the usage of `` component and it's scoped only to the `Link.react.js`. Also, Rendering the same component with different props in other snapshot tests will not affect the first one, as the tests don't know about each other. -More information on how snapshot testing works and why we built it can be found on the [release blog post](https://jestjs.io/blog/2016/07/27/jest-14.html). We recommend reading [this blog post](http://benmccormick.org/2016/09/19/testing-with-jest-snapshots-first-impressions/) to get a good sense of when you should use snapshot testing. We also recommend watching this [egghead video](https://egghead.io/lessons/javascript-use-jest-s-snapshot-testing-feature?pl=testing-javascript-with-jest-a36c4074) on Snapshot Testing with Jest. +More information on how snapshot testing works and why we built it can be found on the [release blog post](https://jestjs.io/blog/2016/07/27/jest-14). We recommend reading [this blog post](http://benmccormick.org/2016/09/19/testing-with-jest-snapshots-first-impressions/) to get a good sense of when you should use snapshot testing. We also recommend watching this [egghead video](https://egghead.io/lessons/javascript-use-jest-s-snapshot-testing-feature?pl=testing-javascript-with-jest-a36c4074) on Snapshot Testing with Jest. ### Updating Snapshots @@ -295,7 +295,7 @@ Yes, all snapshot files should be committed alongside the modules they are cover ### What's the difference between snapshot testing and visual regression testing? -Snapshot testing and visual regression testing are two distinct ways of testing UIs, and they serve different purposes. Visual regression testing tools take screenshots of web pages and compare the resulting images pixel by pixel. With Snapshot testing values are serialized, stored within text files, and compared using a diff algorithm. There are different trade-offs to consider and we listed the reasons why snapshot testing was built in the [Jest blog](https://jestjs.io/blog/2016/07/27/jest-14.html#why-snapshot-testing). +Snapshot testing and visual regression testing are two distinct ways of testing UIs, and they serve different purposes. Visual regression testing tools take screenshots of web pages and compare the resulting images pixel by pixel. With Snapshot testing values are serialized, stored within text files, and compared using a diff algorithm. There are different trade-offs to consider and we listed the reasons why snapshot testing was built in the [Jest blog](https://jestjs.io/blog/2016/07/27/jest-14#why-snapshot-testing). ### Does snapshot testing replace unit testing?