-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathFsFileSystem-spec.ts
More file actions
43 lines (38 loc) · 1.4 KB
/
FsFileSystem-spec.ts
File metadata and controls
43 lines (38 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as glob from "glob";
import { FsFileSystem } from "../../packages/core/util/FileSystem";
describe("Unit - FsFileSystem", () => {
let fileSystem: FsFileSystem;
beforeEach(() => {
fileSystem = new FsFileSystem();
});
describe("glob", () => {
it("should pass a forward-slash pattern to glob even when dirPath uses backslashes", () => {
spyOn(glob, "sync").and.returnValue([]);
const windowsDirPath = "C:\\Work\\git\\project\\src";
fileSystem.glob(windowsDirPath, "**/*.ts");
expect(glob.sync).toHaveBeenCalledWith(
"C:/Work/git/project/src/**/*.ts",
jasmine.objectContaining({ nodir: true })
);
});
it("should pass a forward-slash pattern to glob even when pattern contains backslashes", () => {
spyOn(glob, "sync").and.returnValue([]);
fileSystem.glob("C:\\Work\\project", "sub\\**\\*.ts");
expect(glob.sync).toHaveBeenCalledWith(
"C:/Work/project/sub/**/*.ts",
jasmine.objectContaining({ nodir: true })
);
});
it("should work correctly with forward-slash paths (non-Windows)", () => {
spyOn(glob, "sync").and.returnValue([
"/home/user/project/src/app.ts"
] as any);
const result = fileSystem.glob("/home/user/project", "src/**/*.ts");
expect(glob.sync).toHaveBeenCalledWith(
"/home/user/project/src/**/*.ts",
jasmine.objectContaining({ nodir: true })
);
expect(result).toEqual(["/home/user/project/src/app.ts"]);
});
});
});