Last active
July 26, 2016 04:06
-
-
Save JaKXz/9c9aa2c9dcc106e59939ec4b9f79c4f4 to your computer and use it in GitHub Desktop.
nyc@7.1.0 working demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "nyc-ava-test", | |
"version": "1.0.0", | |
"main": "say.js", | |
"scripts": { | |
"test": "cross-env NODE_ENV=test nyc ava" | |
}, | |
"license": "ISC", | |
"babel": { | |
"presets": [ | |
"es2015" | |
], | |
"env": { | |
"test": { | |
"plugins": [ | |
"istanbul" | |
] | |
} | |
} | |
}, | |
"ava": { | |
"require": [ | |
"babel-register" | |
] | |
}, | |
"nyc": { | |
"require": [ | |
"babel-register" | |
], | |
"reporter": [ | |
"lcov", | |
"text-summary" | |
], | |
"sourceMap": false, | |
"instrument": false | |
}, | |
"devDependencies": { | |
"ava": "^0.15.1", | |
"babel": "^6.5.2", | |
"babel-cli": "^6.9.0", | |
"babel-plugin-istanbul": "^1.0.1", | |
"babel-preset-es2015": "^6.9.0", | |
"babel-register": "^6.9.0", | |
"cross-env": "^1.0.8", | |
"nyc": "^7.1.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function say({ | |
greeting = 'Hello', | |
noun = 'world' | |
} = {}) { | |
return greeting + ' ' + noun; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import test from 'ava'; | |
import say from './say'; | |
test('should default to hello world', t => { | |
t.is(say(), 'Hello world'); | |
}); | |
test('should say a custom greeting to hello world', t => { | |
t.is(say({ | |
greeting: 'Hi', | |
noun: 'Phil' | |
}), 'Hi Phil'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment