From 3fe4be07ca19b40a2444b714f5927ff155d66fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 24 Sep 2018 21:33:50 +0200 Subject: Add flag --recompile (#801) --- js/compiler_test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'js/compiler_test.ts') 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); -- cgit v1.2.3