File tree Expand file tree Collapse file tree
e2e/transform/transform-testrunner
jest-circus/src/legacy-code-todo-rewrite Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 * This source code is licensed under the MIT license found in the
55 * LICENSE file in the root directory of this source tree.
66 */
7- import { Config } from '@jest/types' ;
87import { JestEnvironment } from '@jest/environment' ;
9- import Runtime from 'jest-runtime' ;
108import { TestResult } from '@jest/test-result' ;
9+ import { Config } from '@jest/types' ;
10+ import Runtime from 'jest-runtime' ;
11+ import { emptyTestResult } from 'jest-util' ;
1112
1213export default async function testRunner (
1314 globalConfig : Config . GlobalConfig ,
@@ -17,28 +18,7 @@ export default async function testRunner(
1718 testPath : string
1819) : Promise < TestResult > {
1920 return {
20- numFailingTests : 0 ,
21- numPassingTests : 1 ,
22- numPendingTests : 0 ,
23- numTodoTests : 0 ,
24- snapshot : {
25- added : 0 ,
26- fileDeleted : false ,
27- matched : 0 ,
28- unchecked : 0 ,
29- unmatched : 0 ,
30- updated : 0 ,
31- } ,
21+ ...emptyTestResult ( ) ,
3222 testFilePath : testPath ,
33- testResults : [
34- {
35- ancestorTitles : [ ] ,
36- duration : 2 ,
37- failureMessages : [ ] ,
38- fullName : 'sample test' ,
39- status : 'passed' ,
40- title : 'sample test' ,
41- } ,
42- ] ,
43- } as TestResult ;
23+ } ;
4424}
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
1616 addSerializer ,
1717 buildSnapshotResolver ,
1818} from 'jest-snapshot' ;
19+ import { emptyTestResult } from 'jest-util' ;
1920import throat from 'throat' ;
2021import {
2122 ROOT_DESCRIBE_BLOCK_NAME ,
@@ -215,30 +216,14 @@ export const runAndTransformResultsToJestFormat = async ({
215216
216217 dispatch ( { name : 'teardown' } ) ;
217218 return {
219+ ...emptyTestResult ( ) ,
218220 console : undefined ,
219221 displayName : config . displayName ,
220222 failureMessage,
221- leaks : false , // That's legacy code, just adding it so Flow is happy.
222223 numFailingTests,
223224 numPassingTests,
224225 numPendingTests,
225226 numTodoTests,
226- openHandles : [ ] ,
227- perfStats : {
228- // populated outside
229- end : 0 ,
230- start : 0 ,
231- } ,
232- skipped : false ,
233- snapshot : {
234- added : 0 ,
235- fileDeleted : false ,
236- matched : 0 ,
237- unchecked : 0 ,
238- uncheckedKeys : [ ] ,
239- unmatched : 0 ,
240- updated : 0 ,
241- } ,
242227 sourceMaps : { } ,
243228 testExecError,
244229 testFilePath : testPath ,
Original file line number Diff line number Diff line change 88import { Config } from '@jest/types' ;
99import { AssertionResult , TestResult } from '@jest/test-result' ;
1010import { formatResultsErrors } from 'jest-message-util' ;
11+ import { emptyTestResult } from 'jest-util' ;
1112import { SpecResult } from './jasmine/Spec' ;
1213import { SuiteResult } from './jasmine/Suite' ;
1314import { Reporter , RunDetails } from './types' ;
@@ -78,6 +79,7 @@ export default class Jasmine2Reporter implements Reporter {
7879 } ) ;
7980
8081 const testResult = {
82+ ...emptyTestResult ( ) ,
8183 console : null ,
8284 failureMessage : formatResultsErrors (
8385 testResults ,
@@ -89,10 +91,6 @@ export default class Jasmine2Reporter implements Reporter {
8991 numPassingTests,
9092 numPendingTests,
9193 numTodoTests,
92- perfStats : {
93- end : 0 ,
94- start : 0 ,
95- } ,
9694 snapshot : {
9795 added : 0 ,
9896 fileDeleted : false ,
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3+ *
4+ * This source code is licensed under the MIT license found in the
5+ * LICENSE file in the root directory of this source tree.
6+ */
7+
8+ import { TestResult } from '@jest/test-result' ;
9+
10+ export default function emptyTestResult ( ) : TestResult {
11+ return {
12+ leaks : false , // That's legacy code, just adding it so Flow is happy.
13+ numFailingTests : 0 ,
14+ numPassingTests : 0 ,
15+ numPendingTests : 0 ,
16+ numTodoTests : 0 ,
17+ openHandles : [ ] ,
18+ perfStats : {
19+ end : 0 ,
20+ start : 0 ,
21+ } ,
22+ skipped : false ,
23+ snapshot : {
24+ added : 0 ,
25+ fileDeleted : false ,
26+ matched : 0 ,
27+ unchecked : 0 ,
28+ uncheckedKeys : [ ] ,
29+ unmatched : 0 ,
30+ updated : 0 ,
31+ } ,
32+ testFilePath : '' ,
33+ testResults : [ ] ,
34+ } ;
35+ }
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import replacePathSepForGlob from './replacePathSepForGlob';
3131import testPathPatternToRegExp from './testPathPatternToRegExp' ;
3232import * as preRunMessage from './preRunMessage' ;
3333import pluralize from './pluralize' ;
34+ import emptyTestResult from './emptyTestResult' ;
3435
3536export = {
3637 BufferedConsole,
@@ -42,6 +43,7 @@ export = {
4243 convertDescriptorToString,
4344 createDirectory,
4445 deepCyclicCopy,
46+ emptyTestResult,
4547 formatTestResults,
4648 getCallsite,
4749 getConsoleOutput,
You can’t perform that action at this time.
0 commit comments