You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[test] ● Test suite failed to run
[test]
[test] TypeError: Ajv is not a constructor
[test]
[test] at Object.<anonymous>.module.exports (node_modules/@eslint/eslintrc/lib/shared/ajv.js:19:17)
Problem description: kcd-scripts adds 'shared' to moduleDirectories (I assume some projects might rely on this for absolute imports. Unfortunately, there is a file in ESLint in a directory called shared which has the same name as a package, and when it tries to import that package, the config causes it to import itself, and ESLint breaks with a runtime error because the script does not have the same API as the package. This blocked us from upgrading to Jest 27 in eslint-plugin-jest-dom (testing-library/eslint-plugin-jest-dom#185), which has tests relying on the ESLint rule tester.
Suggested solution: It seems like the most straightforward solution is to remove 'shared' from 'moduleDirectories'. However I'm concerned this could break back compatibility with projects that use a shared directory internally. Ideally we should figure out a way to configure Jest's module resolution so both ESLint imports and shared imports work, but I don't know how to do that myself, and reordering moduleDirectories doesn't seem to help either.
The text was updated successfully, but these errors were encountered:
kcd-scripts
version: 11.2.0node
version: 16.9.1npm
(oryarn
) version: 7.23.0jest
version: 27.2.0Relevant code or config
What you did:
kcd-scripts test
What happened:
Reproduction repository:
https://github.com/testing-library/eslint-plugin-jest-dom/tree/5cfb8c97ecc78fb4f61748fe083123bed7dc1f9e
Alternatively to reproduce without
kcd-scripts
, use the following Jest config:Problem description:
kcd-scripts
adds'shared'
tomoduleDirectories
(I assume some projects might rely on this for absolute imports. Unfortunately, there is a file in ESLint in a directory calledshared
which has the same name as a package, and when it tries to import that package, the config causes it to import itself, and ESLint breaks with a runtime error because the script does not have the same API as the package. This blocked us from upgrading to Jest 27 ineslint-plugin-jest-dom
(testing-library/eslint-plugin-jest-dom#185), which has tests relying on the ESLint rule tester.Suggested solution: It seems like the most straightforward solution is to remove
'shared'
from'moduleDirectories'
. However I'm concerned this could break back compatibility with projects that use ashared
directory internally. Ideally we should figure out a way to configure Jest's module resolution so both ESLint imports andshared
imports work, but I don't know how to do that myself, and reorderingmoduleDirectories
doesn't seem to help either.The text was updated successfully, but these errors were encountered: