Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better ES2015 Support #266

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"presets": ["es2015"]
"presets": ["es2015"],
"plugins": [
"transform-async-to-generator",
"transform-runtime"
]
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@
},
"devDependencies": {
"any-path": "^1.3.0",
"babel-core": "^6.9.1",
"babel-plugin-transform-async-to-generator": "^6.8.0",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"chai": "^3.0.0",
"coveralls": "^2.11.4",
"exists-sync": "0.0.3",
Expand Down
13 changes: 13 additions & 0 deletions test/fixtures/es2015/asyncawait.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const foo = async (opts, opts2) => {
let snuh = await bar()
}

const bar = () => {
return new Promise(function (resolve, reject) {
setTimeout(() => {
resolve(33)
}, 10)
})
}

foo()
3 changes: 2 additions & 1 deletion test/fixtures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"nyc": {
"exclude": [
"**/blarg",
"**/blerg"
"**/blerg",
"**/es2015"
]
}
}
20 changes: 20 additions & 0 deletions test/src/es2015.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* global describe, it */

var NYC

try {
NYC = require('../../index.covered.js')
} catch (e) {
NYC = require('../../')
}

(new NYC()).wrap()

require('babel-core/register')
require('tap').mochaGlobals()

describe('es2015 coverage', function () {
it('covers async/await branch', function () {
require('../fixtures/es2015/asyncawait')
})
})
2 changes: 1 addition & 1 deletion test/src/nyc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('nyc', function () {
cwd: path.resolve(__dirname, '../fixtures')
})

nyc.exclude.length.should.eql(5)
nyc.exclude.length.should.eql(7)
})

it("loads 'extension' patterns from package.json#nyc", function () {
Expand Down