Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repo: rule-tester's eslint-base test failing on main #9011

Open
auvred opened this issue Apr 27, 2024 · 0 comments
Open

Repo: rule-tester's eslint-base test failing on main #9011

auvred opened this issue Apr 27, 2024 · 0 comments
Labels
accepting prs Go ahead, send a pull request that resolves this issue repo maintenance things to do with maintenance of the repo, and not with code/docs

Comments

@auvred
Copy link
Member

auvred commented Apr 27, 2024

Suggestion

Coming here from #8995 (comment)

Note: the rule-tester package is not currently being tested in CI (see #9005)

Running cd packages/rule-tester; yarn run test-eslint-base produces the following errors:


  RuleTester
    1) "before each" hook for "should not throw an error when everything passes"


  0 passing (15ms)
  1 failing

  1) RuleTester
       "before each" hook for "should not throw an error when everything passes":
     Error: Missing definition for `afterAll` - you must set one using `RuleTester.afterAll` or there must be one defined globally as `afterAll`.
      at Function.get afterAll [as afterAll] (src/TestFramework.ts:66:11)
      at new RuleTester (src/RuleTester.ts:102:17)
      at Context.<anonymous> (tests/eslint-base/eslint-base.test.js:110:22)
      at processImmediate (node:internal/timers:478:21)
  112 passing (327ms)
  1 pending
  24 failing

...

  2) RuleTester
       should throw an error when the error message regex does not match:
     AssertionError: expected [Function] to throw error matching /Expected 'Bad var.'…/Bad error message\ but got 'sourceCode is not defined\nOccurred w…'
      at Context.<anonymous> (tests/eslint-base/eslint-base.test.js:444:16)
      at processImmediate (node:internal/timers:478:21)

...

  24) RuleTester
       naming test cases
         should use the test code as the name if the "name" property is set to an empty string:
     ReferenceError: sourceCode is not defined
Occurred while linting file.ts:1
Rule: "foo"
      at VariableDeclaration (tests/eslint-base/fixtures/no-var.js:16:30)

...


The fix for this issue should go hand-in-hand with #9005 and #8969

Ideally (I guess) we should sync tests/eslint-base/eslint-base.test.js and tests/eslint-base/fixtures/* with upstream, because tests/eslint-base/**/* was intentionally copied from ESLint repo without any changes to verify that forked RuleTester is still compatible with ESLint's RuleTester.

The following changes were made to RuleTester's tests since #6777:
https://github.com/eslint/eslint/commits/main/tests/lib/rule-tester/rule-tester.js?since=2023-04-27&until=2024-04-27

The following changes were made to RuleTester's tests fixtures since #6777:
https://github.com/eslint/eslint/commits/main/tests/fixtures/testers/rule-tester?since=2023-04-27&until=2024-04-27


Btw, fun fact: today is the one year anniversary of the PR (#6777) that added RuleTester to this repo 🎉🎉🎉

@auvred auvred added triage Waiting for maintainers to take a look repo maintenance things to do with maintenance of the repo, and not with code/docs labels Apr 27, 2024
@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting prs Go ahead, send a pull request that resolves this issue repo maintenance things to do with maintenance of the repo, and not with code/docs
Projects
None yet
Development

No branches or pull requests

2 participants