Skip to content

feat(config): add -c, --config option #12

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

Merged
merged 8 commits into from
Jan 18, 2023
Merged

feat(config): add -c, --config option #12

merged 8 commits into from
Jan 18, 2023

Conversation

PeterYinusa
Copy link
Contributor

@PeterYinusa PeterYinusa commented Nov 2, 2022

Provide a custom jest config path

#4 (comment) For the custom config path, we could offer the same -c, --config option that Jest CLI uses.

@rbardini rbardini linked an issue Jan 16, 2023 that may be closed by this pull request
@rbardini rbardini added the enhancement New feature or request label Jan 16, 2023
Copy link
Owner

@rbardini rbardini left a comment

Choose a reason for hiding this comment

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

Thanks, @PeterYinusa! Sorry for the delayed review, added a couple small suggestions.

This should also resolve #11 💖

@PeterYinusa
Copy link
Contributor Author

Thanks, @PeterYinusa! Sorry for the delayed review, added a couple small suggestions.

This should also resolve #11 💖

Thanks for taking the time out to review the code, I've made the suggested changes

@rbardini rbardini merged commit b69f172 into rbardini:master Jan 18, 2023
@github-actions
Copy link

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

rekmarks added a commit to MetaMask/create-release-branch that referenced this pull request Dec 4, 2023
Converts this package to an ESM module. Kudos to [this guide](https://tsmx.net/convert-existing-nodejs-project-from-commonjs-to-esm/) and this issue: TypeStrong/ts-node#1997

In our organization, this is only possible for this package because it is not used anywhere else, and we rely on CommonJS extensively.

Changes in detail:
- Update `package.json` for ESM compatibility
- Replace all `require()` with `import` statements
- Add `.js` file extension to all file imports in TypeScript source files
- Update TypeScript, ESLint, and Jest configs for ESM compatibility and recommended best practices
  - TypeScript (`tsconfig.json`)
    - Update the `module`/`moduleResolution` fields to `Node16`.
    - I chose `Node16` over `NodeNext`, as the behavior of `NodeNext` may change in the future. See [here](https://www.typescriptlang.org/docs/handbook/modules/reference.html#node16-nodenext) for details.
  - ESLint (`.eslintrc.cjs`)
    - `parseOptions.sourceType = 'module'`
  - Jest (`jest.config.cjs`)
    - Update the `moduleNameMapper` to strip the `.js` from local file imports. See [here](https://kulshekhar.github.io/ts-jest/docs/guides/esm-support/) for details.
- Replace `ts-node` with `tsx`, which has better ESM compatibility.
  - Specifically, the former does not work with Node v20 at the moment: TypeStrong/ts-node#1997
- Update `jest-it-up`
  - This is so that we can use its `--config` option (thank you @PeterYinusa! rbardini/jest-it-up#12)  to target our new `.cjs` config file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to specify jest config
2 participants