Skip to content

Commit

Permalink
feat: use transpileModule instead of createProgram (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
wzoom authored and azz committed Mar 23, 2019
1 parent f3480cc commit 0e2a38e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/runTsc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0e2a38e

Please sign in to comment.