Skip to content

Commit b771d70

Browse files
committed
Test
1 parent bdcf8ab commit b771d70

File tree

2 files changed

+595
-0
lines changed

2 files changed

+595
-0
lines changed

src/testRunner/unittests/tscWatch/resolutionCache.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as ts from "../../_namespaces/ts";
22
import * as Utils from "../../_namespaces/Utils";
3+
import { libContent } from "../tsc/helpers";
34
import {
45
createWatchedSystem,
56
File,
@@ -621,4 +622,64 @@ declare namespace NodeJS {
621622
},
622623
]
623624
});
625+
626+
verifyTscWatch({
627+
scenario,
628+
subScenario: "scoped package installation",
629+
commandLineArgs: ["--w", "-p", `.`, "--traceResolution", "--extendedDiagnostics"],
630+
sys: () => createWatchedSystem({
631+
"/user/username/projects/myproject/lib/app.ts": Utils.dedent`
632+
import { myapp } from "@myapp/ts-types";
633+
const x: 10 = myapp;
634+
`,
635+
"/user/username/projects/myproject/tsconfig.json": "{}",
636+
[libFile.path]: libContent,
637+
}, { currentDirectory: "/user/username/projects/myproject" }),
638+
edits: [
639+
{
640+
caption: "npm install unrelated non scoped",
641+
edit: sys => sys.ensureFileOrFolder({
642+
path: `/user/username/projects/myproject/node_modules/unrelated/index.d.ts`,
643+
content: `export const unrelated = 10;`
644+
}),
645+
timeouts: sys => {
646+
sys.runQueuedTimeoutCallbacks();
647+
sys.runQueuedTimeoutCallbacks();
648+
},
649+
},
650+
{
651+
caption: "npm install unrelated scoped in myapp",
652+
edit: sys => sys.ensureFileOrFolder({
653+
path: `/user/username/projects/myproject/node_modules/@myapp/unrelated/index.d.ts`,
654+
content: `export const myappUnrelated = 10;`
655+
}),
656+
timeouts: sys => {
657+
sys.runQueuedTimeoutCallbacks();
658+
sys.runQueuedTimeoutCallbacks();
659+
},
660+
},
661+
{
662+
caption: "npm install unrelated2 scoped in myapp",
663+
edit: sys => sys.ensureFileOrFolder({
664+
path: `/user/username/projects/myproject/node_modules/@myapp/unrelated2/index.d.ts`,
665+
content: `export const myappUnrelated2 = 10;`
666+
}),
667+
timeouts: sys => {
668+
sys.runQueuedTimeoutCallbacks();
669+
sys.runQueuedTimeoutCallbacks();
670+
},
671+
},
672+
{
673+
caption: "npm install ts-types",
674+
edit: sys => sys.ensureFileOrFolder({
675+
path: `/user/username/projects/myproject/node_modules/@myapp/ts-types/index.d.ts`,
676+
content: `export const myapp = 10;`
677+
}),
678+
timeouts: sys => {
679+
sys.runQueuedTimeoutCallbacks();
680+
sys.runQueuedTimeoutCallbacks();
681+
},
682+
},
683+
]
684+
});
624685
});

0 commit comments

Comments
 (0)