Skip to content

Commit 81e5fb9

Browse files
mertcanaltinaduh95
andauthored
Update test/es-module/test-typescript-commonjs.mjs
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 2d5e37c commit 81e5fb9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/es-module/test-typescript-commonjs.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,13 @@ test('expect failure of an .mts file with CommonJS syntax', async () => {
8585
result.stderr.includes(expectedWarning),
8686
`Expected stderr to include: ${expectedWarning}`
8787
);
88-
} catch (error) {
89-
console.error('Detailed error: The stderr did not include the expected warning:', error);
90-
throw error;
88+
} catch (e) {
89+
if (e?.code === 'ERR_ASSERTION') {
90+
e.expected = expectedWarning;
91+
e.actual = result.stderr;
92+
e.operator = 'includes';
93+
}
94+
throw e;
9195
}
9296

9397

0 commit comments

Comments
 (0)