Skip to content

Commit 40f0c60

Browse files
committed
use transpileModule
1 parent eac7a48 commit 40f0c60

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/harness/fourslash.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,11 @@ namespace FourSlash {
22632263
// Parse out the files and their metadata
22642264
const testData = parseTestData(basePath, content, fileName);
22652265
const state = new TestState(basePath, testType, testData);
2266-
runCode(ts.transpile(content), state);
2266+
const output = ts.transpileModule(content, { reportDiagnostics: true });
2267+
if (output.diagnostics.length > 0) {
2268+
throw new Error(`Syntax error in ${basePath}: ${output.diagnostics[0].messageText}`);
2269+
}
2270+
runCode(output.outputText, state);
22672271
}
22682272

22692273
function runCode(code: string, state: TestState): void {

0 commit comments

Comments
 (0)