mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
merged with master
This commit is contained in:
@@ -2488,6 +2488,17 @@ module FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
// @Filename is the only directive that can be used in a test that contains tsconfig.json file.
|
||||
if (containTSConfigJson(files)) {
|
||||
let directive = getNonFileNameOptionInFileList(files);
|
||||
if (!directive) {
|
||||
directive = getNonFileNameOptionInObject(globalOptions);
|
||||
}
|
||||
if (directive) {
|
||||
throw Error("It is not allowed to use tsconfig.json along with directive '" + directive + "'");
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
markerPositions,
|
||||
markers,
|
||||
@@ -2497,6 +2508,23 @@ module FourSlash {
|
||||
};
|
||||
}
|
||||
|
||||
function containTSConfigJson(files: FourSlashFile[]): boolean {
|
||||
return ts.forEach(files, f => f.fileOptions['Filename'] === 'tsconfig.json');
|
||||
}
|
||||
|
||||
function getNonFileNameOptionInFileList(files: FourSlashFile[]): string {
|
||||
return ts.forEach(files, f => getNonFileNameOptionInObject(f.fileOptions));
|
||||
}
|
||||
|
||||
function getNonFileNameOptionInObject(optionObject: { [s: string]: string }): string {
|
||||
for (let option in optionObject) {
|
||||
if (option !== metadataOptionNames.fileName) {
|
||||
return option;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const enum State {
|
||||
none,
|
||||
inSlashStarMarker,
|
||||
|
||||
@@ -493,7 +493,7 @@ module Harness {
|
||||
export let readFile: typeof IO.readFile = ts.sys.readFile;
|
||||
export let writeFile: typeof IO.writeFile = ts.sys.writeFile;
|
||||
export let fileExists: typeof IO.fileExists = fs.existsSync;
|
||||
export let log: typeof IO.log = console.log;
|
||||
export let log: typeof IO.log = s => console.log(s);
|
||||
|
||||
export function createDirectory(path: string) {
|
||||
if (!directoryExists(path)) {
|
||||
@@ -673,7 +673,7 @@ module Harness {
|
||||
};
|
||||
export let listFiles = Utils.memoize(_listFilesImpl);
|
||||
|
||||
export let log = console.log;
|
||||
export let log = (s: string) => console.log(s);
|
||||
|
||||
export function readFile(file: string) {
|
||||
let response = Http.getFileFromServerSync(serverRoot + file);
|
||||
@@ -1451,7 +1451,7 @@ module Harness {
|
||||
}
|
||||
|
||||
export function isJSMap(fileName: string) {
|
||||
return stringEndsWith(fileName, '.js.map');
|
||||
return stringEndsWith(fileName, '.js.map') || stringEndsWith(fileName, '.jsx.map');
|
||||
}
|
||||
|
||||
/** Contains the code and errors of a compilation and some helper methods to check its status. */
|
||||
|
||||
Reference in New Issue
Block a user