Skip to content

Commit

Permalink
Pass correct diagnostics list in transpile mode (#917)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weakky authored and blakeembrey committed Nov 28, 2019
1 parent ea6e1da commit 907e3e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,18 @@ describe('ts-node', function () {
})
})

it('should throw error even in transpileOnly mode', function (done) {
exec(`${BIN_EXEC} --transpile-only -pe "console."`, function (err) {
if (err === null) {
return done('Command was expected to fail, but it succeeded.')
}

expect(err.message).to.contain('error TS1003: Identifier expected')

return done()
})
})

it('should pipe into `ts-node` and evaluate', function (done) {
const cp = exec(BIN_EXEC, function (err, stdout) {
expect(err).to.equal(null)
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export function create (options: CreateOptions = {}): Register {
filterDiagnostics(result.diagnostics, ignoreDiagnostics) :
[]

if (diagnosticList.length) reportTSError(configDiagnosticList)
if (diagnosticList.length) reportTSError(diagnosticList)

return [result.outputText, result.sourceMapText as string]
}
Expand Down

0 comments on commit 907e3e1

Please sign in to comment.