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

Switch the project to ESM #429

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Switch the project to ESM #429

wants to merge 8 commits into from

Conversation

skovhus
Copy link
Owner

@skovhus skovhus commented Nov 17, 2022

Mostly this was done to enable upgrading a bunch of dependencies that are now ESM only.

:(

It doesn't seem like this is supported by jscodeshift though.

node ./node_modules/jscodeshift/bin/jscodeshift.js -t ./dist/transformers/ava.js src/**/*.test.ts --dry --ignore-pattern node_modules --parser babel

The above command fails with

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/kenneth/git/jest-codemods/dist/transformers/ava.js from /Users/kenneth/git/jest-codemods/node_modules/jscodeshift/src/Worker.js not supported.
Instead change the require of ava.js in /Users/kenneth/git/jest-codemods/node_modules/jscodeshift/src/Worker.js to a dynamic import() which is available in all CommonJS modules.
    at Object.newLoader [as .js] (/Users/kenneth/git/jest-codemods/node_modules/pirates/lib/index.js:141:7)
    at setup (/Users/kenneth/git/jest-codemods/node_modules/jscodeshift/src/Worker.js:91:18)
    at Object.<anonymous> (/Users/kenneth/git/jest-codemods/node_modules/jscodeshift/src/Worker.js:45:3) {
  code: 'ERR_REQUIRE_ESM'
}

@codecov
Copy link

codecov bot commented Nov 17, 2022

Codecov Report

Base: 92.39% // Head: 93.40% // Increases project coverage by +1.00% 🎉

Coverage data is based on head (5e4c497) compared to base (cbe8e25).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #429      +/-   ##
==========================================
+ Coverage   92.39%   93.40%   +1.00%     
==========================================
  Files          26       26              
  Lines        1934     1804     -130     
  Branches      404      392      -12     
==========================================
- Hits         1787     1685     -102     
+ Misses        101       94       -7     
+ Partials       46       25      -21     
Impacted Files Coverage Δ
src/cli/index.ts 0.00% <ø> (ø)
src/transformers/jasmine-this.ts 100.00% <ø> (ø)
src/transformers/mocha.ts 90.62% <ø> (-1.05%) ⬇️
src/transformers/should.ts 96.55% <ø> (-0.60%) ⬇️
src/utils/chai-chain-utils.ts 87.75% <ø> (-0.49%) ⬇️
src/utils/imports.ts 93.51% <ø> (-0.50%) ⬇️
src/utils/sinon-helpers.ts 90.00% <ø> (+1.11%) ⬆️
src/cli/transformers.ts 91.30% <100.00%> (-2.82%) ⬇️
src/transformers/ava.ts 96.55% <100.00%> (-0.26%) ⬇️
src/transformers/chai-assert.ts 99.15% <100.00%> (-0.06%) ⬇️
... and 35 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@skovhus skovhus marked this pull request as draft November 17, 2022 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant