From 6f487e2687a1c17df07c43249bb170eb337d4f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Mon, 14 Jan 2019 23:22:12 +0100 Subject: [PATCH] Fix non-deterministic erros in testing Without the `--runInBand` flag, jest will create a worker pool of child processes and run the tests withing. No surprise, why the tests were running completely non-deterministically! If we clear the database in the middle of the tests we will end up with no records, or if we run the factories in several tests we end up with many duplicate records. FYI: @mattwr18 @appinteractive @tansaku @Kachulio1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dc1ffd822..5b024eace 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "lint": "eslint src --config .eslintrc.js", "test": "nyc --reporter=text-lcov yarn run test:jest", "test:jest": "$npm_package_config_no_auth run-p --race start test:cmd:jest", - "test:cmd:jest": "jest --forceExit --detectOpenHandles", + "test:cmd:jest": "jest --forceExit --detectOpenHandles --runInBand", "test:coverage": "nyc report --reporter=text-lcov > coverage.lcov", "db:script:seed": "wait-on tcp:4001 && babel-node src/seed/seed-db.js", "db:script:reset": "wait-on tcp:4001 && babel-node src/seed/reset-db.js",