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
I'm maintaining a package that contains import statements in its Rollup outputs which are transpiled via Webpack in applications using the package. In the Jest tests of another package, I am importing things from this package:
// package-b/some-test.s
import {something} from 'package-a';
This works soon as I configure Jest to also Babel transpile package-a as proposes in this Jest issue
When running eslint I'm seeing the following error, though:
Error: jestConfigFile not found in /path/to/package-b/node_modules/package-a/jest.config.js
It looks like the Jest resolver is also applied to imports found in node module dependencies. Scoping the importer to tests as suggested in the README additions of #38 also does not change anything since the linted file determines resolvers - not the file currently parsed for import statements. #32 addresses the same issue, but makes it fail silently even if the Jest config in the root project cannot be found.
The workaround that I found is to reference the Jest config with an absolute path in eslintrc.js:
I would have expected a relative jestConfigFile path to always be resolved relative to the .eslintrc.js file, not the package root of the file currently parsed for imports.
I'm mainly leaving this here as future reference for others.
The text was updated successfully, but these errors were encountered:
I'm maintaining a package that contains
import
statements in its Rollup outputs which are transpiled via Webpack in applications using the package. In the Jest tests of another package, I am importing things from this package:This works soon as I configure Jest to also Babel transpile
package-a
as proposes in this Jest issueWhen running
eslint
I'm seeing the following error, though:It looks like the Jest resolver is also applied to imports found in node module dependencies. Scoping the importer to tests as suggested in the README additions of #38 also does not change anything since the linted file determines resolvers - not the file currently parsed for import statements. #32 addresses the same issue, but makes it fail silently even if the Jest config in the root project cannot be found.
The workaround that I found is to reference the Jest config with an absolute path in
eslintrc.js
:I would have expected a relative
jestConfigFile
path to always be resolved relative to the.eslintrc.js
file, not the package root of the file currently parsed for imports.I'm mainly leaving this here as future reference for others.
The text was updated successfully, but these errors were encountered: