Verify and fix scenario when .js and .ts files with same name are present and tsconfig doesnt specify any filenames
This commit is contained in:
parent
bc48c7c9f0
commit
9daf635e5e
|
@ -474,7 +474,7 @@ namespace ts {
|
|||
}
|
||||
else {
|
||||
let exclude = json["exclude"] instanceof Array ? map(<string[]>json["exclude"], normalizeSlashes) : undefined;
|
||||
let sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude));
|
||||
let sysFiles = host.readDirectory(basePath, ".ts", exclude).concat(host.readDirectory(basePath, ".tsx", exclude)).concat(host.readDirectory(basePath, ".js", exclude));
|
||||
for (let i = 0; i < sysFiles.length; i++) {
|
||||
let name = sysFiles[i];
|
||||
if (fileExtensionIs(name, ".js")) {
|
||||
|
|
|
@ -263,7 +263,13 @@ class ProjectRunner extends RunnerBase {
|
|||
}
|
||||
|
||||
function readDirectory(rootDir: string, extension: string, exclude: string[]): string[] {
|
||||
return Harness.IO.readDirectory(getFileNameInTheProjectTest(rootDir), extension, exclude);
|
||||
let harnessReadDirectoryResult = Harness.IO.readDirectory(getFileNameInTheProjectTest(rootDir), extension, exclude);
|
||||
let result: string[] = [];
|
||||
for (let i = 0; i < harnessReadDirectoryResult.length; i++) {
|
||||
result[i] = ts.getRelativePathToDirectoryOrUrl(testCase.projectRoot, harnessReadDirectoryResult[i],
|
||||
getCurrentDirectory(), Harness.Compiler.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function fileExists(fileName: string): boolean {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
declare var test: number;
|
|
@ -0,0 +1 @@
|
|||
var test = 10;
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"scenario": "Verify when same named .ts and .js file exists in the folder but no file is specified in tsconfig.json",
|
||||
"projectRoot": "tests/cases/projects/jsFileCompilation",
|
||||
"baselineCheck": true,
|
||||
"declaration": true,
|
||||
"project": "SameNameFilesNotSpecified",
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"SameNameFilesNotSpecified/a.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"SameNameFilesNotSpecified/a.js",
|
||||
"SameNameFilesNotSpecified/a.d.ts"
|
||||
]
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
declare var test: number;
|
|
@ -0,0 +1 @@
|
|||
var test = 10;
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"scenario": "Verify when same named .ts and .js file exists in the folder but no file is specified in tsconfig.json",
|
||||
"projectRoot": "tests/cases/projects/jsFileCompilation",
|
||||
"baselineCheck": true,
|
||||
"declaration": true,
|
||||
"project": "SameNameFilesNotSpecified",
|
||||
"resolvedInputFiles": [
|
||||
"lib.d.ts",
|
||||
"SameNameFilesNotSpecified/a.ts"
|
||||
],
|
||||
"emittedFiles": [
|
||||
"SameNameFilesNotSpecified/a.js",
|
||||
"SameNameFilesNotSpecified/a.d.ts"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"scenario": "Verify when same named .ts and .js file exists in the folder but no file is specified in tsconfig.json",
|
||||
"projectRoot": "tests/cases/projects/jsFileCompilation",
|
||||
"baselineCheck": true,
|
||||
"declaration": true,
|
||||
"project": "SameNameFilesNotSpecified"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
var test1 = 10; // Shouldnt get compiled
|
|
@ -0,0 +1 @@
|
|||
var test = 10;
|
Loading…
Reference in a new issue