fix(51072): ts.preProcessFile finds import in template string after conditional expression with template strings (#51082)

This commit is contained in:
Oleksandr T authored and GitHub committed 2022-10-07 10:33:20 -07:00
1 parent ad56b5ca56
commit d0bfd8caed
2 files changed
+17 -2

No files matched your search

@@ -205,6 +205,22 @@ describe("unittests:: services:: PreProcessFile:", () => {
/* eslint-enable no-template-curly-in-string */
});
it("Ignores imports in template strings", () => {
/* eslint-disable no-template-curly-in-string */
test("a ? `&${a}` : `#${b}`;\n\n `import(\"${moduleSpecifier}\").${id}`;",
/*readImportFile*/ true,
/*detectJavaScriptImports*/ true,
{
referencedFiles: [],
typeReferenceDirectives: [],
libReferenceDirectives: [],
importedFiles: [],
ambientExternalModules: undefined,
isLibFile: false
});
/* eslint-enable no-template-curly-in-string */
});
it("Correctly returns imports after a template expression", () => {
/* eslint-disable no-template-curly-in-string */
test("`${foo}`; import \"./foo\";",