Comments (10)
@mysticatea does it crash if you run mocha --require babel-register test.js
?
from nyc.
It does not crash.
> mocha --require babel-register test.js
[Function: Foo]
0 passing (1ms)
from nyc.
Works for me with Node 4.2.1 and 5.0 on OS X, which makes me think this is a Windows issue. Is there anything interesting in the longer stack trace? There's repetition here:
at requireHook (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\nyc\index.js:139:7)
at require.extensions.(anonymous function) (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\babel-register\lib\node.js:138:7)
at requireHook (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\nyc\index.js:139:7)
at require.extensions.(anonymous function) (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\babel-register\lib\node.js:138:7)
but then it crashes on String.split
?!
at String.split (native)
at Object.win32.resolve (path.js:174:46)
at Object.win32.relative (path.js:259:16)
at getRelativePath (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\babel-register\lib\node.js:72:28)
at shouldIgnore (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\babel-register\lib\node.js:123:12)
at require.extensions.(anonymous function) (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\babel-register\lib\node.js:137:9)
@bcoe do you have access to a Windows box to confirm this on?
from nyc.
at requireHook (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\nyc\index.js:139:7)
at require.extensions.(anonymous function) (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\babel-register\lib\node.js:138:7)
at requireHook (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\nyc\index.js:139:7)
at require.extensions.(anonymous function) (C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\babel-register\lib\node.js:138:7)
This is a stackoverflow, so there is possibility of clashing in every function call.
- https://github.com/bcoe/nyc/blob/v4.0.1/index.js#L139
- https://github.com/babel/babel/blob/v6.3.2/packages/babel-register/src/node.js#L108
Hmm, Babel seems to call the old extension here, but the old extension is nyc and nyc is calling Babel. So looks there is a potential infinity loop.
filename
is C:\Users\t-nagashima.AD\Documents\GitHub\sand\node_modules\mocha\bin\mocha
so it's ignored.
from nyc.
@mysticatea could you give the current master
branch a shot, there have been some changes to the require-hook that I think might fix the infinite you're seeing.
Disclaimer, I have yet to get subprocess spawning fully functional in Windows.
from nyc.
Ok, I will try it later.
from nyc.
@mysticatea I tested the master branch of nyc
on Windows, and it worked great with a couple changes:
test.js
is ignored by default, so you should change the filename to something likefoo.js
.nyc
currently has trouble capturing exit events in windows, so rather than runningmocha
I ran the_mocha
bin (which does not spawn a subprocess).
nyc --require babel-register node_modules/.bin/_mocha test.js
- by default the babel register hook will be called for each module in the
node_modules
folder, you should probably configure babel to ignore this folder.
from nyc.
Thank you for the verification and the information!
I also verified that master
branch works.
I'm looking forward to the next release. :)
from nyc.
@mysticatea I've released [email protected]
with these fixes for Windows, I've also patched Windows so that it works without needing to reference _mocha
:
Your original node_modules/.bin/mocha
should work now.
from nyc.
Thank you so much!
from nyc.
Related Issues (20)
- Jest and Cypress's coverage merged results is wrong
- nyc should use nodejs module customization hooks rather than monkey patching
- Node v20: TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type number. Received type string ('128SIGINT') HOT 5
- Is there any way to extract/remove Babel from NYC?
- How to use nyc with TypeScript and ESM? HOT 1
- fix: merging two coverage reports for same source file causes crash HOT 1
- NYC checkCoverage doesn't have a way to throw error when insufficient coverage met
- nyc test coverage on branches is not accurate - Seems to be happening with nyc@v15, [email protected] and [email protected] HOT 6
- Code coverage is not instrumenting React components (React Native)
- Code rewriting breaks function name inferencing HOT 1
- nyc not working with project type module (esm) HOT 1
- nyc ignores files ending with `-test.ts`
- Unable to get coverage for files executed via runInThisContext HOT 1
- Markdown reporter HOT 1
- Is there a way to filter files in the stage `nyc report` ?
- Merging with nyc storybook test coverage with other reports generated by coverageProvider 'istanbul' result in wrong coverage HOT 2
- Issue with Instrumentation of Code Coverage for my Angular V17 Project
- is it possible to store nyc output with relative path?
- cccccbgvrekrbvdtukvnhiffetjntbbuuijkfblietjr
- Use of deprecated glob and rimraf dependencies
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nyc.