Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

--test: allow target other than default #3296

Merged
merged 1 commit into from Oct 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/test.ts
Expand Up @@ -119,14 +119,14 @@ export function runTest(testDirectory: string, rulesDirectory?: string | string[
getDefaultLibFileName: () => ts.getDefaultLibFileName(compilerOptions),
getDirectories: (dir) => fs.readdirSync(dir),
getNewLine: () => "\n",
getSourceFile(filenameToGet) {
const target = compilerOptions.target === undefined ? ts.ScriptTarget.ES5 : compilerOptions.target;
if (filenameToGet === ts.getDefaultLibFileName(compilerOptions)) {
const fileContent = fs.readFileSync(ts.getDefaultLibFilePath(compilerOptions), "utf8");
return ts.createSourceFile(filenameToGet, fileContent, target);
} else if (denormalizeWinPath(filenameToGet) === fileCompileName) {
getSourceFile(filenameToGet, target) {
if (denormalizeWinPath(filenameToGet) === fileCompileName) {
return ts.createSourceFile(filenameToGet, fileTextWithoutMarkup, target, true);
}
if (path.basename(filenameToGet) === filenameToGet) {
// resolve path of lib.xxx.d.ts
filenameToGet = path.join(path.dirname(ts.getDefaultLibFilePath(compilerOptions)), filenameToGet);
}
const text = fs.readFileSync(filenameToGet, "utf8");
return ts.createSourceFile(filenameToGet, text, target, true);
},
Expand Down
2 changes: 0 additions & 2 deletions src/verify/lintError.ts
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

import { Error } from "../error";

export interface PositionInFile {
line: number;
col: number;
Expand Down