Skip to content
/ jest Public
forked from jestjs/jest

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Apr 4, 2019
1 parent 00d20b0 commit cf26c28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ exports[`Wrong globals for environment print useful error for document 1`] = `
● use document
Jest: You should use a jsdom test environment, see https://jestjs.io/docs/en/configuration#testenvironment-string.
The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/en/configuration#testenvironment-string.
Consider using the \\"jsdom\\" test environment.
ReferenceError: document is not defined
Expand All @@ -28,7 +29,8 @@ exports[`Wrong globals for environment print useful error for unref 1`] = `
● use unref
Jest: You should use a node test environment, see https://jestjs.io/docs/en/configuration#testenvironment-string.
The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/en/configuration#testenvironment-string.
Consider using the \\"node\\" test environment.
TypeError: setTimeout(...).unref is not a function
Expand All @@ -50,7 +52,8 @@ exports[`Wrong globals for environment print useful error for window 1`] = `
● use window
Jest: You should use a jsdom test environment, see https://jestjs.io/docs/en/configuration#testenvironment-string.
The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/en/configuration#testenvironment-string.
Consider using the \\"jsdom\\" test environment.
ReferenceError: window is not defined
Expand All @@ -69,7 +72,8 @@ exports[`Wrong globals for environment print useful error when it explodes durin
"FAIL __tests__/beforeTest.js
● Test suite failed to run
Jest: You should use a jsdom test environment, see https://jestjs.io/docs/en/configuration#testenvironment-string.
The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/en/configuration#testenvironment-string.
Consider using the \\"jsdom\\" test environment.
ReferenceError: document is not defined
Expand Down
8 changes: 4 additions & 4 deletions packages/jest-message-util/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ function checkForCommonEnvironmentErrors(error: string) {

function warnAboutWrongTestEnvironment(error: string, env: 'jsdom' | 'node') {
return (
chalk.red(
chalk.bold(
`Jest: You should use a ${env} test environment, see https://jestjs.io/docs/en/configuration#testenvironment-string.\n\n`,
),
chalk.bold.red(
`The error below may be caused by using the wrong test environment, see ${chalk.dim.underline(
'https://jestjs.io/docs/en/configuration#testenvironment-string',
)}.\nConsider using the "${env}" test environment.\n\n`,
) + error
);
}
Expand Down

0 comments on commit cf26c28

Please sign in to comment.