summaryrefslogtreecommitdiff
path: root/js/compiler_test.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2018-09-24 21:33:50 +0200
committerRyan Dahl <ry@tinyclouds.org>2018-09-24 15:33:50 -0400
commit3fe4be07ca19b40a2444b714f5927ff155d66fed (patch)
treeec30d7f4a8f5014917058de8aebf50031bdca796 /js/compiler_test.ts
parent17a7b03d1b86b3519e611aa855f561352075a954 (diff)
Add flag --recompile (#801)
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);