From 42067a262c11d06ed6bdb80b6c04f3033994c1fe Mon Sep 17 00:00:00 2001 From: Aleksei Gusev Date: Sun, 24 Jun 2018 13:42:27 +0300 Subject: [PATCH 1/5] Force jest-preset.json to have LF as EOF --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..d24072ca04d1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +packages/jest-config/src/__tests__/jest-preset.json eol=lf From 9d4dce7ce2ebb6fc07ac724c8726715c3118d1fe Mon Sep 17 00:00:00 2001 From: Aleksei Gusev Date: Sun, 24 Jun 2018 13:44:46 +0300 Subject: [PATCH 2/5] Use a separate directory for test environment At least on Windows the tests fail when they are run simultaneously --- e2e/__tests__/test_environment_async.test.js | 2 +- e2e/test-environment-async/TestEnvironment.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/__tests__/test_environment_async.test.js b/e2e/__tests__/test_environment_async.test.js index b10181689af4..8decfc1121bc 100644 --- a/e2e/__tests__/test_environment_async.test.js +++ b/e2e/__tests__/test_environment_async.test.js @@ -13,7 +13,7 @@ const os = require('os'); const runJest = require('../runJest'); const {cleanup} = require('../Utils'); -const DIR = os.tmpdir() + '/jest'; +const DIR = os.tmpdir() + '/jest-test-environment'; beforeEach(() => cleanup(DIR)); afterAll(() => cleanup(DIR)); diff --git a/e2e/test-environment-async/TestEnvironment.js b/e2e/test-environment-async/TestEnvironment.js index a650d8436da7..a5b5b8648b22 100644 --- a/e2e/test-environment-async/TestEnvironment.js +++ b/e2e/test-environment-async/TestEnvironment.js @@ -5,7 +5,7 @@ const os = require('os'); const mkdirp = require('mkdirp'); const JSDOMEnvironment = require('jest-environment-jsdom'); -const DIR = os.tmpdir() + '/jest'; +const DIR = os.tmpdir() + '/jest-test-environment'; class TestEnvironment extends JSDOMEnvironment { constructor(config) { From 737bf8a3846302f03d4ee2c7f7b193889b5a1f52 Mon Sep 17 00:00:00 2001 From: Aleksei Gusev Date: Sun, 24 Jun 2018 14:36:45 +0300 Subject: [PATCH 3/5] Add entry to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 865d3a5fca39..1a3677b0f1f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ ### Chore & Maintenance - `[docs]` Add jest-each docs for 1 dimensional arrays ([#6444](https://github.com/facebook/jest/pull/6444/files)) +- `[tests]` Improve stability of `yarn test` on Windows ([#6534](https://github.com/facebook/jest/pull/6534)) ## 23.1.0 From 8f8effc17cb7d823958f823525353998ecfcaae2 Mon Sep 17 00:00:00 2001 From: Aleksei Gusev Date: Sun, 1 Jul 2018 16:11:37 +0300 Subject: [PATCH 4/5] Check the error message instead of relying on the snapshot --- .gitattributes | 1 - .../__tests__/__snapshots__/normalize.test.js.snap | 11 ----------- packages/jest-config/src/__tests__/normalize.test.js | 2 +- 3 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index d24072ca04d1..000000000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -packages/jest-config/src/__tests__/jest-preset.json eol=lf diff --git a/packages/jest-config/src/__tests__/__snapshots__/normalize.test.js.snap b/packages/jest-config/src/__tests__/__snapshots__/normalize.test.js.snap index b3c6e240ddd7..4acf2575baa6 100644 --- a/packages/jest-config/src/__tests__/__snapshots__/normalize.test.js.snap +++ b/packages/jest-config/src/__tests__/__snapshots__/normalize.test.js.snap @@ -17,17 +17,6 @@ exports[`Upgrade help logs a warning when \`scriptPreprocessor\` and/or \`prepro " `; -exports[`preset throws when preset is invalid 1`] = ` -"Validation Error: - - Preset react-native is invalid: - Unexpected token } in JSON at position 104 - - Configuration Documentation: - https://facebook.github.io/jest/docs/configuration.html -" -`; - exports[`preset throws when preset not found 1`] = ` "Validation Error: diff --git a/packages/jest-config/src/__tests__/normalize.test.js b/packages/jest-config/src/__tests__/normalize.test.js index bc2b5a759231..b7d3d99cfeb0 100644 --- a/packages/jest-config/src/__tests__/normalize.test.js +++ b/packages/jest-config/src/__tests__/normalize.test.js @@ -946,7 +946,7 @@ describe('preset', () => { }, {}, ); - }).toThrowErrorMatchingSnapshot(); + }).toThrowError(/Unexpected token }/); }); test('works with "react-native"', () => { From 50f99a774a77e5e488691279bd9e79cf7cfeca73 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 3 Jul 2018 06:56:52 +0200 Subject: [PATCH 5/5] move changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c69265783997..d5441ff255f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Chore & Maintenance - `[website]` Switch domain to https://jestjs.io ([#6549](https://github.com/facebook/jest/pull/6549)) +- `[tests]` Improve stability of `yarn test` on Windows ([#6534](https://github.com/facebook/jest/pull/6534)) ## 23.2.0 @@ -29,7 +30,6 @@ ### Chore & Maintenance - `[docs]` Add jest-each docs for 1 dimensional arrays ([#6444](https://github.com/facebook/jest/pull/6444/files)) -- `[tests]` Improve stability of `yarn test` on Windows ([#6534](https://github.com/facebook/jest/pull/6534)) ## 23.1.0