Comments (13)
Is there anyway to work this around? I had the issue above a long time running, I thought to maybe implement a function identical to idx locally rather using the babel plugin.
from idx.
Interesting! I wonder if a coverage plugin is injecting extra AST nodes into the arrow function.
Thanks for that insight. I'll need to brainstorm with @cpojer about how to best proceed.
from idx.
@davscro What version of babel-plugin-idx
are you using? This should have been fixed by 2b4c33c.
from idx.
hi @yungsters ,
"name": "babel-plugin-idx",
"version": "1.5.1",
"name": "idx",
"version": "1.5.0"
When I run tests directly from Webstorm everything is OK
But from console with yarn test
i got an error:
Here is the test step: "test": "rimraf results && rimraf coverage && jest --config jest.config.json --coverage --bail"
from idx.
@davscro Can you share the contents of your jest.config.json
?
from idx.
Sure @yungsters
jest.config.json
"setupTestFrameworkScriptFile": "<rootDir>/setup-jasmine-env.js",
"coverageReporters": [
"text-summary",
"html",
"cobertura"
],
"setupFiles": [
"<rootDir>/test-setup.js"
],
"snapshotSerializers": [
"<rootDir>/node_modules/enzyme-to-json/serializer"
],
"globals": {
"__DEV__": true
},
"coverageThreshold": {
"global": {
"branches": 35,
"functions": 50,
"lines": 55,
"statements": 50
}
}
}
setup-jasmine-env.js
/* eslint-disable no-undef */
const jasmineReporters = require('jasmine-reporters');
jasmine.VERBOSE = true;
jasmine.getEnv().addReporter(
new jasmineReporters.JUnitXmlReporter({
consolidateAll: false,
savePath: './results',
filePrefix: 'test-results'
})
);
test-setup.js
window.matchMedia = window.matchMedia || function() {
return {
matches : false,
addListener : function() {},
removeListener: function() {}
};
};
from idx.
I have the same problem. When I remove --coverage
from command, everything works just fine.
from idx.
Hmm... this is an unfortunate collision between the two plugins. I don't have time to dig into this, but if we could identify the output of the coverage plugin, we can add a special case in babel-plugin-idx
to ignore the extra nodes introduced by the coverage plugin.
Open to other ideas, too.
from idx.
Isn't idx just a "hopefully" temporary wrapper around the new optional chaining proposal? If there is currently a babel implementation of the optional chaining proposal, it would be interesting if jest coverage would work with them.
Correct me if I'm wrong, but at least to me it seems that the babel implementation shouldn't be that different?
from idx.
const f = () => 'a';
turns during jest run with coverage into
() => {/* istanbul ignore next */++cov_14mnsv87h8.f[0];++cov_14mnsv87h8.s[1];return 'a';}
So, when this transformation applied to idx's fake function argument, it violates idx's assertions (not a single stmt, curly braces, referencing values other than single argument's properties, etc).
from idx.
Looks like babel 7 could solve this issue - it puts each plugin on separate compilation pass, which may prevent conflict between idx babel plugin and instanbul plugin, that included by babel-jest in babel config when we run jest with --coverage
.
from idx.
You can also use the following workaround jestjs/jest#3549 (comment)
TL;DR use the idx as a package, but don't take the compilation step for the test phase
from idx.
This issue is almost a year old now. I'm going to close it out, but please do file a new one if this is still a problem (with Babel 7).
from idx.
Related Issues (20)
- Deprecate? HOT 3
- [TS] v2.5.0 DeepRequired generic breaks input.focus() HOT 3
- Consider to support nullable type in `idx` first argument
- Replace `NonUndefinedOrnNull` with TypeScript standard type `NonNullable` HOT 1
- discussion for setIn implementation? HOT 1
- Typescript types do not work on undefined as first parameter HOT 5
- Upgrade to latest version of Flow HOT 3
- Typescript types do not work on undefined as first parameter (new test case) HOT 4
- Change return value from `T2 | null | undefined` to `T2 | null` and `T2 | undefined`? HOT 1
- Doesn't work with TS compiler HOT 3
- Add support for Map.get in .ts files HOT 2
- Cannot find name 'bigint' HOT 6
- `UnboxDeepRequired doesn't support enum type. HOT 1
- CI is not running test for PRs HOT 1
- Outdated CHANGELOG HOT 1
- New release? HOT 1
- @babel/typescript support HOT 3
- Merge in the macro? HOT 1
- DeepRequiredObject causing issues in Typescript 3.5.1 HOT 2
- Accessing Data on Void HOT 1
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 idx.