summaryrefslogtreecommitdiff
path: root/js/compiler_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'js/compiler_test.ts')
-rw-r--r--js/compiler_test.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/js/compiler_test.ts b/js/compiler_test.ts
index fdb5fe03b..fef18ec3d 100644
--- a/js/compiler_test.ts
+++ b/js/compiler_test.ts
@@ -458,6 +458,23 @@ test(function compilerGetScriptFileNames() {
teardown();
});
+test(function compilerRecompileFlag() {
+ setup();
+ compilerInstance.run("foo/bar.ts", "/root/project");
+ assertEqual(getEmitOutputStack.length, 1, "Expected only a single emitted file.");
+ // running compiler against same file should use cached code
+ compilerInstance.run("foo/bar.ts", "/root/project");
+ assertEqual(getEmitOutputStack.length, 1, "Expected only a single emitted file.");
+ compilerInstance.recompile = true;
+ compilerInstance.run("foo/bar.ts", "/root/project");
+ assertEqual(getEmitOutputStack.length, 2, "Expected two emitted file.");
+ assert(
+ getEmitOutputStack[0] === getEmitOutputStack[1],
+ "Expected same file to be emitted twice."
+ );
+ teardown();
+});
+
test(function compilerGetScriptKind() {
assertEqual(compilerInstance.getScriptKind("foo.ts"), ts.ScriptKind.TS);
assertEqual(compilerInstance.getScriptKind("foo.d.ts"), ts.ScriptKind.TS);