From 11ab3999b7d7f7feb7fc8805fa0bc1557e901217 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Sun, 30 Sep 2018 14:19:28 +0200 Subject: [PATCH] ci(jest): set maxWorkers to 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jest process doesn’t quit after last test completes. This can cause our tests to fail sometimes, particularly on on Appveyor. As an attempt to get past this previously we had set `--forceExit` in our jest cli options, but this doesn't always work either. Further research suggests that setting ``--maxWorkers=2` could resolve the issue. See - https://github.com/facebook/jest/issues/1456#issuecomment-424356243 - https://github.com/facebook/jest/blob/master/docs/Troubleshooting.md Fix #774, Fix #773 --- package.json | 2 +- test/e2e/e2e.spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1a21fe48..b509a0f9 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "start-main-dev": "cross-env HOT=1 NODE_ENV=development electron -r babel-register ./app/main.dev", "start-renderer-dev": "node --trace-warnings -r babel-register ./node_modules/webpack-serve/lib/cli.js --config internals/webpack/webpack.config.renderer.dev.js", "test": "npm run lint && npm run lint-styles && npm run flow && npm run build && npm run test-unit && npm run test-e2e", - "test-base": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=true ELECTRON_DISABLE_SECURITY_WARNINGS=true node --trace-warnings ./node_modules/jest/bin/jest --forceExit", + "test-base": "cross-env NODE_ENV=test BABEL_DISABLE_CACHE=true ELECTRON_DISABLE_SECURITY_WARNINGS=true node --trace-warnings ./node_modules/jest/bin/jest --maxWorkers=2", "test-unit": "npm run test-base -- --coverage ./test/unit", "test-e2e": "npm run test-base -- ./test/e2e", "test-ci": "npm run test-e2e && npm run test-unit" diff --git a/test/e2e/e2e.spec.js b/test/e2e/e2e.spec.js index e25c7f2a..6cc2ed3b 100644 --- a/test/e2e/e2e.spec.js +++ b/test/e2e/e2e.spec.js @@ -16,9 +16,9 @@ describe('main window', function spec() { await this.app.client.waitUntilWindowLoaded() }) - afterAll(() => { + afterAll(async () => { if (this.app && this.app.isRunning()) { - return this.app.stop() + await this.app.stop() } })