File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"use strict" ;
22
3- const { run } = require ( "../../../testUtils" ) ;
3+ const { run, extractSummary } = require ( "../../../testUtils" ) ;
44
55test ( "complex" , ( ) => {
66 const { code, stdout, stderr } = run ( __dirname , [
@@ -19,13 +19,15 @@ test("complex", () => {
1919 "async-node"
2020 ] ) ;
2121
22+ const summary = extractSummary ( stdout ) ;
23+
2224 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]" ) ;
2931 expect ( stderr ) . toHaveLength ( 0 ) ;
30- expect ( stdout ) . toMatchSnapshot ( ) ;
32+ expect ( summary ) . toMatchSnapshot ( ) ;
3133} ) ;
Original file line number Diff line number Diff line change 11"use strict" ;
22
3- const { run } = require ( "../../../testUtils" ) ;
3+ const { run, extractSummary } = require ( "../../../testUtils" ) ;
44
55test ( "string" , ( ) => {
66 const { code, stdout } = run ( __dirname , [
@@ -18,9 +18,11 @@ test("string", () => {
1818 "async-node"
1919 ] ) ;
2020
21+ const summary = extractSummary ( stdout ) ;
22+
2123 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 ( ) ;
2628} ) ;
You can’t perform that action at this time.
0 commit comments