Test for amd resolution setting the recursive directory watcher in the parents of root folder
This commit is contained in:
parent
6e570e332a
commit
46e7ccae7c
1 changed files with 60 additions and 0 deletions
|
@ -8506,6 +8506,66 @@ new C();`
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
it("when watching directories for failed lookup locations in amd resolution", () => {
|
||||
const projectRoot = "/user/username/projects/project";
|
||||
const nodeFile: File = {
|
||||
path: `${projectRoot}/src/typings/node.d.ts`,
|
||||
content: `
|
||||
declare module "fs" {
|
||||
export interface something {
|
||||
}
|
||||
}`
|
||||
};
|
||||
const electronFile: File = {
|
||||
path: `${projectRoot}/src/typings/electron.d.ts`,
|
||||
content: `
|
||||
declare module 'original-fs' {
|
||||
import * as fs from 'fs';
|
||||
export = fs;
|
||||
}`
|
||||
};
|
||||
const srcFile: File = {
|
||||
path: `${projectRoot}/src/somefolder/srcfile.ts`,
|
||||
content: `
|
||||
import { x } from "somefolder/module1";
|
||||
import { x } from "somefolder/module2";
|
||||
const y = x;`
|
||||
};
|
||||
const moduleFile: File = {
|
||||
path: `${projectRoot}/src/somefolder/module1.ts`,
|
||||
content: `
|
||||
export const x = 10;`
|
||||
};
|
||||
const configFile: File = {
|
||||
path: `${projectRoot}/src/tsconfig.json`,
|
||||
content: JSON.stringify({
|
||||
compilerOptions: {
|
||||
module: "amd",
|
||||
moduleResolution: "classic",
|
||||
target: "es5",
|
||||
outDir: "../out",
|
||||
baseUrl: "./",
|
||||
typeRoots: ["typings"]
|
||||
|
||||
}
|
||||
})
|
||||
};
|
||||
const files = [nodeFile, electronFile, srcFile, moduleFile, configFile, libFile];
|
||||
const host = createServerHost(files);
|
||||
const service = createProjectService(host);
|
||||
service.openClientFile(srcFile.path, srcFile.content, ScriptKind.TS, projectRoot);
|
||||
checkProjectActualFiles(service.configuredProjects.get(configFile.path)!, files.map(f => f.path));
|
||||
checkWatchedFilesDetailed(host, mapDefined(files, f => f === srcFile ? undefined : f.path), 1);
|
||||
checkWatchedDirectories(host, emptyArray, /*recursive*/ false);
|
||||
const expectedWatchedDirectories = createMap<number>();
|
||||
expectedWatchedDirectories.set(`${projectRoot}/src`, 2); // Wild card and failed lookup
|
||||
expectedWatchedDirectories.set(`${projectRoot}/somefolder`, 1); // failed lookup for somefolder/module2
|
||||
expectedWatchedDirectories.set(`${projectRoot}`, 1); // failed lookup for fs
|
||||
expectedWatchedDirectories.set(`${projectRoot}/node_modules`, 1); // failed lookup for with node_modules/@types/fs
|
||||
expectedWatchedDirectories.set(`${projectRoot}/src/typings`, 1); // typeroot directory
|
||||
checkWatchedDirectoriesDetailed(host, expectedWatchedDirectories, /*recursive*/ true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tsserverProjectSystem watchDirectories implementation", () => {
|
||||
|
|
Loading…
Reference in a new issue