diff --git a/src/runTsc.js b/src/runTsc.js index 236a232..72c0ea4 100644 --- a/src/runTsc.js +++ b/src/runTsc.js @@ -42,17 +42,16 @@ const runTsc = ({ testPath, config: jestConfig }) => { process.cwd() ); - const options = Object.assign({}, { noEmit: true }, settings.options); - - const program = ts.createProgram([testPath], options); - - const emitResult = program.emit(); + const options = { + compilerOptions: { + noEmit: true, + ...settings.options, + }, + }; - const allDiagnostics = ts - .getPreEmitDiagnostics(program) - .concat(emitResult.diagnostics); + const transpileOutput = ts.transpileModule(testPath, options); - const errors = allDiagnostics + const errors = transpileOutput.diagnostics .map(diagnostic => { if (diagnostic.file) { const {