Last active
May 30, 2016 01:01
-
-
Save patrickarlt/db48968e267c6d50b08b9459c33d6cb2 to your computer and use it in GitHub Desktop.
Demo of a bug with nyc when using https://gist.github.com/ericelliott/f3c2a53a1d4100539f71.
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", | |
"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 ava-test.js", | |
"test:node-tap:coverage": "tap test-node-tap.js --coverage-report=text", | |
"test:ava:coverage": "nyc ava-test.js" | |
}, | |
"author": "", | |
"license": "ISC" | |
} |
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.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'); | |
}); |
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
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