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

Add option to load .cjs config file #83

Merged
merged 8 commits into from
Jun 1, 2022

Conversation

revmischa
Copy link
Contributor

Ref: #73 (comment)

Since it's too much work to change the setup step to be async to do a dynamic import(), we can just specify our config to be CJS and not try to import ESM config in an ESM project.

@freshollie
Copy link
Owner

freshollie commented May 27, 2022

Nice. Thanks for this!

If you feel like it, would be good to add a integration test for this:

  • Make a new config under the tests directory
  • Use an advanced setup to point the test towards a new config directory where you.cjs config is located

@freshollie freshollie self-requested a review May 27, 2022 09:17
@revmischa
Copy link
Contributor Author

Ok I added a test
BTW I'm trying out this module using vitest and it works pretty fine. Maybe it should just be renamed to "test-dynalite" since it's not really jest-specific.

@freshollie
Copy link
Owner

Maybe it should just be renamed to "test-dynalite" since it's not really jest-specific

hmm, main reason is because it's designed specifically for jest. I wonder if there could be entry points just for jest: test-dynalite/jest 🤔

@@ -0,0 +1,32 @@
module.exports = [
Copy link
Owner

Choose a reason for hiding this comment

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

You should probably name this .cjs to actually test the CJS feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok
I don't really understand how the tests are being run
Eslint is yelling at me:

Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: tests/configs/cjs/jest-dynalite-config.cjs.
The file must be included in at least one of the projects provided.

I couldn't find what to change to make it happy

Copy link
Owner

Choose a reason for hiding this comment

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

You need to add "*.cjs" to the tsconfig.esllint.json at the root of the repo. Atm I think it only includes .js and .ts

Copy link
Owner

Choose a reason for hiding this comment

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

I don't really understand how the tests are being run
If you run yarn test you will see, they are effectively integration tests which ensure dynalite functions with an actual jest setup rather than unit.

The idea here is we want to ensure that .cjs configs do actually work and don't regress

tsconfig.json Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jun 1, 2022

Pull Request Test Coverage Report for Build 2416645686

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 88.667%

Totals Coverage Status
Change from base Build 2240650438: 0.04%
Covered Lines: 196
Relevant Lines: 210

💛 - Coveralls

@freshollie freshollie merged commit dc2a2b3 into freshollie:master Jun 1, 2022
@freshollie
Copy link
Owner

freshollie commented Jun 1, 2022

Thanks!

@revmischa
Copy link
Contributor Author

Thank you! Any chance you could do a release please? 🙏🏻

@freshollie
Copy link
Owner

Apologies, pushed this as v3.6.0 now should go live soon

@revmischa
Copy link
Contributor Author

Thanks a lot!

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

3 participants