1namespace ts.tscWatch { 2 describe("unittests:: tsc-watch:: nodeNextWatch:: emit when module emit is specified as nodenext", () => { 3 verifyTscWatch({ 4 scenario: "nodenext watch emit", 5 subScenario: "esm-mode file is edited", 6 commandLineArgs: ["--w", "--p", "/project/tsconfig.json"], 7 sys: () => { 8 const configFile: File = { 9 path: "/project/tsconfig.json", 10 content: JSON.stringify({ 11 compilerOptions: { 12 strict: true, 13 target: "es2020", 14 module: "nodenext", 15 moduleResolution: "nodenext", 16 outDir: "../dist" 17 } 18 }) 19 }; 20 const packageFile: File = { 21 path: "/project/package.json", 22 content: JSON.stringify({ 23 name: "some-proj", 24 version: "1.0.0", 25 description: "", 26 type: "module", 27 main: "index.js", 28 }) 29 }; 30 const file1: File = { 31 path: "/project/src/index.ts", 32 content: Utils.dedent` 33 import * as Thing from "thing"; 34 35 Thing.fn();` 36 }; 37 const declFile: File = { 38 path: "/project/src/deps.d.ts", 39 content: `declare module "thing";` 40 }; 41 return createWatchedSystem([configFile, file1, declFile, packageFile, { ...libFile, path: "/a/lib/lib.es2020.full.d.ts" }]); 42 }, 43 changes: [ 44 { 45 caption: "Modify typescript file", 46 change: sys => sys.modifyFile( 47 "/project/src/index.ts", 48 Utils.dedent` 49 import * as Thing from "thing"; 50 Thing.fn();`, 51 {}, 52 ), 53 timeouts: runQueuedTimeoutCallbacks, 54 } 55 ], 56 }); 57 }); 58}