Skip to content

Commit

Permalink
build(testing): better errors if IO couldn't be caught
Browse files Browse the repository at this point in the history
  • Loading branch information
huafu committed Sep 2, 2018
1 parent 9c38694 commit de5c967
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion e2e/__helpers__/test-case/run-result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ export default class RunResult {
if (!this.context.ioDir) {
throw new Error('IO not written for test, you must configure the test with `writeIo: true`.')
}
const io = require(`${this.context.ioDir}/${relFilePath}.json`)
let io: any = { in: ['', '', {}, {}], out: '' }
try {
io = require(`${this.context.ioDir}/${relFilePath}.json`)
} catch (err) {
io.out = `/* ts-jest after hook has not been called! ${err} */`
}
return new ProcessedFileIo(this.cwd, relFilePath, io.in, io.out)
}

Expand Down

0 comments on commit de5c967

Please sign in to comment.