1
0
mirror of https://github.com/actions/labeler synced 2026-05-14 09:31:08 +02:00
This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

View File

@@ -71,15 +71,20 @@ const initialize = ({
parentProcess,
testPath
}) => {
const mutex = (0, _throat.default)(globalConfig.maxConcurrency);
Object.assign(global, _.default);
global.xit = global.it.skip;
global.xtest = global.it.skip;
global.xdescribe = global.describe.skip;
global.fit = global.it.only;
global.fdescribe = global.describe.only;
if (globalConfig.testTimeout) {
(0, _state.getState)().testTimeout = globalConfig.testTimeout;
}
global.test.concurrent = (test => {
const mutex = (0, _throat.default)(globalConfig.maxConcurrency);
const nodeGlobal = global;
Object.assign(nodeGlobal, _.default);
nodeGlobal.xit = nodeGlobal.it.skip;
nodeGlobal.xtest = nodeGlobal.it.skip;
nodeGlobal.xdescribe = nodeGlobal.describe.skip;
nodeGlobal.fit = nodeGlobal.it.only;
nodeGlobal.fdescribe = nodeGlobal.describe.only;
nodeGlobal.test.concurrent = (test => {
const concurrent = (testName, testFn, timeout) => {
// For concurrent tests we first run the function that returns promise, and then register a
// nomral test that will be waiting on the returned promise (when we start the test, the promise
@@ -88,7 +93,7 @@ const initialize = ({
// that will result in this test to be skipped, so we'll be executing the promise function anyway,
// even if it ends up being skipped.
const promise = mutex(() => testFn());
global.test(testName, () => promise, timeout);
nodeGlobal.test(testName, () => promise, timeout);
};
concurrent.only = (testName, testFn, timeout) => {
@@ -99,7 +104,7 @@ const initialize = ({
concurrent.skip = test.skip;
return concurrent;
})(global.test);
})(nodeGlobal.test);
(0, _state.addEventHandler)(eventHandler);
@@ -139,7 +144,8 @@ const initialize = ({
(0, _expect.setState)({
snapshotState,
testPath
}); // Return it back to the outer scope (test runner outside the VM).
});
(0, _state.addEventHandler)(handleSnapshotStateAfterRetry(snapshotState)); // Return it back to the outer scope (test runner outside the VM).
return {
globals: _.default,
@@ -259,6 +265,15 @@ const runAndTransformResultsToJestFormat =
exports.runAndTransformResultsToJestFormat = runAndTransformResultsToJestFormat;
const handleSnapshotStateAfterRetry = snapshotState => event => {
switch (event.name) {
case 'test_retry': {
// Clear any snapshot data that occurred in previous test run
snapshotState.clear();
}
}
};
const eventHandler = event => {
switch (event.name) {
case 'test_start': {