Skip to content
This repository was archived by the owner on Feb 8, 2019. It is now read-only.

Add test for spread operators and add check-coverage npm task to compare with cover #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"presets": ["es2015"]
"presets": [
"es2015",
"stage-0"
]
}
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ class Rectangle {
get area() {
return this.width * this.height;
}

get measures() {
let height = { height: this.height };
let width = { width: this.width };

return { ...height, ...width };
}
}

// We export the Rectangle class so it can
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "Sample project for demo of running istanbul with mocha using custom compilers",
"main": "index.js",
"scripts": {
"test": "istanbul cover _mocha -- --compilers js:babel-register test/"
"test": "istanbul cover _mocha -- --compilers js:babel-register test/",
"check-coverage": "istanbul check-coverage --statements 100 --functions 100 --branches 100 --lines 100"
},
"repository": {
"type": "git",
Expand All @@ -22,8 +23,9 @@
"homepage": "https://github.com/istanbuljs/sample-mocha-compilers#readme",
"dependencies": {},
"devDependencies": {
"babel-register": "^6.4.3",
"babel-preset-es2015": "^6.3.13",
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.4.3",
"istanbul": "^1.0.0-alpha.2",
"mocha": "^2.3.4"
}
Expand Down
6 changes: 6 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@ describe('rectangle', function () {
let r = new Rectangle(10,10);
assert.ok(r.area === 100);
});

it('returns an object', function () {
let r = new Rectangle(10, 10);
assert.ok(r.measures.width === 10);
assert.ok(r.measures.height === 10);
});
});