testdouble
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -69,19 +69,12 @@ # Installing testdouble.js | ||
### Naming test double | ||
### Naming testdouble.js | ||
In browsers, testdouble.js will be set as a global variable at `window.testdouble`. | ||
In Node.js, the library is available via `require('testdouble')` like any other | ||
module. | ||
Our browser distribution sets the library on a global variable named `window.td`. | ||
In Node.js, the library is loaded via `require('testdouble')`, as you might | ||
expect (though we recommend assigning it to `global.td` in a test helper, for | ||
terseness sake). | ||
However, because the risk of global variables wreaking havoc on the universe is | ||
less extraordinary for test-scoped code, and because typing `testdouble` or | ||
`require('testdouble')` thousands of times in a test suite seems like a bummer, | ||
we typically will alias the library a test helper to | ||
`window.td = window.testdouble` for browsers or | ||
`global.td = require('testdouble')` for Node.js. | ||
You're welcome to address testdouble.js or any of its functions however you prefer, | ||
but all of this documentation will assume that it's available globally as `td`. | ||
You're welcome to address testdouble or any of its functions however you prefer, | ||
but all of this documentation will assume that you've aliased it to `td` for the | ||
sake of terseness. | ||
### Resetting state between test runs | ||
@@ -88,0 +81,0 @@ |
window.context = window.describe; | ||
window.xcontext = window.xdescribe; | ||
window.td = testdouble |
@@ -5,6 +5,4 @@ // Generated by CoffeeScript 1.10.0 | ||
window.td = window.testdouble; | ||
window.NODE_JS = false; | ||
}).call(this); |
// Generated by CoffeeScript 1.10.0 | ||
(function() { | ||
describe('testdouble.object', function() { | ||
describe('td.object', function() { | ||
describe('making a test double object based on a Prototypal thing', function() { | ||
@@ -5,0 +5,0 @@ Given(function() { |
@@ -7,3 +7,3 @@ // Generated by CoffeeScript 1.10.0 | ||
describe("testdouble.js", function() { | ||
describe("td.*", function() { | ||
return describe("where all the functions are", function() { | ||
@@ -10,0 +10,0 @@ Then(function() { |
@@ -16,2 +16,4 @@ // Generated by CoffeeScript 1.10.0 | ||
require('./browser-side-effects')(module.exports); | ||
}).call(this); |
{ | ||
"name": "testdouble", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "A minimal test double library for TDD with JavaScript", | ||
@@ -20,8 +20,11 @@ "homepage": "https://github.com/testdouble/testdouble.js", | ||
"compile:test": "coffee --output generated/test --compile test", | ||
"compile:browser": "browserify . --standalone testdouble --outfile $npm_package_config_build_file --ignore 'quibble' -p headerify", | ||
"compile:browser": "browserify . --standalone td --outfile $npm_package_config_build_file --ignore 'quibble' -p headerify", | ||
"compile": "npm run compile:node && npm run compile:test && npm run compile:browser", | ||
"test": "mocha --ui mocha-given --reporter $npm_package_config_mocha_reporter --compilers coffee:coffee-script --recursive test/node-helper.coffee test/lib", | ||
"test:browser": "npm run compile && testem ci", | ||
"test:example": "cd examples/node && npm i && npm test && cd ../..", | ||
"test:ci": "npm run test --testdouble:mocha_reporter=tap && testem ci && npm run test:example", | ||
"test:example:node": "cd examples/node && npm i && npm test && cd ../..", | ||
"test:example:browser": "cd examples/getting-started && npm i && npm test && cd ../..", | ||
"test:example": "npm run test:example:node && npm run test:example:browser", | ||
"test:all": "npm run test --testdouble:mocha_reporter=tap && testem ci && npm run test:example", | ||
"test:ci": "npm run clean && npm run compile && npm run test:all", | ||
"test:debug": "npm test -- --debug-brk", | ||
@@ -34,3 +37,4 @@ "preversion": "git pull --rebase && npm run test:ci", | ||
"browser": { | ||
"./lib/replace.js": "./lib/replace.browser.js" | ||
"./lib/replace.js": "./lib/replace.browser.js", | ||
"./lib/browser-side-effects.js": "./lib/browser-side-effects.browser.js" | ||
}, | ||
@@ -37,0 +41,0 @@ "browserify": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
692931
141
15689