Skip to content

Commit 397c06e

Browse files
committed
Fix tests
1 parent 4e4f918 commit 397c06e

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

tests/lib/eslint/eslint.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,20 +1389,23 @@ describe("ESLint", () => {
13891389
);
13901390
});
13911391

1392-
it("should fail to load a CommonJS TS config file that exports undefined with a helpful error message", async () => {
1392+
it("should fail to load a CommonJS TS config file that exports undefined with a helpful warning message", async () => {
1393+
1394+
sinon.restore();
13931395

13941396
const cwd = getFixturePath("ts-config-files", "ts");
1397+
const processStub = sinon.stub(process, "emitWarning");
13951398

13961399
eslint = new ESLint({
13971400
cwd,
13981401
flags,
13991402
overrideConfigFile: "eslint.undefined.config.ts"
14001403
});
14011404

1402-
await assert.rejects(
1403-
eslint.lintText("foo"),
1404-
{ message: "Config (unnamed): Unexpected undefined config at user-defined index 0." }
1405-
);
1405+
await eslint.lintText("foo");
1406+
1407+
assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once");
1408+
assert.strictEqual(processStub.getCall(0).args[1], "ESLintEmptyConfigWarning");
14061409

14071410
});
14081411

@@ -5975,20 +5978,24 @@ describe("ESLint", () => {
59755978
);
59765979
});
59775980

5978-
it("should fail to load a CommonJS TS config file that exports undefined with a helpful error message", async () => {
5981+
it("should fail to load a CommonJS TS config file that exports undefined with a helpful warning message", async () => {
5982+
5983+
sinon.restore();
59795984

59805985
const cwd = getFixturePath("ts-config-files", "ts");
5986+
const processStub = sinon.stub(process, "emitWarning");
59815987

59825988
eslint = new ESLint({
59835989
cwd,
59845990
flags,
59855991
overrideConfigFile: "eslint.undefined.config.ts"
59865992
});
59875993

5988-
await assert.rejects(
5989-
eslint.lintFiles("foo.js"),
5990-
{ message: "Config (unnamed): Unexpected undefined config at user-defined index 0." }
5991-
);
5994+
await eslint.lintFiles("foo.js");
5995+
5996+
assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once");
5997+
assert.strictEqual(processStub.getCall(0).args[1], "ESLintEmptyConfigWarning");
5998+
59925999

59936000
});
59946001

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy