Unable to build and run Ava unit test using Parcel.
The issue seems to be that a JavaScript module file will fail, but a Node.js module file will build and run.
I've included a sample test project to show this problem:
https://github.com/rajinder-yadav/ava-parcel-test
To see the error, install the NPM modules and run the test
1. npm install
1. npm test
Open file utils.js and read comment for further investigation clues.
I am unable to run all my Node.js unit test using Ava.
Make sure to read comment in code for clues.
See top!
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | "^1.10.3"
| Node | v10.11.0
| npm/Yarn | 6.4.1
| Operating System | Linux 4.15.0-38-generic
Is anyone looking at this bug? This would be really nice to have working.
Did you ever figure this out? I think I'm running into this issue now
Could someone provide a reproduction? The repo in the original post was deleted.
Yeah, which is why I'm not super certain if this is the same as my issue.
If you pull down https://github.com/daniellacosse/accounting-cli/tree/makefile-2 and run make test the tests pass but you get the following output in each of the built files:
.../dist/trello-scripts/__tests__/label-rollup.test.js:110
109: }
110:
111: // Override the current require with this new one
ReferenceError: parcelRequire is not defined
parcelRequire.rl8J (dist/trello-scripts/__tests__/label-rollup.test.js:110:17)
Object.<anonymous> (dist/trello-scripts/__tests__/label-rollup.test.js:118:2)
could be related to https://github.com/parcel-bundler/parcel/issues/1159 ?
It seems like ava executes the file as an ES module.
@devongovett, related the the ES modules discussion: #2839
Hi parcel team, globalThis may solve this issue.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.
Bumping this as jest has the same issue and it would be nice for builds to be able to run in strict mode.
Most helpful comment
Bumping this as jest has the same issue and it would be nice for builds to be able to run in strict mode.