[test][Suite.js][istanbul] No coverage reports for Suite.js with native async/await
Closed this issue · 2 comments
t2ym commented
With Suite.js
using native async/await
, istanbul
cannot generate coverage reports.
Root Cause:
The current version of JS parser esprima
, on which istanbul
depends, cannot properly parse async/await
syntax.
Workaround (for Node):
- Step 1:
npm install istanbul-espree
- Step 2: Patch
node_modules/istanbul-espree/lib/instrumentor.js
inistanbul-espree
withecmaVersion: 8
fromecmaVersion: 7
inESP.parse()
- Step 3: Use Node 7:
nvm use 7
- Step 4:
node --harmony ./node_modules/istanbul-espree/lib/cli.js cover ./node_modules/mocha/bin/_mocha test/src/test.js --report lcov -- -R spec
Workaround (for WCT): Not Verified Yet
- Install
node_modules/web-component-tester-istanbul/node_modules/istanbul-espree
- Patch it as above
- Rename
istanbul-espree
folder asistanbul
- Run on an
async/await
-ready browser like Chrome 55+
t2ym commented
Use instanbul@1.1.0-alpha.1
t2ym/web-component-tester-istanbul#wct6
has to be updated as well to useinstanbul@1.1.0-alpha.1
t2ym commented
Close the issue as wct-istanbul 0.12.1 and nyc 11.0.3 can properly report coverage with native async/await since scenarist 1.1.9.