Skip to content

Instantly share code, notes, and snippets.

@JaKXz
Forked from patrickarlt/package.json
Last active May 30, 2016 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JaKXz/f64d82899e00495aba83ddd16d702ee9 to your computer and use it in GitHub Desktop.
Save JaKXz/f64d82899e00495aba83ddd16d702ee9 to your computer and use it in GitHub Desktop.
{
"name": "nyc-ava-test",
"version": "1.0.0",
"description": "",
"main": "say.js",
"scripts": {
"test": "npm run test:node-tap && npm run test:ava && npm run test:node-tap:coverage && npm run test:ava:coverage",
"test:node-tap": "tap test-node-tap.js",
"test:ava": "ava test-ava.js",
"test:node-tap:coverage": "tap test-node-tap.js --coverage-report=text",
"test:ava:coverage": "nyc --require babel-register npm run test:ava"
},
"author": "",
"license": "ISC",
"babel": {
"presets": ["es2015"]
},
"ava": {
"require": [
"babel-register"
]
},
"devDependencies": {
"ava": "^0.15.1",
"babel": "^6.5.2",
"babel-cli": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.9.0"
}
}
module.exports = function say({
greeting = 'Hello',
noun = 'world'
} = {}) {
return greeting + ' ' + noun;
}
import test from 'ava';
import say from './say.js';
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');
});
var tap = require('tap')
var say = require('./say.js');
tap.equal(say(), 'Hello world');
tap.equal(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