Skip to content

Repo: 'Export assignment cannot be used' log errors in Jest tests #10146

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
JoshuaKGoldberg opened this issue Oct 14, 2024 · 2 comments · Fixed by #10151
Closed

Repo: 'Export assignment cannot be used' log errors in Jest tests #10146

JoshuaKGoldberg opened this issue Oct 14, 2024 · 2 comments · Fixed by #10151
Labels
accepting prs Go ahead, send a pull request that resolves this issue locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. repo maintenance things to do with maintenance of the repo, and not with code/docs tests anything to do with testing

Comments

@JoshuaKGoldberg
Copy link
Member

Suggestion

These aren't failing CI, but are coming up as logs locally when I run yarn test within a package:

cd packages/eslint-plugin
yarn test consistent-type-exports

... (all passing)

Running coverage on untested files...Failed to collect coverage from /Users/josh/repos/typescript-eslint/packages/eslint-plugin/src/rules/index.ts
ERROR:   x Export assignment cannot be used when targeting ECMAScript modules. Consider using `export default` or another module format instead.
     ,-[/Users/josh/repos/typescript-eslint/packages/eslint-plugin/src/rules/index.ts:262:1]
 259 |   'use-unknown-in-catch-callback-variable': useUnknownInCatchCallbackVariable,
 260 | } satisfies Linter.PluginRules;
 261 | 
 262 | export = rules;
     : ^^^^^^^^^^^^^^^
     `----

STACK: Error:   x Export assignment cannot be used when targeting ECMAScript modules. Consider using `export default` or another module format instead.
     ,-[/Users/josh/repos/typescript-eslint/packages/eslint-plugin/src/rules/index.ts:262:1]
 259 |   'use-unknown-in-catch-callback-variable': useUnknownInCatchCallbackVariable,
 260 | } satisfies Linter.PluginRules;
 261 | 
 262 | export = rules;
     : ^^^^^^^^^^^^^^^
     `----

Test Suites: 1 passed, 1 total
Tests:       41 passed, 41 total
Snapshots:   0 total
Time:        3.155 s
Ran all test suites matching /consistent-type-exports/i.

Additional Info

Presumably caused by #10049. Cc @aryaemami59 - I'm sure it's some misconfiguration in our Jest setup.

Tangentially related: #7112 would be lovely to get around all the Jest issues we've had...

💖

@JoshuaKGoldberg JoshuaKGoldberg added triage Waiting for team members to take a look repo maintenance things to do with maintenance of the repo, and not with code/docs labels Oct 14, 2024
@aryaemami59
Copy link
Contributor

Thanks for letting me know, I'll take a look.

@JoshuaKGoldberg JoshuaKGoldberg added tests anything to do with testing accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for team members to take a look labels Oct 15, 2024
@aryaemami59
Copy link
Contributor

@JoshuaKGoldberg Looks like originally We used coveragePathIgnorePatterns here to avoid this particular issue, but We can actually use modulePathIgnorePatterns instead to fix it, should I put up a PR?

@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Oct 26, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. repo maintenance things to do with maintenance of the repo, and not with code/docs tests anything to do with testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants