Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass the right diagnostics list in transpileOnly mode #917

Merged
merged 1 commit into from Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/index.spec.ts
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
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