Skip to content

Commit 6971182

Browse files
authored
Merge pull request #31505 from microsoft/fileNotFound
Switch to using File not found message instead of trace message file does not exit
2 parents 3745694 + 43c7eb7 commit 6971182

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/compiler/commandLineParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,7 +2361,7 @@ namespace ts {
23612361
if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, Extension.Json)) {
23622362
extendedConfigPath = `${extendedConfigPath}.json`;
23632363
if (!host.fileExists(extendedConfigPath)) {
2364-
errors.push(createDiagnostic(Diagnostics.File_0_does_not_exist, extendedConfig));
2364+
errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig));
23652365
return undefined;
23662366
}
23672367
}
@@ -2372,7 +2372,7 @@ namespace ts {
23722372
if (resolved.resolvedModule) {
23732373
return resolved.resolvedModule.resolvedFileName;
23742374
}
2375-
errors.push(createDiagnostic(Diagnostics.File_0_does_not_exist, extendedConfig));
2375+
errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig));
23762376
return undefined;
23772377
}
23782378

src/testRunner/unittests/config/configurationExtension.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ namespace ts {
197197
const caseSensitiveBasePath = "/dev/";
198198
const caseSensitiveHost = new fakes.ParseConfigHost(createFileSystem(/*ignoreCase*/ false, caseSensitiveBasePath, "/"));
199199

200-
function verifyDiagnostics(actual: Diagnostic[], expected: {code: number, category: DiagnosticCategory, messageText: string}[]) {
200+
function verifyDiagnostics(actual: Diagnostic[], expected: { code: number; messageText: string; }[]) {
201201
assert.isTrue(expected.length === actual.length, `Expected error: ${JSON.stringify(expected)}. Actual error: ${JSON.stringify(actual)}.`);
202202
for (let i = 0; i < actual.length; i++) {
203203
const actualError = actual[i];
204204
const expectedError = expected[i];
205205
assert.equal(actualError.code, expectedError.code, "Error code mismatch");
206-
assert.equal(actualError.category, expectedError.category, "Category mismatch");
206+
assert.equal(actualError.category, DiagnosticCategory.Error, "Category mismatch"); // Should always be error
207207
assert.equal(flattenDiagnosticMessageText(actualError.messageText, "\n"), expectedError.messageText);
208208
}
209209
}
@@ -246,7 +246,7 @@ namespace ts {
246246
});
247247
}
248248

249-
function testFailure(name: string, entry: string, expectedDiagnostics: { code: number, category: DiagnosticCategory, messageText: string }[]) {
249+
function testFailure(name: string, entry: string, expectedDiagnostics: { code: number; messageText: string; }[]) {
250250
it(name, () => {
251251
const parsed = getParseCommandLine(entry);
252252
verifyDiagnostics(parsed.errors, expectedDiagnostics);
@@ -280,26 +280,22 @@ namespace ts {
280280
testFailure("can report errors on circular imports", "circular.json", [
281281
{
282282
code: 18000,
283-
category: DiagnosticCategory.Error,
284283
messageText: `Circularity detected while resolving configuration: ${[combinePaths(basePath, "circular.json"), combinePaths(basePath, "circular2.json"), combinePaths(basePath, "circular.json")].join(" -> ")}`
285284
}
286285
]);
287286

288287
testFailure("can report missing configurations", "missing.json", [{
289-
code: 6096,
290-
category: DiagnosticCategory.Message,
291-
messageText: `File './missing2' does not exist.`
288+
code: 6053,
289+
messageText: `File './missing2' not found.`
292290
}]);
293291

294292
testFailure("can report errors in extended configs", "failure.json", [{
295293
code: 6114,
296-
category: DiagnosticCategory.Error,
297294
messageText: `Unknown option 'excludes'. Did you mean 'exclude'?`
298295
}]);
299296

300297
testFailure("can error when 'extends' is not a string", "extends.json", [{
301298
code: 5024,
302-
category: DiagnosticCategory.Error,
303299
messageText: `Compiler option 'extends' requires a value of type string.`
304300
}]);
305301

0 commit comments

Comments
 (0)