testdouble
Advanced tools
Comparing version 3.3.4 to 3.3.5
# Change Log | ||
## [v3.3.5](https://github.com/testdouble/testdouble.js/tree/v3.3.5) (2018-02-10) | ||
[Full Changelog](https://github.com/testdouble/testdouble.js/compare/v3.3.4...v3.3.5) | ||
**Fixed bugs:** | ||
- The webpack example project doesn't work [\#334](https://github.com/testdouble/testdouble.js/issues/334) | ||
**Closed issues:** | ||
- Update Getting Started to pass instance object instead of constructor to td.object\(\) [\#329](https://github.com/testdouble/testdouble.js/issues/329) | ||
**Merged pull requests:** | ||
- Publicize td.imitate\(\) [\#336](https://github.com/testdouble/testdouble.js/pull/336) ([searls](https://github.com/searls)) | ||
- fix webpack example project [\#335](https://github.com/testdouble/testdouble.js/pull/335) ([searls](https://github.com/searls)) | ||
- Upgrade dependencies, remove yarn [\#333](https://github.com/testdouble/testdouble.js/pull/333) ([searls](https://github.com/searls)) | ||
## [v3.3.4](https://github.com/testdouble/testdouble.js/tree/v3.3.4) (2018-02-09) | ||
@@ -4,0 +21,0 @@ [Full Changelog](https://github.com/testdouble/testdouble.js/compare/v3.3.3...v3.3.4) |
@@ -14,2 +14,3 @@ 'use strict'; | ||
exports.default = function (original, names) { | ||
if (_lodash2.default.isString(names)) return [names]; | ||
if (names != null) return names; | ||
@@ -16,0 +17,0 @@ if (_lodash2.default.isFunction(original) && original.name) { |
@@ -15,2 +15,6 @@ 'use strict'; | ||
var _imitate = require('./imitate'); | ||
var _imitate2 = _interopRequireDefault(_imitate); | ||
var _when = require('./when'); | ||
@@ -59,2 +63,3 @@ | ||
constructor: _constructor2.default, | ||
imitate: _imitate2.default, | ||
when: _when2.default, | ||
@@ -61,0 +66,0 @@ verify: _verify2.default, |
@@ -12,3 +12,3 @@ 'use strict'; | ||
var realThing = requireAt(path); | ||
var fakeThing = (0, _imitate2.default)(realThing, [path + ': ' + nameFor(realThing)]); | ||
var fakeThing = (0, _imitate2.default)(realThing, path + ': ' + nameFor(realThing)); | ||
(0, _quibble2.default)(path, fakeThing); | ||
@@ -15,0 +15,0 @@ return fakeThing; |
@@ -6,2 +6,2 @@ 'use strict'; | ||
}); | ||
exports.default = '3.3.4'; | ||
exports.default = '3.3.5'; |
{ | ||
"name": "testdouble", | ||
"version": "3.3.4", | ||
"version": "3.3.5", | ||
"description": "A minimal test double library for TDD with JavaScript", | ||
@@ -29,25 +29,25 @@ "homepage": "https://github.com/testdouble/testdouble.js", | ||
"compile:node": "babel src -d lib", | ||
"precompile": "yarn clean", | ||
"compile": "yarn compile:node && yarn compile:browser && yarn compile:browser:test", | ||
"cover": "nyc --reporter=lcov --reporter=text-summary --require babel-core/register _mocha --ui mocha-given --reporter $npm_package_config_mocha_reporter --compilers coffee:coffee-script --recursive regression/node-helper.coffee regression/src", | ||
"cover:unit": "nyc --reporter=html yarn test:unit", | ||
"precompile": "npm run clean", | ||
"compile": "npm run compile:node && npm run compile:browser && npm run compile:browser:test", | ||
"cover": "nyc --reporter=lcov --reporter=text-summary --require babel-core/register _mocha --ui mocha-given --reporter $npm_package_config_mocha_reporter --compilers coffee:coffeescript --recursive regression/node-helper.coffee regression/src", | ||
"cover:unit": "nyc --reporter=html npm run test:unit", | ||
"cover:report": "codeclimate-test-reporter < coverage/lcov.info", | ||
"style": "standard --fix", | ||
"test": "mocha --ui mocha-given --reporter $npm_package_config_mocha_reporter --compilers js:babel-core/register,coffee:coffee-script --recursive regression/node-helper.coffee regression/src", | ||
"test:all": "yarn test:unit && yarn test && yarn test:browser && yarn test:example && yarn test:typescript", | ||
"test": "mocha --ui mocha-given --reporter $npm_package_config_mocha_reporter --compilers js:babel-core/register,coffee:coffeescript --recursive regression/node-helper.coffee regression/src", | ||
"test:all": "npm run test:unit && npm test && npm run test:browser && npm run test:example && npm run test:typescript", | ||
"test:browser": "testem ci", | ||
"test:unit": "teenytest", | ||
"test:ci": "yarn compile && yarn style && yarn test:all && echo \"All done!\"", | ||
"test:ci": "npm run compile && npm run style && npm run test:all && echo \"All done!\"", | ||
"test:typescript": "tsc --outDir generated/typescript -p regression/typescript && node generated/typescript/test.js", | ||
"test:example:webpack": "cd examples/webpack && npm install && npm test", | ||
"test:example:node": "cd examples/node && npm install && npm test", | ||
"test:example:lineman": "cd examples/lineman && yarn install && yarn test", | ||
"test:example:lineman": "cd examples/lineman && npm install && npm test", | ||
"test:example:babel": "cd examples/babel && npm install && npm test", | ||
"test:example": "yarn test:example:node && yarn test:example:lineman && yarn test:example:webpack && yarn test:example:babel", | ||
"test:example": "npm run test:example:node && npm run test:example:lineman && npm run test:example:webpack && npm run test:example:babel", | ||
"version:write": "echo \"export default '$npm_package_version'\" > src/version.js", | ||
"version:changelog": "if command -v github_changelog_generator &>/dev/null; then github_changelog_generator; git commit -m \"Changelog for $npm_package_version\" CHANGELOG.md; else echo Versioning requires you first run 'gem install github_changelog_generator' >&2; fi", | ||
"preversion": "git pull --rebase && yarn test:ci", | ||
"version": "yarn version:write && yarn compile && git add src/version.js", | ||
"postversion": "git push --tags && yarn version:changelog && git push && npm publish", | ||
"prepare": "yarn compile" | ||
"preversion": "git pull --rebase && npm run test:ci", | ||
"version": "rm -rf node_modules && npm i && npm run version:write && npm run compile && git add src/version.js", | ||
"postversion": "git push --tags && npm run version:changelog && git push && npm publish", | ||
"prepare": "npm run compile" | ||
}, | ||
@@ -92,2 +92,5 @@ "babel": { | ||
], | ||
"exclude": [ | ||
"examples" | ||
], | ||
"all": true | ||
@@ -105,17 +108,18 @@ }, | ||
"babel-cli": "^6.24.1", | ||
"babel-core": "^6.26.0", | ||
"babel-preset-env": "^1.5.2", | ||
"babel-preset-power-assert": "^1.0.0", | ||
"babelify": "^7.3.0", | ||
"browserify": "^14.4.0", | ||
"chai": "^3.2.0", | ||
"babel-preset-power-assert": "^2.0.0", | ||
"babelify": "^8.0.0", | ||
"browserify": "^16.0.0", | ||
"chai": "^4.1.2", | ||
"codeclimate-test-reporter": "^0.5.0", | ||
"coffee-script": "^1.10.0", | ||
"coffeeify": "^2.1.0", | ||
"coffeeify": "^3.0.1", | ||
"coffeescript": "^1.12.7", | ||
"core-assert": "^0.2.1", | ||
"headerify": "^1.0.1", | ||
"is-number": "^3.0.0", | ||
"is-number": "^5.0.0", | ||
"mkdirp": "^0.5.1", | ||
"mocha": "^3.2.0", | ||
"mocha": "^5.0.0", | ||
"mocha-given": "^0.1.3", | ||
"nyc": "^10.1.2", | ||
"nyc": "^11.4.1", | ||
"power-assert": "^1.4.4", | ||
@@ -127,6 +131,5 @@ "pryjs": "^1.0.3", | ||
"teenytest": "^5.1.1", | ||
"testdouble": "3.2.6", | ||
"testem": "^1.18.0", | ||
"typescript": "^2.4.1", | ||
"yarn": "^1.3.2" | ||
"testdouble": "3.3.4", | ||
"testem": "^2.0.0", | ||
"typescript": "^2.4.1" | ||
}, | ||
@@ -133,0 +136,0 @@ "directories": { |
@@ -231,3 +231,3 @@ # testdouble.js | ||
### `td.func()`, `td.object()`, and `td.constructor()` to create test doubles | ||
### `td.func()`, `td.object()`, `td.constructor()`, and `td.imitate()` to create test doubles | ||
@@ -317,2 +317,10 @@ `td.replace()`'s imitation and injection convenience is great when your | ||
#### `td.imitate()` | ||
**`td.imitate(realThing[, name])`** | ||
If you know you want to imitate something, but don't know (or care) whether it's | ||
a function, object, or constructor, you can also just pass it to `td.imitate()` | ||
with an optional name parameter. | ||
### `td.when()` for stubbing responses | ||
@@ -319,0 +327,0 @@ |
import _ from '../wrap/lodash' | ||
export default (original, names) => { | ||
if (_.isString(names)) return [names] | ||
if (names != null) return names | ||
@@ -5,0 +6,0 @@ if (_.isFunction(original) && original.name) { |
import tdFunction from './function' | ||
import object from './object' | ||
import constructor from './constructor' | ||
import imitate from './imitate' | ||
import when from './when' | ||
@@ -19,2 +20,3 @@ import verify from './verify' | ||
constructor, | ||
imitate, | ||
when, | ||
@@ -21,0 +23,0 @@ verify, |
@@ -12,3 +12,3 @@ import _ from '../wrap/lodash' | ||
const realThing = requireAt(path) | ||
const fakeThing = imitate(realThing, [path + ': ' + nameFor(realThing)]) | ||
const fakeThing = imitate(realThing, `${path}: ${nameFor(realThing)}`) | ||
quibble(path, fakeThing) | ||
@@ -15,0 +15,0 @@ return fakeThing |
@@ -1,1 +0,1 @@ | ||
export default '3.3.4' | ||
export default '3.3.5' |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
564558
13608
542