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

@@ -1 +1 @@
{"version":3,"file":"eventHandler.d.ts","sourceRoot":"","sources":["../src/eventHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAgBnC,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,YAkL1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
{"version":3,"file":"eventHandler.d.ts","sourceRoot":"","sources":["../src/eventHandler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAgBnC,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,YAgL1B,CAAC;AAEF,eAAe,YAAY,CAAC"}

View File

@@ -49,9 +49,7 @@ const eventHandler = (event, state) => {
if (!(0, _utils.describeBlockHasTests)(currentDescribeBlock)) {
currentDescribeBlock.hooks.forEach(hook => {
hook.asyncError.message = `Invalid: ${
hook.type
}() may not be used in a describe block containing no tests.`;
hook.asyncError.message = `Invalid: ${hook.type}() may not be used in a describe block containing no tests.`;
state.unhandledErrors.push(hook.asyncError);
});
} // inherit mode from its parent describe but

View File

@@ -1 +1 @@
{"version":3,"file":"formatNodeAssertErrors.d.ts","sourceRoot":"","sources":["../src/formatNodeAssertErrors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAgCnC,QAAA,MAAM,sBAAsB,oDA4B3B,CAAC;AAsGF,eAAe,sBAAsB,CAAC"}
{"version":3,"file":"formatNodeAssertErrors.d.ts","sourceRoot":"","sources":["../src/formatNodeAssertErrors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AAgCnC,QAAA,MAAM,sBAAsB,oDA4B3B,CAAC;AAsHF,eAAe,sBAAsB,CAAC"}

View File

@@ -5,6 +5,8 @@ Object.defineProperty(exports, '__esModule', {
});
exports.default = void 0;
var _assert = require('assert');
var _jestMatcherUtils = require('jest-matcher-utils');
var _chalk = _interopRequireDefault(require('chalk'));
@@ -102,7 +104,7 @@ const formatNodeAssertErrors = (event, state) => {
error = errors;
}
return error.code === 'ERR_ASSERTION'
return isAssertionError(error)
? {
message: assertionErrorMessage(error, {
expand: state.expand
@@ -139,27 +141,30 @@ const operatorMessage = operator => {
};
const assertThrowingMatcherHint = operatorName =>
_chalk.default.dim('assert') +
_chalk.default.dim('.' + operatorName + '(') +
_chalk.default.red('function') +
_chalk.default.dim(')');
operatorName
? _chalk.default.dim('assert') +
_chalk.default.dim('.' + operatorName + '(') +
_chalk.default.red('function') +
_chalk.default.dim(')')
: '';
const assertMatcherHint = (operator, operatorName) => {
let message =
_chalk.default.dim('assert') +
_chalk.default.dim('.' + operatorName + '(') +
_chalk.default.red('received') +
_chalk.default.dim(', ') +
_chalk.default.green('expected') +
_chalk.default.dim(')');
const assertMatcherHint = (operator, operatorName, expected) => {
let message = '';
if (operator === '==') {
message +=
' or ' +
if (operator === '==' && expected === true) {
message =
_chalk.default.dim('assert') +
_chalk.default.dim('(') +
_chalk.default.red('received') +
_chalk.default.dim(') ');
_chalk.default.dim(')');
} else if (operatorName) {
message =
_chalk.default.dim('assert') +
_chalk.default.dim('.' + operatorName + '(') +
_chalk.default.red('received') +
_chalk.default.dim(', ') +
_chalk.default.green('expected') +
_chalk.default.dim(')');
}
return message;
@@ -181,8 +186,7 @@ function assertionErrorMessage(error, options) {
if (operatorName === 'doesNotThrow') {
return (
assertThrowingMatcherHint(operatorName) +
'\n\n' +
buildHintString(assertThrowingMatcherHint(operatorName)) +
_chalk.default.reset(`Expected the function not to throw an error.\n`) +
_chalk.default.reset(`Instead, it threw:\n`) +
` ${(0, _jestMatcherUtils.printReceived)(actual)}` +
@@ -195,8 +199,7 @@ function assertionErrorMessage(error, options) {
if (operatorName === 'throws') {
return (
assertThrowingMatcherHint(operatorName) +
'\n\n' +
buildHintString(assertThrowingMatcherHint(operatorName)) +
_chalk.default.reset(`Expected the function to throw an error.\n`) +
_chalk.default.reset(`But it didn't throw anything.`) +
_chalk.default.reset(
@@ -207,8 +210,7 @@ function assertionErrorMessage(error, options) {
}
return (
assertMatcherHint(operator, operatorName) +
'\n\n' +
buildHintString(assertMatcherHint(operator, operatorName, expected)) +
_chalk.default.reset(`Expected value ${operatorMessage(operator)}`) +
` ${(0, _jestMatcherUtils.printExpected)(expected)}\n` +
_chalk.default.reset(`Received:\n`) +
@@ -219,5 +221,18 @@ function assertionErrorMessage(error, options) {
);
}
function isAssertionError(error) {
return (
error &&
(error instanceof _assert.AssertionError ||
error.name === _assert.AssertionError.name ||
error.code === 'ERR_ASSERTION')
);
}
function buildHintString(hint) {
return hint ? hint + '\n\n' : '';
}
var _default = formatNodeAssertErrors;
exports.default = _default;

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