1
0
mirror of https://github.com/actions/labeler synced 2026-05-11 17:21:06 +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

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
/// <reference types="node" />
import { Circus, Config } from '@jest/types';
import { Circus, Config, Global } from '@jest/types';
import { JestEnvironment } from '@jest/environment';
import { TestResult } from '@jest/test-result';
export declare const initialize: ({ config, environment, getPrettier, getBabelTraverse, globalConfig, localRequire, parentProcess, testPath, }: {
@@ -24,21 +24,21 @@ export declare const initialize: ({ config, environment, getPrettier, getBabelTr
beforeAll: (fn: Circus.HookFn, timeout?: number | undefined) => void;
beforeEach: (fn: Circus.HookFn, timeout?: number | undefined) => void;
describe: {
(blockName: string, blockFn: import("@jest/types/build/Global").BlockFn): void;
each: (table: import("@jest/types/build/Global").EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: import("@jest/types/build/Global").EachTestFn, timeout?: number | undefined) => void;
(blockName: string, blockFn: Global.BlockFn): void;
each: (table: Global.EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void;
only: {
(blockName: string, blockFn: import("@jest/types/build/Global").BlockFn): void;
each: (table: import("@jest/types/build/Global").EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: import("@jest/types/build/Global").EachTestFn, timeout?: number | undefined) => void;
(blockName: string, blockFn: Global.BlockFn): void;
each: (table: Global.EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void;
};
skip: {
(blockName: string, blockFn: import("@jest/types/build/Global").BlockFn): void;
each: (table: import("@jest/types/build/Global").EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: import("@jest/types/build/Global").EachTestFn, timeout?: number | undefined) => void;
(blockName: string, blockFn: Global.BlockFn): void;
each: (table: Global.EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void;
};
};
it: import("@jest/types/build/Global").It;
test: import("@jest/types/build/Global").It;
it: Global.It;
test: Global.It;
};
snapshotState: import("../../../jest-snapshot/build/State").default;
snapshotState: import("jest-snapshot/build/State").default;
};
export declare const runAndTransformResultsToJestFormat: ({ config, globalConfig, testPath, }: {
config: Config.ProjectConfig;

View File

@@ -1 +1 @@
{"version":3,"file":"jestAdapterInit.d.ts","sourceRoot":"","sources":["../../src/legacy-code-todo-rewrite/jestAdapterInit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAA0B,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAgBtE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoGtB,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;yBA0G9C,CAAC"}
{"version":3,"file":"jestAdapterInit.d.ts","sourceRoot":"","sources":["../../src/legacy-code-todo-rewrite/jestAdapterInit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAA0B,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAsBtE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GtB,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;yBA0G9C,CAAC"}

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': {