diff --git a/tests/cases/fourslash/moveToNewFile_importFileExtensionsNonTypeModule.ts b/tests/cases/fourslash/moveToNewFile_importFileExtensionsNonTypeModule.ts new file mode 100644 index 0000000000000..a6ea5f8562e7f --- /dev/null +++ b/tests/cases/fourslash/moveToNewFile_importFileExtensionsNonTypeModule.ts @@ -0,0 +1,67 @@ +/// + +// @Filename: /tsconfig.json +////{ +//// "compilerOptions": { +//// "moduleResolution": "Node16", +//// } +////} + +// @Filename: /src/main.ts +////[|export function someLibFn(): string { +//// return main(); +////}|] +//// +////function main(): string { +//// return "hello world!"; +////} +////console.log(someLibFn()); + +// @Filename: /other.ts +////import { someLibFn } from "./src/main"; +//// +////function someOtherFn(): string { +//// return someLibFn(); +////} + +// @Filename: /act/action.ts +////import { someLibFn } from "../src/main"; +//// +////function doAction(): string { +//// return someLibFn(); +////} + + +verify.moveToNewFile({ + newFileContents: { + "/src/main.ts": +`import { someLibFn } from "./someLibFn"; + +export function main(): string { + return "hello world!"; +} +console.log(someLibFn());`, + + "/src/someLibFn.ts": +`import { main } from "./main"; + +export function someLibFn(): string { + return main(); +} +`, + + "/other.ts": +`import { someLibFn } from "./src/someLibFn"; + +function someOtherFn(): string { + return someLibFn(); +}`, + + "/act/action.ts": +`import { someLibFn } from "../src/someLibFn"; + +function doAction(): string { + return someLibFn(); +}`, + } +}); \ No newline at end of file diff --git a/tests/cases/fourslash/moveToNewFile_importFileExtensionsNonTypeModuleExistingJsImport.ts b/tests/cases/fourslash/moveToNewFile_importFileExtensionsNonTypeModuleExistingJsImport.ts new file mode 100644 index 0000000000000..6c43a02feef01 --- /dev/null +++ b/tests/cases/fourslash/moveToNewFile_importFileExtensionsNonTypeModuleExistingJsImport.ts @@ -0,0 +1,67 @@ +/// + +// @Filename: /src/main.ts +////import { message } from "./message.js"; +//// +////[|export function someLibFn(): string { +//// return main(); +////}|] +//// +////function main(): string { +//// return message; +////} +////console.log(someLibFn()); + +// @Filename: /message.ts +////export const message = "hello world"; + +// @Filename: /other.ts +////import { someLibFn } from "./src/main.js"; +//// +////function someOtherFn(): string { +//// return someLibFn(); +////} + +// @Filename: /act/action.ts +////import { someLibFn } from "../src/main.js"; +//// +////function doAction(): string { +//// return someLibFn(); +////} + + +verify.moveToNewFile({ + newFileContents: { + "/src/main.ts": +`import { message } from "./message.js"; +import { someLibFn } from "./someLibFn.js"; + +export function main(): string { + return message; +} +console.log(someLibFn());`, + + "/src/someLibFn.ts": +`import { main } from "./main.js"; + + +export function someLibFn(): string { + return main(); +} +`, + + "/other.ts": +`import { someLibFn } from "./src/someLibFn.js"; + +function someOtherFn(): string { + return someLibFn(); +}`, + + "/act/action.ts": +`import { someLibFn } from "../src/someLibFn.js"; + +function doAction(): string { + return someLibFn(); +}`, + } +}); \ No newline at end of file diff --git a/tests/cases/fourslash/moveToNewFile_importFileExtensions.ts b/tests/cases/fourslash/moveToNewFile_importFileExtensionsTypeModule.ts similarity index 100% rename from tests/cases/fourslash/moveToNewFile_importFileExtensions.ts rename to tests/cases/fourslash/moveToNewFile_importFileExtensionsTypeModule.ts