Fix #2496: make e2e tests exit if any single test fails

This commit is contained in:
Oliver Blanthorn 2020-06-17 15:25:01 +01:00
parent c255251658
commit 2651541ccf
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
4 changed files with 19 additions and 1 deletions

7
e2e_tests/failfast.js Normal file
View file

@ -0,0 +1,7 @@
// Borrowed from https://github.com/facebook/jest/issues/2867#issuecomment-546592968-permalink
const failFast = require("jasmine-fail-fast");
if (process.argv.includes("--bail")) {
const jasmineEnv = jasmine.getEnv();
jasmineEnv.addReporter(failFast.init());
}

View file

@ -5,6 +5,9 @@ module.exports = {
setupFiles: [
"jest-webextension-mock"
],
setupFilesAfterEnv: [
"e2e_tests/failfast.js"
],
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
globals: {
"ts-jest": {

View file

@ -11,6 +11,7 @@
"flyd": "^0.2.8",
"fuse.js": "^6.0.4",
"immer": "^6.0.9",
"jasmine-fail-fast": "^2.0.1",
"mark.js": "^8.11.1",
"mithril": "^2.0.4",
"ramda": "^0.27.0",
@ -54,7 +55,7 @@
"build": "sh scripts/build.sh",
"clean": "rm -rf build generated",
"forrest-run": "yarn run run",
"jest": "jest",
"jest": "jest --bail --runInBand",
"lint": "bash hooks/pre-commit",
"make-zip": "web-ext build --source-dir build --overwrite-dest",
"pretty": "bash scripts/pretty.sh",

View file

@ -4707,6 +4707,13 @@ istanbul-reports@^3.0.2:
html-escaper "^2.0.0"
istanbul-lib-report "^3.0.0"
jasmine-fail-fast@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/jasmine-fail-fast/-/jasmine-fail-fast-2.0.1.tgz#222daa16c89b675aba4ed9552d62cf0d1e759d71"
integrity sha512-En8ONwvDQOV+jyiZEZvbvUSLWSdJFj9HiWjhLdGq/V/gxs4XyST730ooe928BbRxv4bfy05OpykKuoOU4aLC5w==
dependencies:
lodash "^4.17.15"
jed@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/jed/-/jed-1.1.1.tgz#7a549bbd9ffe1585b0cd0a191e203055bee574b4"