TypeScript/tests/cases/fourslash/getEditsForFileRename_preservePathEnding.ts
Andy b94061c587
getEditsForFileRename: Avoid changing import specifier ending (#26177)
* getEditsForFileRename: Avoid changing import specifier ending

* Support .json and .jsx extensions

* Restore typeRoots tests

* Fix json test

* When --jsx preserve is set, import ".tsx" file with ".jsx" extension

* Support ending preference in UserPreferences
2018-08-28 13:03:24 -07:00

45 lines
935 B
TypeScript

/// <reference path='fourslash.ts' />
// @allowJs: true
// @checkJs: true
// @strict: true
// @jsx: preserve
// @resolveJsonModule: true
// @Filename: /index.js
////export const x = 0;
// @Filename: /jsx.jsx
////export const y = 0;
// @Filename: /j.jonah.json
////{ "j": 0 }
// @Filename: /a.js
////import { x as x0 } from ".";
////import { x as x1 } from "./index";
////import { x as x2 } from "./index.js";
////import { y } from "./jsx.jsx";
////import { j } from "./j.jonah.json";
verify.noErrors();
verify.getEditsForFileRename({
oldPath: "/a.js",
newPath: "/b.js",
newFileContents: {}, // No change
});
verify.getEditsForFileRename({
oldPath: "/b.js",
newPath: "/src/b.js",
newFileContents: {
"/b.js":
`import { x as x0 } from "..";
import { x as x1 } from "../index";
import { x as x2 } from "../index.js";
import { y } from "../jsx.jsx";
import { j } from "../j.jonah.json";`,
},
});