Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas committed Dec 14, 2023
1 parent 78ba2f5 commit bfcd4e6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion tests/lib/linter/code-path-analysis/code-path-analyzer.js
Expand Up @@ -31,7 +31,7 @@ const STANDARD_ESQUERY_OPTION = { visitorKeys: vk.KEYS, fallback: Traverser.getK

const expectedPattern = /\/\*expected\s+((?:.|[\r\n])+?)\s*\*\//gu;
const lineEndingPattern = /\r?\n/gu;
const linter = new Linter();
const linter = new Linter({ configType: "eslintrc" });

/**
* Extracts the content of `/*expected` comments from a given source code.
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/linter/code-path-analysis/code-path.js
Expand Up @@ -11,7 +11,7 @@

const assert = require("assert"),
{ Linter } = require("../../../../lib/linter");
const linter = new Linter();
const linter = new Linter({ configType: "eslintrc" });

//------------------------------------------------------------------------------
// Helpers
Expand Down
27 changes: 8 additions & 19 deletions tests/lib/linter/rules.js
Expand Up @@ -58,30 +58,19 @@ describe("rules", () => {

const linter = new Linter();

const problems = linter.verify("foo", { rules: { "test-rule": "error" } });

assert.lengthOf(problems, 1);
assert.strictEqual(problems[0].message, "Definition for rule 'test-rule' was not found.");
assert.strictEqual(problems[0].line, 1);
assert.strictEqual(problems[0].column, 1);
assert.strictEqual(problems[0].endLine, 1);
assert.strictEqual(problems[0].endColumn, 2);
assert.throws(() => {
linter.verify("foo", { rules: { "test-rule": "error" } });
}, TypeError, "Could not find \"test-rule\" in plugin \"@\".");

});


it("should report a linting error that lists replacements if a rule is known to have been replaced", () => {
const linter = new Linter();
const problems = linter.verify("foo", { rules: { "no-arrow-condition": "error" } });

assert.lengthOf(problems, 1);
assert.strictEqual(
problems[0].message,
"Rule 'no-arrow-condition' was removed and replaced by: no-confusing-arrow, no-constant-condition"
);
assert.strictEqual(problems[0].line, 1);
assert.strictEqual(problems[0].column, 1);
assert.strictEqual(problems[0].endLine, 1);
assert.strictEqual(problems[0].endColumn, 2);

assert.throws(() => {
linter.verify("foo", { rules: { "no-arrow-condition": "error" } });
}, TypeError, "Key \"rules\": Key \"no-arrow-condition\": Rule \"no-arrow-condition\" was removed and replaced by \"no-confusing-arrow,no-constant-condition\".");
});
});

Expand Down
2 changes: 1 addition & 1 deletion tests/lib/rules/utils/ast-utils.js
Expand Up @@ -27,7 +27,7 @@ const ESPREE_CONFIG = {
range: true,
loc: true
};
const linter = new Linter();
const linter = new Linter({ configType: "eslintrc" });

describe("ast-utils", () => {
let callCounts;
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/shared/config-validator.js
Expand Up @@ -30,7 +30,7 @@ const assert = require("chai").assert,
// Helpers
//------------------------------------------------------------------------------

const linter = new Linter();
const linter = new Linter({ configType: "eslintrc" });

const mockRule = {
meta: {
Expand Down

0 comments on commit bfcd4e6

Please sign in to comment.