File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
3
- const { run } = require ( "../../../testUtils" ) ;
3
+ const { run, extractSummary } = require ( "../../../testUtils" ) ;
4
4
5
5
test ( "complex" , ( ) => {
6
6
const { code, stdout, stderr } = run ( __dirname , [
@@ -19,13 +19,15 @@ test("complex", () => {
19
19
"async-node"
20
20
] ) ;
21
21
22
+ const summary = extractSummary ( stdout ) ;
23
+
22
24
expect ( code ) . toBe ( 0 ) ;
23
- expect ( stdout ) . toEqual ( expect . anything ( ) ) ;
24
- expect ( stdout ) . toContain ( "Environment (--env):" ) ;
25
- expect ( stdout ) . toContain ( "baz" ) ;
26
- expect ( stdout ) . toContain ( "null.js" ) ;
27
- expect ( stdout ) . toContain ( "./index.js" ) ;
28
- expect ( stdout ) . toContain ( "[built]" ) ;
25
+ expect ( summary ) . toEqual ( expect . anything ( ) ) ;
26
+ expect ( summary ) . toContain ( "Environment (--env):" ) ;
27
+ expect ( summary ) . toContain ( "baz" ) ;
28
+ expect ( summary ) . toContain ( "null.js" ) ;
29
+ expect ( summary ) . toContain ( "./index.js" ) ;
30
+ expect ( summary ) . toContain ( "[built]" ) ;
29
31
expect ( stderr ) . toHaveLength ( 0 ) ;
30
- expect ( stdout ) . toMatchSnapshot ( ) ;
32
+ expect ( summary ) . toMatchSnapshot ( ) ;
31
33
} ) ;
Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
3
- const { run } = require ( "../../../testUtils" ) ;
3
+ const { run, extractSummary } = require ( "../../../testUtils" ) ;
4
4
5
5
test ( "string" , ( ) => {
6
6
const { code, stdout } = run ( __dirname , [
@@ -18,9 +18,11 @@ test("string", () => {
18
18
"async-node"
19
19
] ) ;
20
20
21
+ const summary = extractSummary ( stdout ) ;
22
+
21
23
expect ( code ) . toBe ( 0 ) ;
22
- expect ( stdout ) . toEqual ( expect . anything ( ) ) ;
23
- expect ( stdout ) . toContain ( "Environment (--env): \"foo\"" ) ;
24
- expect ( stdout ) . toContain ( "null.js" ) ;
25
- expect ( stdout ) . toMatchSnapshot ( ) ;
24
+ expect ( summary ) . toEqual ( expect . anything ( ) ) ;
25
+ expect ( summary ) . toContain ( "Environment (--env): \"foo\"" ) ;
26
+ expect ( summary ) . toContain ( "null.js" ) ;
27
+ expect ( summary ) . toMatchSnapshot ( ) ;
26
28
} ) ;
You can’t perform that action at this time.
0 commit comments