File tree 1 file changed +33
-1
lines changed
integration_tests/__tests__
1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -56,5 +56,37 @@ test('not throwing Error objects', () => {
56
56
57
57
test ( 'works with node assert' , ( ) => {
58
58
const { stderr} = runJest ( dir , [ 'node_assertion_error.test.js' ] ) ;
59
- expect ( normalizeDots ( extractSummary ( stderr ) . rest ) ) . toMatchSnapshot ( ) ;
59
+ let summary = normalizeDots ( extractSummary ( stderr ) . rest ) ;
60
+
61
+ // Node 9 started to include the error for `doesNotThrow`
62
+ // https://github.com/nodejs/node/pull/12167
63
+ if ( Number ( process . versions . node . split ( '.' ) [ 0 ] ) >= 9 ) {
64
+ expect ( summary ) . toContain ( `
65
+ assert.doesNotThrow(function)
66
+
67
+ Expected the function not to throw an error.
68
+ Instead, it threw:
69
+ [Error: err!]
70
+
71
+ Message:
72
+ Got unwanted exception.
73
+ err!
74
+ err!
75
+
76
+ at __tests__/node_assertion_error.test.js:71:10
77
+ ` ) ;
78
+
79
+ summary = summary . replace (
80
+ `Message:
81
+ Got unwanted exception.
82
+ err!
83
+ err!
84
+ ` ,
85
+ `Message:
86
+ Got unwanted exception.
87
+ ` ,
88
+ ) ;
89
+ }
90
+
91
+ expect ( summary ) . toMatchSnapshot ( ) ;
60
92
} ) ;
You can’t perform that action at this time.
0 commit comments