@jest/core
Advanced tools
Comparing version 29.5.0 to 29.6.0
@@ -54,2 +54,9 @@ 'use strict'; | ||
} | ||
async onTestCaseStart(test, testCaseStartInfo) { | ||
for (const reporter of this._reporters) { | ||
if (reporter.onTestCaseStart) { | ||
await reporter.onTestCaseStart(test, testCaseStartInfo); | ||
} | ||
} | ||
} | ||
async onTestCaseResult(test, testCaseResult) { | ||
@@ -56,0 +63,0 @@ for (const reporter of this._reporters) { |
@@ -260,2 +260,12 @@ 'use strict'; | ||
testRunner.on( | ||
'test-case-start', | ||
([testPath, testCaseStartInfo]) => { | ||
const test = { | ||
context, | ||
path: testPath | ||
}; | ||
this._dispatcher.onTestCaseStart(test, testCaseStartInfo); | ||
} | ||
), | ||
testRunner.on( | ||
'test-case-result', | ||
@@ -262,0 +272,0 @@ ([testPath, testCaseResult]) => { |
@@ -26,19 +26,21 @@ 'use strict'; | ||
/* | ||
* Run in band if we only have one test or one worker available, unless we | ||
* are using the watch mode, in which case the TTY has to be responsive and | ||
* we cannot schedule anything in the main thread. Same logic applies to | ||
* watchAll. | ||
* If we are using watch/watchAll mode, don't schedule anything in the main | ||
* thread to keep the TTY responsive and to prevent watch mode crashes caused | ||
* by leaks (improper test teardown). | ||
*/ | ||
if (watch || watchAll) { | ||
return false; | ||
} | ||
/* | ||
* Otherwise, run in band if we only have one test or one worker available. | ||
* Also, if we are confident from previous runs that the tests will finish | ||
* quickly we also run in band to reduce the overhead of spawning workers. | ||
* Finally, the user can provide the runInBand argument in the CLI to | ||
* force running in band. | ||
* https://github.com/facebook/jest/blob/700e0dadb85f5dc8ff5dac6c7e98956690049734/packages/jest-config/src/getMaxWorkers.js#L14-L17 | ||
* force running in band, which sets maxWorkers to 1 here: | ||
* https://github.com/facebook/jest/blob/d106643a8ee0ffa9c2f11c6bb2d12094e99135aa/packages/jest-config/src/getMaxWorkers.ts#L27-L28 | ||
*/ | ||
const isWatchMode = watch || watchAll; | ||
const areFastTests = timings.every(timing => timing < SLOW_TEST_TIME); | ||
const oneWorkerOrLess = maxWorkers <= 1; | ||
const oneTestOrLess = tests.length <= 1; | ||
if (isWatchMode) { | ||
return oneWorkerOrLess || (oneTestOrLess && areFastTests); | ||
} | ||
return ( | ||
@@ -45,0 +47,0 @@ // When specifying a memory limit, workers should be used |
{ | ||
"name": "@jest/core", | ||
"description": "Delightful JavaScript Testing.", | ||
"version": "29.5.0", | ||
"version": "29.6.0", | ||
"main": "./build/index.js", | ||
@@ -15,7 +15,7 @@ "types": "./build/index.d.ts", | ||
"dependencies": { | ||
"@jest/console": "^29.5.0", | ||
"@jest/reporters": "^29.5.0", | ||
"@jest/test-result": "^29.5.0", | ||
"@jest/transform": "^29.5.0", | ||
"@jest/types": "^29.5.0", | ||
"@jest/console": "^29.6.0", | ||
"@jest/reporters": "^29.6.0", | ||
"@jest/test-result": "^29.6.0", | ||
"@jest/transform": "^29.6.0", | ||
"@jest/types": "^29.6.0", | ||
"@types/node": "*", | ||
@@ -28,16 +28,16 @@ "ansi-escapes": "^4.2.1", | ||
"jest-changed-files": "^29.5.0", | ||
"jest-config": "^29.5.0", | ||
"jest-haste-map": "^29.5.0", | ||
"jest-message-util": "^29.5.0", | ||
"jest-config": "^29.6.0", | ||
"jest-haste-map": "^29.6.0", | ||
"jest-message-util": "^29.6.0", | ||
"jest-regex-util": "^29.4.3", | ||
"jest-resolve": "^29.5.0", | ||
"jest-resolve-dependencies": "^29.5.0", | ||
"jest-runner": "^29.5.0", | ||
"jest-runtime": "^29.5.0", | ||
"jest-snapshot": "^29.5.0", | ||
"jest-util": "^29.5.0", | ||
"jest-validate": "^29.5.0", | ||
"jest-watcher": "^29.5.0", | ||
"jest-resolve": "^29.6.0", | ||
"jest-resolve-dependencies": "^29.6.0", | ||
"jest-runner": "^29.6.0", | ||
"jest-runtime": "^29.6.0", | ||
"jest-snapshot": "^29.6.0", | ||
"jest-util": "^29.6.0", | ||
"jest-validate": "^29.6.0", | ||
"jest-watcher": "^29.6.0", | ||
"micromatch": "^4.0.4", | ||
"pretty-format": "^29.5.0", | ||
"pretty-format": "^29.6.0", | ||
"slash": "^3.0.0", | ||
@@ -47,4 +47,4 @@ "strip-ansi": "^6.0.0" | ||
"devDependencies": { | ||
"@jest/test-sequencer": "^29.5.0", | ||
"@jest/test-utils": "^29.5.0", | ||
"@jest/test-sequencer": "^29.6.0", | ||
"@jest/test-utils": "^29.6.0", | ||
"@types/exit": "^0.1.30", | ||
@@ -104,3 +104,3 @@ "@types/graceful-fs": "^4.1.3", | ||
}, | ||
"gitHead": "39f3beda6b396665bebffab94e8d7c45be30454c" | ||
"gitHead": "c1e5b8a38ef54bb138409f89831942ebf6a7a67e" | ||
} |
145496
4844
Updated@jest/console@^29.6.0
Updated@jest/reporters@^29.6.0
Updated@jest/test-result@^29.6.0
Updated@jest/transform@^29.6.0
Updated@jest/types@^29.6.0
Updatedjest-config@^29.6.0
Updatedjest-haste-map@^29.6.0
Updatedjest-message-util@^29.6.0
Updatedjest-resolve@^29.6.0
Updatedjest-runner@^29.6.0
Updatedjest-runtime@^29.6.0
Updatedjest-snapshot@^29.6.0
Updatedjest-util@^29.6.0
Updatedjest-validate@^29.6.0
Updatedjest-watcher@^29.6.0
Updatedpretty-format@^29.6.0