Skip to content

Fix: vitest ignore node_modules #16

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

Closed
wants to merge 1 commit into from

Conversation

baruchiro
Copy link
Contributor

I don't know if this project must be run with all packages together, but when I tried to run only specific package on its own folder, I needed to ignore the "node_modules" folder.

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 npm run test works fine for me from this package's directory:

joshgoldberg ~/repos/typescript-eslint-examples/packages/eslint-plugin-example-typed-linting $ npm run test

> [email protected] test
> vitest

The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.

 DEV  v2.1.8 /Users/josh/repos/typescript-eslint-examples/packages/eslint-plugin-example-typed-linting

 ✓ src/rules/no-loop-over-enum.test.ts (6) 769ms
   ✓ no-loop-over-enum (6) 769ms
     ✓ valid (5) 763ms
       ✓ enum Values {} 732ms
       ✓ for (const a in []) {}
       ✓ for (const a of []) {}
       ✓ 
      const values = {};
      for (const a in values) {}
    
       ✓ 
      const values = [];
      for (const a of values) {}
    
     ✓ invalid (1)
       ✓ 
          enum Values {}
          for (const a in Values) {}
      

 Test Files  1 passed (1)
      Tests  6 passed (6)
   Start at  10:14:46
   Duration  1.54s (transform 25ms, setup 0ms, collect 612ms, tests 769ms, environment 0ms, prepare 33ms)

 PASS  Waiting for file changes...
       press h to show help, press q to quit

What command(s) are you running, and what are the outputs?

@baruchiro
Copy link
Contributor Author

Solved by #15 🤷‍♂️

Don't know why, but running this on 494b18c reproduced the error:

examples/packages/eslint-plugin-example-typed-linting @494b18c2 
❯ npm I
added 99 packages, removed 17 packages, changed 61 packages, and audited 286 packages in 11s

examples/packages/eslint-plugin-example-typed-linting  @494b18c2                                                           12s  20.12.2   0.0.0 󰏗  17:20:46 
❯ npm run test

> [email protected] test
> vitest

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.

 DEV  v2.0.4 examples/packages/eslint-plugin-example-typed-linting

 ❯ src/rules/no-loop-over-enum.test.ts (6)
   ❯ no-loop-over-enum (6)
     ❯ valid (5)
       × enum Values {}
       × for (const a in []) {}
       × for (const a of []) {}
       × 
      const values = {};
      for (const a in values) {}
    
       × 
      const values = [];
      for (const a of values) {}
    
     ❯ invalid (1)
       × 
          enum Values {}
          for (const a in Values) {}
      

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 6 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/rules/no-loop-over-enum.test.ts > no-loop-over-enum > valid > enum Values {}
 FAIL  src/rules/no-loop-over-enum.test.ts > no-loop-over-enum > valid > for (const a in []) {}
 FAIL  src/rules/no-loop-over-enum.test.ts > no-loop-over-enum > valid > for (const a of []) {}
 FAIL  src/rules/no-loop-over-enum.test.ts > no-loop-over-enum > valid > 
      const values = {};
      for (const a in values) {}
    
 FAIL  src/rules/no-loop-over-enum.test.ts > no-loop-over-enum > valid > 
      const values = [];
      for (const a of values) {}
    
TypeError: Cannot read properties of undefined (reading 'parse')
 ❯ parse node_modules/eslint/lib/linter/linter.js:938:29
 ❯ Linter._verifyWithFlatConfigArrayAndWithoutProcessors node_modules/eslint/lib/linter/linter.js:1715:33
 ❯ Linter._verifyWithFlatConfigArray node_modules/eslint/lib/linter/linter.js:2086:21
 ❯ Linter.verify node_modules/eslint/lib/linter/linter.js:1547:61
 ❯ RuleTester.runRuleForItem node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:710:33
 ❯ RuleTester.#testValidTemplate node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:804:25
 ❯ node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:492:38

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/6]⎯

 FAIL  src/rules/no-loop-over-enum.test.ts > no-loop-over-enum > invalid > 
          enum Values {}
          for (const a in Values) {}
      
TypeError: Cannot read properties of undefined (reading 'parse')
 ❯ parse node_modules/eslint/lib/linter/linter.js:938:29
 ❯ Linter._verifyWithFlatConfigArrayAndWithoutProcessors node_modules/eslint/lib/linter/linter.js:1715:33
 ❯ Linter._verifyWithFlatConfigArray node_modules/eslint/lib/linter/linter.js:2086:21
 ❯ Linter.verify node_modules/eslint/lib/linter/linter.js:1547:61
 ❯ RuleTester.runRuleForItem node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:710:33
 ❯ RuleTester.#testInvalidTemplate node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:862:25
 ❯ node_modules/@typescript-eslint/rule-tester/src/RuleTester.ts:513:40

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/6]⎯

 Test Files  1 failed (1)
      Tests  6 failed (6)
   Start at  17:20:51
   Duration  3.07s (transform 1.06s, setup 0ms, collect 2.80s, tests 19ms, environment 0ms, prepare 53ms)


 FAIL  Tests failed. Watching for file changes...
       press h to show help, press q to quit
npm ERR! Lifecycle script `test` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: [email protected] 
npm ERR!   at location: examples/packages/eslint-plugin-example-typed-linting

With the latest commit (0366be0) it works.

@baruchiro baruchiro closed this Dec 11, 2024
@baruchiro baruchiro deleted the fix/vitest branch December 11, 2024 15:26
@JoshuaKGoldberg
Copy link
Member

🤷 glad it worked out haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants