Skip to content

Commit de5c967

Browse files
committed
build(testing): better errors if IO couldn't be caught
1 parent 9c38694 commit de5c967

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

e2e/__helpers__/test-case/run-result.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ export default class RunResult {
4444
if (!this.context.ioDir) {
4545
throw new Error('IO not written for test, you must configure the test with `writeIo: true`.')
4646
}
47-
const io = require(`${this.context.ioDir}/${relFilePath}.json`)
47+
let io: any = { in: ['', '', {}, {}], out: '' }
48+
try {
49+
io = require(`${this.context.ioDir}/${relFilePath}.json`)
50+
} catch (err) {
51+
io.out = `/* ts-jest after hook has not been called! ${err} */`
52+
}
4853
return new ProcessedFileIo(this.cwd, relFilePath, io.in, io.out)
4954
}
5055

0 commit comments

Comments
 (0)