testdouble
Advanced tools
Comparing version 3.16.8 to 3.17.0
@@ -16,5 +16,5 @@ "use strict"; | ||
}; | ||
var arityMismatch = (expectedArgs, actualArgs, config) => expectedArgs.length !== actualArgs.length && !config.ignoreExtraArgs; | ||
var equalsWithMatchers = (expectedArgs, actualArgs) => lodash_1.default.every(expectedArgs, (expectedArg, key) => argumentMatchesExpectation(expectedArg, actualArgs[key])); | ||
var argumentMatchesExpectation = (expectedArg, actualArg) => { | ||
const arityMismatch = (expectedArgs, actualArgs, config) => expectedArgs.length !== actualArgs.length && !config.ignoreExtraArgs; | ||
const equalsWithMatchers = (expectedArgs, actualArgs) => lodash_1.default.every(expectedArgs, (expectedArg, key) => argumentMatchesExpectation(expectedArg, actualArgs[key])); | ||
const argumentMatchesExpectation = (expectedArg, actualArg) => { | ||
if ((0, is_matcher_1.default)(expectedArg)) { | ||
@@ -31,2 +31,2 @@ return matcherTestFor(expectedArg)(actualArg); | ||
}; | ||
var matcherTestFor = (matcher) => matcher.__matches; | ||
const matcherTestFor = (matcher) => matcher.__matches; |
@@ -8,3 +8,3 @@ "use strict"; | ||
ignoreWarnings: false, | ||
promiseConstructor: global.Promise, | ||
promiseConstructor: Promise, | ||
suppressErrors: false | ||
@@ -31,3 +31,3 @@ }; | ||
}; | ||
var ensureOverridesExist = (overrides) => { | ||
const ensureOverridesExist = (overrides) => { | ||
lodash_1.default.each(overrides, (val, key) => { | ||
@@ -34,0 +34,0 @@ if (!Object.prototype.hasOwnProperty.call(configData, key)) { |
@@ -9,3 +9,3 @@ "use strict"; | ||
: fakeConstructorFromNames(typeOrNames); | ||
var fakeConstructorFromNames = (funcNames) => { | ||
const fakeConstructorFromNames = (funcNames) => { | ||
return lodash_1.default.tap((0, function_1.default)('(unnamed constructor)'), (fakeConstructor) => { | ||
@@ -12,0 +12,0 @@ fakeConstructor.prototype.toString = () => '[test double instance of constructor]'; |
@@ -14,3 +14,3 @@ "use strict"; | ||
exports.default = func; | ||
var createTestDoubleNamed = function (name) { | ||
const createTestDoubleNamed = function (name) { | ||
return lodash_1.default.tap(createTestDoubleFunction(), (testDouble) => { | ||
@@ -27,3 +27,3 @@ const entry = store_1.default.for(testDouble, true); | ||
}; | ||
var createTestDoubleFunction = function () { | ||
const createTestDoubleFunction = function () { | ||
return function testDouble(...args) { | ||
@@ -30,0 +30,0 @@ calls_1.default.log(testDouble, args, this); |
@@ -12,3 +12,3 @@ "use strict"; | ||
String, | ||
global.Symbol | ||
Symbol | ||
]).some(type => thing instanceof type); |
@@ -19,4 +19,4 @@ "use strict"; | ||
}; | ||
var withUrl = (url) => url != null | ||
const withUrl = (url) => url != null | ||
? ` (see: ${url} )` | ||
: ''; |
@@ -16,3 +16,3 @@ "use strict"; | ||
}); | ||
var nameFor = (config, matcherArgs) => { | ||
const nameFor = (config, matcherArgs) => { | ||
if (lodash_1.default.isFunction(config.name)) { | ||
@@ -19,0 +19,0 @@ return config.name(matcherArgs); |
@@ -15,3 +15,3 @@ "use strict"; | ||
exports.default = object; | ||
var fakeObject = function (nameOrType, config, argCount) { | ||
const fakeObject = function (nameOrType, config, argCount) { | ||
if (lodash_1.default.isArray(nameOrType)) { | ||
@@ -33,7 +33,7 @@ return createTestDoublesForFunctionNames(nameOrType); | ||
}; | ||
var createTestDoublesForFunctionNames = (names) => lodash_1.default.transform(names, (acc, funcName) => { | ||
const createTestDoublesForFunctionNames = (names) => lodash_1.default.transform(names, (acc, funcName) => { | ||
acc[funcName] = (0, function_1.default)(`.${String(funcName)}`); | ||
}, {}); | ||
var ensureFunctionIsNotPassed = () => log_1.default.error('td.object', 'Functions are not valid arguments to `td.object` (as of testdouble@2.0.0). Please use `td.function()`, `td.constructor()` or `td.instance()` instead for creating fake functions.'); | ||
var ensureOtherGarbageIsNotPassed = () => log_1.default.error('td.object', `\ | ||
const ensureFunctionIsNotPassed = () => log_1.default.error('td.object', 'Functions are not valid arguments to `td.object` (as of testdouble@2.0.0). Please use `td.function()`, `td.constructor()` or `td.instance()` instead for creating fake functions.'); | ||
const ensureOtherGarbageIsNotPassed = () => log_1.default.error('td.object', `\ | ||
To create a fake object with td.object(), pass it a plain object that contains | ||
@@ -46,9 +46,9 @@ functions, an array of function names, or (if your runtime supports ES Proxy | ||
`); | ||
var withDefaults = (config) => lodash_1.default.extend({}, DEFAULT_OPTIONS, config); | ||
var addToStringToDouble = (fakeObject, nameOrType) => { | ||
const withDefaults = (config) => lodash_1.default.extend({}, DEFAULT_OPTIONS, config); | ||
const addToStringToDouble = (fakeObject, nameOrType) => { | ||
const name = nameOf(nameOrType); | ||
fakeObject.toString = () => `[test double object${name ? ` for "${name}"` : ''}]`; | ||
}; | ||
var nameOf = (nameOrType) => lodash_1.default.isString(nameOrType) | ||
const nameOf = (nameOrType) => lodash_1.default.isString(nameOrType) | ||
? nameOrType | ||
: ''; |
@@ -31,3 +31,3 @@ "use strict"; | ||
exports.default = default_1; | ||
var getFake = (isManual, property, manualReplacement, realThing) => { | ||
const getFake = (isManual, property, manualReplacement, realThing) => { | ||
if (isManual) { | ||
@@ -41,3 +41,3 @@ warnIfTypeMismatch(property, manualReplacement, realThing); | ||
}; | ||
var warnIfTypeMismatch = (property, fakeThing, realThing) => { | ||
const warnIfTypeMismatch = (property, fakeThing, realThing) => { | ||
const fakeType = typeof fakeThing; | ||
@@ -44,0 +44,0 @@ const realType = typeof realThing; |
@@ -30,4 +30,4 @@ "use strict"; | ||
}; | ||
var stubbingFor = (testDouble, actualArgs) => lodash_1.default.findLast(index_1.default.for(testDouble).stubbings, stubbing => isSatisfied(stubbing, actualArgs)); | ||
var executePlan = (stubbing, actualArgs, actualContext) => { | ||
const stubbingFor = (testDouble, actualArgs) => lodash_1.default.findLast(index_1.default.for(testDouble).stubbings, stubbing => isSatisfied(stubbing, actualArgs)); | ||
const executePlan = (stubbing, actualArgs, actualContext) => { | ||
const value = stubbedValueFor(stubbing); | ||
@@ -44,3 +44,3 @@ stubbing.callCount += 1; | ||
}; | ||
var invokeCallbackFor = (stubbing, actualArgs) => { | ||
const invokeCallbackFor = (stubbing, actualArgs) => { | ||
if (lodash_1.default.some(stubbing.args, is_callback_1.default)) { | ||
@@ -54,3 +54,3 @@ lodash_1.default.each(stubbing.args, (expectedArg, i) => { | ||
}; | ||
var callbackArgs = (stubbing, expectedArg) => { | ||
const callbackArgs = (stubbing, expectedArg) => { | ||
if (expectedArg.args != null) { | ||
@@ -66,3 +66,3 @@ return expectedArg.args; | ||
}; | ||
var callCallback = (stubbing, callback, args) => { | ||
const callCallback = (stubbing, callback, args) => { | ||
if (stubbing.config.delay) { | ||
@@ -78,3 +78,3 @@ lodash_1.default.delay(callback, stubbing.config.delay, ...args); | ||
}; | ||
var createPromise = (stubbing, value, willResolve) => { | ||
const createPromise = (stubbing, value, willResolve) => { | ||
const Promise = (0, config_1.default)().promiseConstructor; | ||
@@ -86,11 +86,11 @@ ensurePromise(Promise); | ||
}; | ||
var stubbedValueFor = (stubbing) => stubbing.callCount < stubbing.stubbedValues.length | ||
const stubbedValueFor = (stubbing) => stubbing.callCount < stubbing.stubbedValues.length | ||
? stubbing.stubbedValues[stubbing.callCount] | ||
: lodash_1.default.last(stubbing.stubbedValues); | ||
var isSatisfied = (stubbing, actualArgs) => (0, args_match_1.default)(stubbing.args, actualArgs, stubbing.config) && | ||
const isSatisfied = (stubbing, actualArgs) => (0, args_match_1.default)(stubbing.args, actualArgs, stubbing.config) && | ||
hasTimesRemaining(stubbing); | ||
var hasTimesRemaining = (stubbing) => stubbing.config.times == null | ||
const hasTimesRemaining = (stubbing) => stubbing.config.times == null | ||
? true | ||
: stubbing.callCount < stubbing.config.times; | ||
var ensurePromise = (Promise) => { | ||
const ensurePromise = (Promise) => { | ||
if (Promise == null) { | ||
@@ -97,0 +97,0 @@ return log_1.default.error('td.when', `\ |
@@ -32,4 +32,4 @@ "use strict"; | ||
}; | ||
var stringifyString = (string) => lodash_1.default.includes(string, '\n') | ||
const stringifyString = (string) => lodash_1.default.includes(string, '\n') | ||
? `"""\n${string}\n"""` | ||
: `"${string.replace(new RegExp('"', 'g'), '\\"')}"`; | ||
: `"${string.replace(/"/g, '\\"')}"`; |
@@ -25,3 +25,3 @@ "use strict"; | ||
}; | ||
var ensureRehearsalOccurred = (last) => { | ||
const ensureRehearsalOccurred = (last) => { | ||
if (!last) { | ||
@@ -48,3 +48,3 @@ log_1.default.error('td.verify', `\ | ||
}; | ||
var warnIfStubbed = (testDouble, actualArgs) => { | ||
const warnIfStubbed = (testDouble, actualArgs) => { | ||
if (lodash_1.default.some(stubbings_1.default.for(testDouble), (stubbing) => (0, args_match_1.default)(stubbing.args, actualArgs, stubbing.config))) { | ||
@@ -54,10 +54,10 @@ log_1.default.warn('td.verify', `test double${stringifyName(testDouble)} was both stubbed and verified with arguments (${(0, arguments_1.default)(actualArgs)}), which is redundant and probably unnecessary.`, 'https://github.com/testdouble/testdouble.js/blob/main/docs/B-frequently-asked-questions.md#why-shouldnt-i-call-both-tdwhen-and-tdverify-for-a-single-interaction-with-a-test-double'); | ||
}; | ||
var unsatisfiedErrorMessage = (testDouble, args, config) => baseSummary(testDouble, args, config) + | ||
const unsatisfiedErrorMessage = (testDouble, args, config) => baseSummary(testDouble, args, config) + | ||
matchedInvocationSummary(testDouble, args, config) + | ||
invocationSummary(testDouble, args, config); | ||
var stringifyName = (testDouble) => { | ||
const stringifyName = (testDouble) => { | ||
const name = store_1.default.for(testDouble).name; | ||
return name ? ` \`${name}\`` : ''; | ||
}; | ||
var baseSummary = (testDouble, args, config) => `\ | ||
const baseSummary = (testDouble, args, config) => `\ | ||
Unsatisfied verification on test double${stringifyName(testDouble)}. | ||
@@ -68,3 +68,3 @@ | ||
`; | ||
var invocationSummary = (testDouble, args, config) => { | ||
const invocationSummary = (testDouble, args, config) => { | ||
const calls = calls_1.default.for(testDouble); | ||
@@ -78,3 +78,3 @@ if (calls.length === 0) { | ||
}; | ||
var matchedInvocationSummary = (testDouble, args, config) => { | ||
const matchedInvocationSummary = (testDouble, args, config) => { | ||
const calls = calls_1.default.where(testDouble, args, config); | ||
@@ -89,8 +89,8 @@ const expectedCalls = config.times || 0; | ||
}; | ||
var pluralize = (x, msg) => `${x} ${msg}${x === 1 ? '' : 's'}`; | ||
var timesMessage = (config) => config.times != null | ||
const pluralize = (x, msg) => `${x} ${msg}${x === 1 ? '' : 's'}`; | ||
const timesMessage = (config) => config.times != null | ||
? ` ${pluralize(config.times, 'time')}` | ||
: ''; | ||
var ignoreMessage = (config) => config.ignoreExtraArgs != null | ||
const ignoreMessage = (config) => config.ignoreExtraArgs != null | ||
? ', ignoring any additional arguments' | ||
: ''; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = '3.16.8'; | ||
exports.default = '3.17.0'; |
{ | ||
"name": "testdouble", | ||
"version": "3.16.8", | ||
"version": "3.17.0", | ||
"description": "A minimal test double library for TDD with JavaScript", | ||
@@ -47,14 +47,14 @@ "homepage": "https://github.com/testdouble/testdouble.js", | ||
"test:safe": "teenytest --helper test/helper.js \"test/safe/**/*.test.{js,ts}\"", | ||
"test:esm": "if node test/supports-esm.js; then NODE_OPTIONS='--loader=quibble' TS_NODE_IGNORE='(?:^|/)node_modules/,notypescript' ./test/safe-esm/teenytest-proxy.js --helper test/helper.js test/safe-esm/replace.test.js; fi", | ||
"test:no-loader-esm": "if node test/supports-esm.js; then TS_NODE_IGNORE='(?:^|/)node_modules/,notypescript' teenytest test/helper.js './test/safe-esm/*.no-loader-test.{mjs,js}'; fi", | ||
"test:esm": "cross-env NODE_OPTIONS=\"--loader=quibble\" TS_NODE_IGNORE=\"node_modules,notypescript\" ./test/safe-esm/teenytest-proxy.js --helper test/helper.js test/safe-esm/replace.test.js", | ||
"test:no-loader-esm": "cross-env TS_NODE_IGNORE=\"node_modules,notypescript\" teenytest test/helper.js './test/safe-esm/*.no-loader-test.{mjs,js}'", | ||
"test:ci": "npm run compile && run-p style test && echo \"All done!\"", | ||
"test:example": "run-s test:example:babel test:example:jest test:example:jest-broken test:example:node test:example:node-ava test:example:node-esm", | ||
"test:example:babel": "./script/run-examples babel", | ||
"test:example:jest": "./script/run-examples jest", | ||
"test:example:jest-broken": "./script/run-examples jest-broken", | ||
"test:example:plain-html": "./script/run-examples plain-html", | ||
"test:example:node": "./script/run-examples node", | ||
"test:example:node-ava": "./script/run-examples node-ava", | ||
"test:example:node-esm": "if node test/supports-esm.js; then ./script/run-examples node-esm; fi", | ||
"test:example:webpack": "./script/run-examples webpack", | ||
"test:example:babel": "bash ./script/run-examples babel", | ||
"test:example:jest": "bash ./script/run-examples jest", | ||
"test:example:jest-broken": "bash ./script/run-examples jest-broken", | ||
"test:example:plain-html": "bash ./script/run-examples plain-html", | ||
"test:example:node": "bash ./script/run-examples node", | ||
"test:example:node-ava": "bash ./script/run-examples node-ava", | ||
"test:example:node-esm": "bash ./script/run-examples node-esm", | ||
"test:example:webpack": "bash ./script/run-examples webpack", | ||
"version:write": "echo \"export default '$npm_package_version'\" > src/version.js", | ||
@@ -99,3 +99,3 @@ "preversion": "git pull --rebase", | ||
"lodash": "^4.17.21", | ||
"quibble": "^0.6.14", | ||
"quibble": "^0.6.17", | ||
"stringify-object-es5": "^2.5.0", | ||
@@ -105,8 +105,9 @@ "theredoc": "^1.0.0" | ||
"devDependencies": { | ||
"@types/node": "^18.11.9", | ||
"@typescript-eslint/eslint-plugin": "^5.43.0", | ||
"@typescript-eslint/parser": "^5.43.0", | ||
"@types/node": "^18.13.0", | ||
"@typescript-eslint/eslint-plugin": "^5.51.0", | ||
"@typescript-eslint/parser": "^5.51.0", | ||
"browserify": "^17.0.0", | ||
"codeclimate-test-reporter": "^0.5.1", | ||
"cross-conf-env": "^1.3.0", | ||
"cross-env": "^7.0.3", | ||
"dedent": "^0.7.0", | ||
@@ -116,13 +117,13 @@ "headerify": "^1.0.1", | ||
"is-promise": "^4.0.0", | ||
"mkdirp": "^1.0.4", | ||
"mkdirp": "^2.1.3", | ||
"npm-run-all": "^4.1.5", | ||
"nyc": "^15.1.0", | ||
"rimraf": "^3.0.2", | ||
"rimraf": "^4.1.2", | ||
"standard": "^17.0.0", | ||
"teenytest": "^6.0.3", | ||
"teenytest": "^6.0.4", | ||
"teenytest-promise": "^1.0.0", | ||
"testdouble": "^3.16.7", | ||
"testdouble": "^3.16.8", | ||
"ts-node": "^10.9.1", | ||
"tsify": "^5.0.4", | ||
"typescript": "^4.9.3" | ||
"typescript": "^4.9.5" | ||
}, | ||
@@ -154,4 +155,4 @@ "directories": { | ||
"engines": { | ||
"node": ">= 4.0.0" | ||
"node": ">= 14" | ||
} | ||
} |
@@ -40,3 +40,3 @@ # testdouble.js (AKA td.js) | ||
// CommonJS modules (e.g. Node.js) | ||
global.td = require('testdouble') | ||
globalThis.td = require('testdouble') | ||
@@ -59,2 +59,3 @@ // Global set in our browser distribution | ||
* [testdouble-qunit](https://github.com/alexlafroscia/testdouble-qunit/tree/master/packages/testdouble-qunit) | ||
* [testdouble-vitest](https://github.com/mcous/testdouble-vitest) | ||
@@ -587,3 +588,1 @@ ## Getting started | ||
configuring more advanced stubbings and verifications | ||
@@ -14,10 +14,10 @@ import _ from './wrap/lodash' | ||
var arityMismatch = (expectedArgs, actualArgs, config) => | ||
const arityMismatch = (expectedArgs, actualArgs, config) => | ||
expectedArgs.length !== actualArgs.length && !config.ignoreExtraArgs | ||
var equalsWithMatchers = (expectedArgs, actualArgs) => | ||
const equalsWithMatchers = (expectedArgs, actualArgs) => | ||
_.every(expectedArgs, (expectedArg, key) => | ||
argumentMatchesExpectation(expectedArg, actualArgs[key])) | ||
var argumentMatchesExpectation = (expectedArg, actualArg) => { | ||
const argumentMatchesExpectation = (expectedArg, actualArg) => { | ||
if (isMatcher(expectedArg)) { | ||
@@ -34,3 +34,3 @@ return matcherTestFor(expectedArg)(actualArg) | ||
var matcherTestFor = (matcher) => | ||
const matcherTestFor = (matcher) => | ||
matcher.__matches |
@@ -7,3 +7,3 @@ import _ from './wrap/lodash' | ||
ignoreWarnings: false, | ||
promiseConstructor: global.Promise, | ||
promiseConstructor: Promise, | ||
suppressErrors: false | ||
@@ -34,3 +34,3 @@ } | ||
var ensureOverridesExist = (overrides) => { | ||
const ensureOverridesExist = (overrides) => { | ||
_.each(overrides, (val, key) => { | ||
@@ -37,0 +37,0 @@ if (!Object.prototype.hasOwnProperty.call(configData, key)) { |
@@ -10,3 +10,3 @@ import _ from './wrap/lodash' | ||
var fakeConstructorFromNames = (funcNames) => { | ||
const fakeConstructorFromNames = (funcNames) => { | ||
return _.tap(tdFunction('(unnamed constructor)'), (fakeConstructor) => { | ||
@@ -13,0 +13,0 @@ fakeConstructor.prototype.toString = () => |
@@ -13,3 +13,3 @@ import _ from './wrap/lodash' | ||
var createTestDoubleNamed = function (name) { | ||
const createTestDoubleNamed = function (name) { | ||
return _.tap(createTestDoubleFunction(), (testDouble) => { | ||
@@ -26,3 +26,3 @@ const entry = store.for(testDouble, true) | ||
var createTestDoubleFunction = function () { | ||
const createTestDoubleFunction = function () { | ||
return function testDouble (...args) { | ||
@@ -29,0 +29,0 @@ calls.log(testDouble, args, this) |
@@ -14,3 +14,3 @@ import _ from '../../wrap/lodash' | ||
String, | ||
global.Symbol | ||
Symbol | ||
]).some(type => thing instanceof type) |
@@ -21,5 +21,5 @@ import config from './config' | ||
var withUrl = (url) => | ||
const withUrl = (url) => | ||
url != null | ||
? ` (see: ${url} )` | ||
: '' |
@@ -18,3 +18,3 @@ import _ from '../wrap/lodash' | ||
var nameFor = (config, matcherArgs) => { | ||
const nameFor = (config, matcherArgs) => { | ||
if (_.isFunction(config.name)) { | ||
@@ -21,0 +21,0 @@ return config.name(matcherArgs) |
@@ -15,3 +15,3 @@ import _ from './wrap/lodash' | ||
var fakeObject = function (nameOrType, config, argCount) { | ||
const fakeObject = function (nameOrType, config, argCount) { | ||
if (_.isArray(nameOrType)) { | ||
@@ -30,3 +30,3 @@ return createTestDoublesForFunctionNames(nameOrType) | ||
var createTestDoublesForFunctionNames = (names) => | ||
const createTestDoublesForFunctionNames = (names) => | ||
_.transform(names, (acc, funcName) => { | ||
@@ -36,6 +36,6 @@ acc[funcName] = tdFunction(`.${String(funcName)}`) | ||
var ensureFunctionIsNotPassed = () => | ||
const ensureFunctionIsNotPassed = () => | ||
log.error('td.object', 'Functions are not valid arguments to `td.object` (as of testdouble@2.0.0). Please use `td.function()`, `td.constructor()` or `td.instance()` instead for creating fake functions.') | ||
var ensureOtherGarbageIsNotPassed = () => | ||
const ensureOtherGarbageIsNotPassed = () => | ||
log.error('td.object', `\ | ||
@@ -50,6 +50,6 @@ To create a fake object with td.object(), pass it a plain object that contains | ||
var withDefaults = (config) => | ||
const withDefaults = (config) => | ||
_.extend({}, DEFAULT_OPTIONS, config) | ||
var addToStringToDouble = (fakeObject, nameOrType) => { | ||
const addToStringToDouble = (fakeObject, nameOrType) => { | ||
const name = nameOf(nameOrType) | ||
@@ -59,5 +59,5 @@ fakeObject.toString = () => `[test double object${name ? ` for "${name}"` : ''}]` | ||
var nameOf = (nameOrType) => | ||
const nameOf = (nameOrType) => | ||
_.isString(nameOrType) | ||
? nameOrType | ||
: '' |
@@ -29,3 +29,3 @@ import _ from '../wrap/lodash' | ||
var getFake = (isManual, property, manualReplacement, realThing) => { | ||
const getFake = (isManual, property, manualReplacement, realThing) => { | ||
if (isManual) { | ||
@@ -39,3 +39,3 @@ warnIfTypeMismatch(property, manualReplacement, realThing) | ||
var warnIfTypeMismatch = (property, fakeThing, realThing) => { | ||
const warnIfTypeMismatch = (property, fakeThing, realThing) => { | ||
const fakeType = typeof fakeThing | ||
@@ -42,0 +42,0 @@ const realType = typeof realThing |
@@ -32,7 +32,7 @@ import _ from '../wrap/lodash' | ||
var stubbingFor = (testDouble, actualArgs) => | ||
const stubbingFor = (testDouble, actualArgs) => | ||
_.findLast(store.for(testDouble).stubbings, stubbing => | ||
isSatisfied(stubbing, actualArgs)) | ||
var executePlan = (stubbing, actualArgs, actualContext) => { | ||
const executePlan = (stubbing, actualArgs, actualContext) => { | ||
const value = stubbedValueFor(stubbing) | ||
@@ -50,3 +50,3 @@ stubbing.callCount += 1 | ||
var invokeCallbackFor = (stubbing, actualArgs) => { | ||
const invokeCallbackFor = (stubbing, actualArgs) => { | ||
if (_.some(stubbing.args, isCallback)) { | ||
@@ -61,3 +61,3 @@ _.each(stubbing.args, (expectedArg, i) => { | ||
var callbackArgs = (stubbing, expectedArg) => { | ||
const callbackArgs = (stubbing, expectedArg) => { | ||
if (expectedArg.args != null) { | ||
@@ -72,3 +72,3 @@ return expectedArg.args | ||
var callCallback = (stubbing, callback, args) => { | ||
const callCallback = (stubbing, callback, args) => { | ||
if (stubbing.config.delay) { | ||
@@ -83,3 +83,3 @@ _.delay(callback, stubbing.config.delay, ...args) | ||
var createPromise = (stubbing, value, willResolve) => { | ||
const createPromise = (stubbing, value, willResolve) => { | ||
const Promise = config().promiseConstructor | ||
@@ -94,3 +94,3 @@ ensurePromise(Promise) | ||
var stubbedValueFor = (stubbing) => | ||
const stubbedValueFor = (stubbing) => | ||
stubbing.callCount < stubbing.stubbedValues.length | ||
@@ -100,7 +100,7 @@ ? stubbing.stubbedValues[stubbing.callCount] | ||
var isSatisfied = (stubbing, actualArgs) => | ||
const isSatisfied = (stubbing, actualArgs) => | ||
argsMatch(stubbing.args, actualArgs, stubbing.config) && | ||
hasTimesRemaining(stubbing) | ||
var hasTimesRemaining = (stubbing) => | ||
const hasTimesRemaining = (stubbing) => | ||
stubbing.config.times == null | ||
@@ -110,3 +110,3 @@ ? true | ||
var ensurePromise = (Promise) => { | ||
const ensurePromise = (Promise) => { | ||
if (Promise == null) { | ||
@@ -113,0 +113,0 @@ return log.error('td.when', `\ |
@@ -28,5 +28,5 @@ import _ from '../wrap/lodash' | ||
var stringifyString = (string) => | ||
const stringifyString = (string) => | ||
_.includes(string, '\n') | ||
? `"""\n${string}\n"""` | ||
: `"${string.replace(new RegExp('"', 'g'), '\\"')}"` | ||
: `"${string.replace(/"/g, '\\"')}"` |
@@ -24,3 +24,3 @@ import _ from './wrap/lodash' | ||
var ensureRehearsalOccurred = (last) => { | ||
const ensureRehearsalOccurred = (last) => { | ||
if (!last) { | ||
@@ -50,3 +50,3 @@ log.error('td.verify', `\ | ||
var warnIfStubbed = (testDouble, actualArgs) => { | ||
const warnIfStubbed = (testDouble, actualArgs) => { | ||
if (_.some(stubbingsStore.for(testDouble), (stubbing) => | ||
@@ -62,3 +62,3 @@ argsMatch(stubbing.args, actualArgs, stubbing.config)) | ||
var unsatisfiedErrorMessage = (testDouble, args, config) => | ||
const unsatisfiedErrorMessage = (testDouble, args, config) => | ||
baseSummary(testDouble, args, config) + | ||
@@ -68,3 +68,3 @@ matchedInvocationSummary(testDouble, args, config) + | ||
var stringifyName = (testDouble) => { | ||
const stringifyName = (testDouble) => { | ||
const name = store.for(testDouble).name | ||
@@ -74,3 +74,3 @@ return name ? ` \`${name}\`` : '' | ||
var baseSummary = (testDouble, args, config) => | ||
const baseSummary = (testDouble, args, config) => | ||
`\ | ||
@@ -83,3 +83,3 @@ Unsatisfied verification on test double${stringifyName(testDouble)}. | ||
var invocationSummary = (testDouble, args, config) => { | ||
const invocationSummary = (testDouble, args, config) => { | ||
const calls = callsStore.for(testDouble) | ||
@@ -95,3 +95,3 @@ if (calls.length === 0) { | ||
var matchedInvocationSummary = (testDouble, args, config) => { | ||
const matchedInvocationSummary = (testDouble, args, config) => { | ||
const calls = callsStore.where(testDouble, args, config) | ||
@@ -109,6 +109,6 @@ const expectedCalls = config.times || 0 | ||
var pluralize = (x, msg) => | ||
const pluralize = (x, msg) => | ||
`${x} ${msg}${x === 1 ? '' : 's'}` | ||
var timesMessage = (config) => | ||
const timesMessage = (config) => | ||
config.times != null | ||
@@ -118,5 +118,5 @@ ? ` ${pluralize(config.times, 'time')}` | ||
var ignoreMessage = (config) => | ||
const ignoreMessage = (config) => | ||
config.ignoreExtraArgs != null | ||
? ', ignoring any additional arguments' | ||
: '' |
@@ -1,1 +0,1 @@ | ||
export default '3.16.8' | ||
export default '3.17.0' |
Sorry, the diff of this file is too big to display
461721
22
12290
586
Updatedquibble@^0.6.17