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

fix: allow ESM preset to be used in monorepo structure #942

Merged
merged 8 commits into from
Jun 2, 2021

Conversation

lacolaco
Copy link
Contributor

@lacolaco lacolaco commented Jun 2, 2021

Summary

Because <rootDir> is not workspace-root directory when it has a monorepo structure like Nrwl/Nx, <rootDir>/node_modules is not compatible with that.

Test plan

Does this PR introduce a breaking change?

  • Yes
  • No

If the workspace is not monorepo and jest.config.js is placed at the root directory, the result is not changed. This should help issues at monorepo.

Other information

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jun 2, 2021

Can you please add an example repo to the examples folder? That will provide a test case for this change.

@lacolaco
Copy link
Contributor Author

lacolaco commented Jun 2, 2021

@ahnpnl does the example mean monorepo workspace, right? Is the name example-app-v12-monorepo ok?

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jun 2, 2021

Yes a monorepo project, that name LGTM

@@ -0,0 +1,27 @@
# ExampleAppV12Monorepo
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would you please copy the README from example-app-v12?

"@angular-devkit/build-angular": "~12.0.2",
"@angular/cli": "~12.0.2",
"@angular/compiler-cli": "~12.0.2",
"@types/jasmine": "~3.6.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This dep should be removed

"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine"
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be jest

]
},
"files": [
"src/test.ts",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be removed

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jun 2, 2021

lint needs fixing with lint:fix and snapshot needs to be updated with yarn test -u

"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "jest -c=projects/app1/jest.config.js",
"test-esm": "NODE_OPTIONS=--experimental-vm-modules jest -c=projects/app1/jest-esm.config.js"
Copy link
Collaborator

Choose a reason for hiding this comment

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

sadly Windows is not happy with NODE_OPTIONS, this option seems to work only with Linux/Mac

@lacolaco
Copy link
Contributor Author

lacolaco commented Jun 2, 2021

Thank you for your repeatedly kindly reviews.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jun 2, 2021

thanks!

@ahnpnl ahnpnl merged commit b402e28 into thymikee:master Jun 2, 2021
@lacolaco lacolaco deleted the patch-1 branch June 2, 2021 10:12
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.

2 participants