Closed David-Desmaisons closed 2 years ago
I just made a test with the --require option and it seems that it is not calling the importOrRequire
function:
Is it correct or I am missing something?
Sorry, you’re right; i meant --import=packageName
Also, on what node version are you seeing this issue? And what exact tape command are you running?
Merging #559 (9179395) into master (5a5a574) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #559 +/- ##
=======================================
Coverage 96.49% 96.49%
=======================================
Files 4 4
Lines 627 627
Branches 145 145
=======================================
Hits 605 605
Misses 22 22
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 5a5a574...9179395. Read the comment docs.
Here is a minimal repo for reproduction using tape **/*.spec.js
command:
https://github.com/David-Desmaisons/tape-tests
I am testing with node 12.
You can’t pass unquoted globs to tools tho - your shell will expand them. Try putting quotes around the glob.
If that doesn’t fix it, I’ll take a look at your repro repo shortly.
I changed to:
"scripts": {
"test": "tape \"**/*.spec.js\""
},
With the same results: it works on ubuntu but breaks on windows.
interesting, ok. it's also notable you're not using --import
or --require
, which means this line of code shouldn't be executed. I don't have Windows to be able to test, unfortunately.
Indeed, your repo passes fine on my Mac.
The path are constructed line 59 of tape.js file
It is then used using the import sintax but as on windows it is a windows path it is not compatible with an url:
Adding "file:\\" before the path resolve the windows case without breaking linux build.
@David-Desmaisons thank you so much for bringing the problem to my attention; I'm going to go with the solution in #571, and longer term, we'll look into running CI tests on windows to prevent this kind of problem in the future.
When using tape on windows in a esm module (using
"type": "module"
in the project package.json), this exception is raised:In turns out that making explicit the file protocol in the importOrRequire resolves this problem.