Skip to content

Commit

Permalink
Revert "Add util to create empty test result"
Browse files Browse the repository at this point in the history
This reverts commit b444350.
  • Loading branch information
Mark1626 committed Aug 22, 2019
1 parent c752e8f commit c3f95da
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 46 deletions.
19 changes: 14 additions & 5 deletions e2e/transform/transform-testrunner/test-runner.ts
Expand Up @@ -4,11 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {JestEnvironment} from '@jest/environment';
import {TestResult} from '@jest/test-result';
import {Config} from '@jest/types';
import {JestEnvironment} from '@jest/environment';
import Runtime from 'jest-runtime';
import {emptyTestResult} from 'jest-util';
import {TestResult} from '@jest/test-result';

export default async function testRunner(
globalConfig: Config.GlobalConfig,
Expand All @@ -18,8 +17,18 @@ export default async function testRunner(
testPath: string
): Promise<TestResult> {
return {
...emptyTestResult(),
numFailingTests: 0,
numPassingTests: 1,
numPendingTests: 0,
numTodoTests: 0,
snapshot: {
added: 0,
fileDeleted: false,
matched: 0,
unchecked: 0,
unmatched: 0,
updated: 0,
},
testFilePath: testPath,
testResults: [
{
Expand All @@ -31,5 +40,5 @@ export default async function testRunner(
title: 'sample test',
},
],
};
} as TestResult;
}
Expand Up @@ -16,7 +16,6 @@ import {
addSerializer,
buildSnapshotResolver,
} from 'jest-snapshot';
import {emptyTestResult} from 'jest-util';
import throat from 'throat';
import {
ROOT_DESCRIBE_BLOCK_NAME,
Expand Down Expand Up @@ -216,14 +215,30 @@ export const runAndTransformResultsToJestFormat = async ({

dispatch({name: 'teardown'});
return {
...emptyTestResult(),
console: undefined,
displayName: config.displayName,
failureMessage,
leaks: false, // That's legacy code, just adding it so Flow is happy.
numFailingTests,
numPassingTests,
numPendingTests,
numTodoTests,
openHandles: [],
perfStats: {
// populated outside
end: 0,
start: 0,
},
skipped: false,
snapshot: {
added: 0,
fileDeleted: false,
matched: 0,
unchecked: 0,
uncheckedKeys: [],
unmatched: 0,
updated: 0,
},
sourceMaps: {},
testExecError,
testFilePath: testPath,
Expand Down
6 changes: 4 additions & 2 deletions packages/jest-jasmine2/src/reporter.ts
Expand Up @@ -8,7 +8,6 @@
import {Config} from '@jest/types';
import {AssertionResult, TestResult} from '@jest/test-result';
import {formatResultsErrors} from 'jest-message-util';
import {emptyTestResult} from 'jest-util';
import {SpecResult} from './jasmine/Spec';
import {SuiteResult} from './jasmine/Suite';
import {Reporter, RunDetails} from './types';
Expand Down Expand Up @@ -79,7 +78,6 @@ export default class Jasmine2Reporter implements Reporter {
});

const testResult = {
...emptyTestResult(),
console: null,
failureMessage: formatResultsErrors(
testResults,
Expand All @@ -91,6 +89,10 @@ export default class Jasmine2Reporter implements Reporter {
numPassingTests,
numPendingTests,
numTodoTests,
perfStats: {
end: 0,
start: 0,
},
snapshot: {
added: 0,
fileDeleted: false,
Expand Down
35 changes: 0 additions & 35 deletions packages/jest-util/src/emptyTestResult.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/jest-util/src/index.ts
Expand Up @@ -31,7 +31,6 @@ import replacePathSepForGlob from './replacePathSepForGlob';
import testPathPatternToRegExp from './testPathPatternToRegExp';
import * as preRunMessage from './preRunMessage';
import pluralize from './pluralize';
import emptyTestResult from './emptyTestResult';

export = {
BufferedConsole,
Expand All @@ -43,7 +42,6 @@ export = {
convertDescriptorToString,
createDirectory,
deepCyclicCopy,
emptyTestResult,
formatTestResults,
getCallsite,
getConsoleOutput,
Expand Down

0 comments on commit c3f95da

Please sign in to comment.