Skip to content

Commit

Permalink
feat: add support for object-spread syntax (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe committed Sep 4, 2017
1 parent 6695de8 commit 28d5566
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 181 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -5,4 +5,5 @@ node_js:
- '6'
- 'stable'

before_install: npm i yarn -g
after_script: nyc report --reporter=text-lcov | coveralls
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"coveralls": "^2.13.0",
"cross-env": "^5.0.0",
"lerna": "^2.0.0-rc.4",
"lerna": "^2.1.2",
"nyc": "^11.0.1"
},
"nyc": {
Expand Down
2 changes: 1 addition & 1 deletion packages/istanbul-lib-instrument/package.json
Expand Up @@ -18,7 +18,7 @@
"babel-template": "^6.16.0",
"babel-traverse": "^6.18.0",
"babel-types": "^6.18.0",
"babylon": "^6.17.4",
"babylon": "^6.18.0",
"istanbul-lib-coverage": "^1.1.1",
"semver": "^5.3.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/istanbul-lib-instrument/src/instrumenter.js
Expand Up @@ -84,6 +84,7 @@ class Instrumenter {
plugins: [
'asyncGenerators',
'dynamicImport',
'objectRestSpread',
'flow',
'jsx'
]
Expand Down
15 changes: 15 additions & 0 deletions packages/istanbul-lib-instrument/test/specs/object-spread.yaml
@@ -0,0 +1,15 @@
---
name: ES6 Object Spread
guard: isObjectSpreadAvailable
code: |
const a = {foo: args[0]}
const b = {...a}
output = b.foo
tests:
- name: is instrumented
args: [10]
out: 10
lines: { '1': 1, '2': 1, '3': 1 }
statements: {'0': 1, '1': 1, '2': 1 }
functions: {}
branches: {}
4 changes: 4 additions & 0 deletions packages/istanbul-lib-instrument/test/util/guards.js
Expand Up @@ -24,6 +24,10 @@ export function isArrowFnAvailable() {
return tryThis('[1 ,2, 3].map(x => x * x)', 'arrow function');
}

export function isObjectSpreadAvailable() {
return tryThis('const a = {...{b: 33}}', 'object-spread');
}

export function isObjectFreezeAvailable() {
"use strict";
if (!Object.freeze) {
Expand Down

0 comments on commit 28d5566

Please sign in to comment.