Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

testdouble

Package Overview
Dependencies
Maintainers
2
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testdouble - npm Package Compare versions

Comparing version 3.16.7 to 3.16.8

2

index.d.ts

@@ -307,4 +307,4 @@ export as namespace testdouble;

*/
export function replaceEsm(path: string): Promise<{default?: any, [namedExport: string]: any}>;
export function replaceEsm(path: string, namedExportStubs?: any, defaultExportStub?: any): Promise<void>;
export function replaceEsm(path: string): Promise<{default?: any, [namedExport: string]: any}>;

@@ -311,0 +311,0 @@ /**

@@ -19,3 +19,3 @@ "use strict";

var argumentMatchesExpectation = (expectedArg, actualArg) => {
if (is_matcher_1.default(expectedArg)) {
if ((0, is_matcher_1.default)(expectedArg)) {
return matcherTestFor(expectedArg)(actualArg);

@@ -25,3 +25,3 @@ }

return lodash_1.default.isEqualWith(expectedArg, actualArg, (expectedEl, actualEl) => {
if (is_matcher_1.default(expectedEl)) {
if ((0, is_matcher_1.default)(expectedEl)) {
return matcherTestFor(expectedEl)(actualEl);

@@ -28,0 +28,0 @@ }

@@ -5,3 +5,3 @@ "use strict";

const create_1 = require("./matchers/create");
const callback = create_1.default({
const callback = (0, create_1.default)({
name: 'callback',

@@ -8,0 +8,0 @@ matches(matcherArgs, actual) {

@@ -33,5 +33,5 @@ "use strict";

if (!Object.prototype.hasOwnProperty.call(configData, key)) {
log_1.default.error('td.config', `"${key}" is not a valid configuration key (valid keys are: ${anything_1.default(lodash_1.default.keys(configData))})`);
log_1.default.error('td.config', `"${key}" is not a valid configuration key (valid keys are: ${(0, anything_1.default)(lodash_1.default.keys(configData))})`);
}
});
};

@@ -7,11 +7,11 @@ "use strict";

exports.default = (typeOrNames) => lodash_1.default.isFunction(typeOrNames)
? imitate_1.default(typeOrNames)
? (0, imitate_1.default)(typeOrNames)
: fakeConstructorFromNames(typeOrNames);
var fakeConstructorFromNames = (funcNames) => {
return lodash_1.default.tap(function_1.default('(unnamed constructor)'), (fakeConstructor) => {
return lodash_1.default.tap((0, function_1.default)('(unnamed constructor)'), (fakeConstructor) => {
fakeConstructor.prototype.toString = () => '[test double instance of constructor]';
lodash_1.default.each(funcNames, (funcName) => {
fakeConstructor.prototype[funcName] = function_1.default(`#${String(funcName)}`);
fakeConstructor.prototype[funcName] = (0, function_1.default)(`#${String(funcName)}`);
});
});
};

@@ -35,3 +35,3 @@ "use strict";

const explanations = [];
const children = proxy_safe_clone_deep_with_1.default(thing, (val, key, obj, stack) => {
const children = (0, proxy_safe_clone_deep_with_1.default)(thing, (val, key, obj, stack) => {
if (lodash_1.default.isFunction(val) && stack) {

@@ -84,3 +84,3 @@ return lodash_1.default.tap(explainFunction(val), (explanation) => {

return stubs.length > 0
? lodash_1.default.reduce(stubs, (desc, stub) => desc + `\n - when called with \`(${arguments_1.default(stub.args)})\`, then ${planFor(stub)} ${argsFor(stub)}.`, '\n\nStubbings:')
? lodash_1.default.reduce(stubs, (desc, stub) => desc + `\n - when called with \`(${(0, arguments_1.default)(stub.args)})\`, then ${planFor(stub)} ${argsFor(stub)}.`, '\n\nStubbings:')
: '';

@@ -98,4 +98,4 @@ }

switch (stub.config.plan) {
case 'thenCallback': return `\`(${arguments_1.default(stub.stubbedValues, ', ')})\``;
default: return arguments_1.default(stub.stubbedValues, ', then ', '`');
case 'thenCallback': return `\`(${(0, arguments_1.default)(stub.stubbedValues, ', ')})\``;
default: return (0, arguments_1.default)(stub.stubbedValues, ', then ', '`');
}

@@ -108,6 +108,6 @@ }

if (call.cloneArgs !== symbols_1.default.uncloneable) {
argDescription = `\`(${arguments_1.default(call.cloneArgs)})\`.`;
argDescription = `\`(${(0, arguments_1.default)(call.cloneArgs)})\`.`;
}
else {
argDescription = `\`(${arguments_1.default(call.args)})\` [Cloning argument values failed; displaying current references]`;
argDescription = `\`(${(0, arguments_1.default)(call.args)})\` [Cloning argument values failed; displaying current references]`;
}

@@ -114,0 +114,0 @@ return desc + `\n - called with ${argDescription}`;

@@ -10,3 +10,3 @@ "use strict";

return lodash_1.default.isFunction(nameOrFunc)
? imitate_1.default(nameOrFunc)
? (0, imitate_1.default)(nameOrFunc)
: createTestDoubleNamed(nameOrFunc || __optionalName);

@@ -13,0 +13,0 @@ }

@@ -10,3 +10,3 @@ "use strict";

call_log_1.default.instance.log(double, call);
return satisfy_1.default(double, call);
return (0, satisfy_1.default)(double, call);
};

@@ -13,0 +13,0 @@ testDouble.toString = double.toString.bind(double);

@@ -7,8 +7,8 @@ "use strict";

if (lodash_1.default.isFunction(nameOrFunc)) {
return create_1.default(lodash_1.default.isEmpty(nameOrFunc.name) ? null : nameOrFunc.name, nameOrFunc).fake;
return (0, create_1.default)(lodash_1.default.isEmpty(nameOrFunc.name) ? null : nameOrFunc.name, nameOrFunc).fake;
}
else {
return create_1.default(nameOrFunc, null).fake;
return (0, create_1.default)(nameOrFunc, null).fake;
}
}
exports.default = func;

@@ -11,3 +11,3 @@ "use strict";

else if (lodash_1.default.isFunction(original)) {
if (is_generator_1.default(original)) {
if ((0, is_generator_1.default)(original)) {
return original;

@@ -17,3 +17,3 @@ }

// TODO: this will become src/function/create and include parent reference instead of name joining here
return function_1.default(lodash_1.default.map(names, String).join('') || '(anonymous function)');
return (0, function_1.default)(lodash_1.default.map(names, String).join('') || '(anonymous function)');
}

@@ -20,0 +20,0 @@ }

@@ -9,8 +9,8 @@ "use strict";

return encounteredObjects.get(original);
names = initialize_names_1.default(original, names);
const target = create_imitation_1.default(original, names);
names = (0, initialize_names_1.default)(original, names);
const target = (0, create_imitation_1.default)(original, names);
encounteredObjects.set(original, target);
overwrite_children_1.default(original, target, (originalValue, name) => imitate(originalValue, names.concat(name), encounteredObjects));
(0, overwrite_children_1.default)(original, target, (originalValue, name) => imitate(originalValue, names.concat(name), encounteredObjects));
return target;
}
exports.default = imitate;

@@ -7,3 +7,3 @@ "use strict";

const props = {};
while (is_fakeable_1.default(thing) && !is_native_prototype_1.default(thing)) {
while ((0, is_fakeable_1.default)(thing) && !(0, is_native_prototype_1.default)(thing)) {
Object.getOwnPropertyNames(thing).forEach((propName) => {

@@ -10,0 +10,0 @@ if (!props[propName] && propName !== 'constructor') {

@@ -9,3 +9,3 @@ "use strict";

exports.default = (original, target, overwriteChild) => {
if (!is_fakeable_1.default(target))
if (!(0, is_fakeable_1.default)(target))
return;

@@ -16,4 +16,4 @@ if (lodash_1.default.isArray(target)) {

else {
copy_props_1.default(target, gather_props_1.default(original), (name, originalValue) => chain_prototype_1.default(original, target, name, originalValue, overwriteChild(originalValue, `.${name}`)));
(0, copy_props_1.default)(target, (0, gather_props_1.default)(original), (name, originalValue) => (0, chain_prototype_1.default)(original, target, name, originalValue, overwriteChild(originalValue, `.${name}`)));
}
};

@@ -5,3 +5,3 @@ "use strict";

const is_generator_1 = require("../is-generator");
exports.default = (thing) => !(!lodash_1.default.isObject(thing) || isBoxedType(thing) || is_generator_1.default(thing));
exports.default = (thing) => !(!lodash_1.default.isObject(thing) || isBoxedType(thing) || (0, is_generator_1.default)(thing));
const isBoxedType = (thing) => lodash_1.default.compact([

@@ -8,0 +8,0 @@ Boolean,

@@ -5,4 +5,4 @@ "use strict";

function instance(typeOrNames) {
return new (constructor_js_1.default(typeOrNames))();
return new ((0, constructor_js_1.default)(typeOrNames))();
}
exports.default = instance;

@@ -6,3 +6,3 @@ "use strict";

warn(func, msg, url) {
if (!config_1.default().ignoreWarnings && typeof console === 'object' && console.warn) {
if (!(0, config_1.default)().ignoreWarnings && typeof console === 'object' && console.warn) {
console.warn(`Warning: testdouble.js - ${func} - ${msg}${withUrl(url)}`);

@@ -12,3 +12,3 @@ }

error(func, msg, url) {
if (!config_1.default().suppressErrors) {
if (!(0, config_1.default)().suppressErrors) {
throw new Error(`Error: testdouble.js - ${func} - ${msg}${withUrl(url)}`);

@@ -15,0 +15,0 @@ }

@@ -17,3 +17,3 @@ "use strict";

function ensurePromise(level) {
if (config_1.default().promiseConstructor == null) {
if ((0, config_1.default)().promiseConstructor == null) {
log_1.default[level]('td.when', `\

@@ -20,0 +20,0 @@ ${MESSAGES[level]}

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const create_1 = require("../create");
exports.default = create_1.default({
exports.default = (0, create_1.default)({
name: 'anything',
matches() { return true; }
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const create_1 = require("../create");
exports.default = create_1.default({
exports.default = (0, create_1.default)({
name: 'argThat',

@@ -6,0 +6,0 @@ matches(matcherArgs, actual) {

@@ -6,3 +6,3 @@ "use strict";

const captor = {
capture: create_1.default({
capture: (0, create_1.default)({
name: 'captor.capture',

@@ -9,0 +9,0 @@ matches(matcherArgs, actual) {

@@ -6,3 +6,3 @@ "use strict";

const is_matcher_1 = require("../is-matcher");
exports.default = create_1.default({
exports.default = (0, create_1.default)({
name: 'contains',

@@ -35,3 +35,3 @@ matches(containings, actualArg) {

}
else if (is_matcher_1.default(containing)) {
else if ((0, is_matcher_1.default)(containing)) {
return containing.__matches(actualArg) ||

@@ -38,0 +38,0 @@ lodash_1.default.some(actualArg, containing.__matches);

@@ -6,5 +6,5 @@ "use strict";

const arguments_1 = require("../../stringify/arguments");
exports.default = create_1.default({
exports.default = (0, create_1.default)({
name(matcherArgs) {
const desc = lodash_1.default.get(matcherArgs[0], 'name') || arguments_1.default(matcherArgs);
const desc = lodash_1.default.get(matcherArgs[0], 'name') || (0, arguments_1.default)(matcherArgs);
return `isA(${desc})`;

@@ -11,0 +11,0 @@ },

@@ -5,3 +5,3 @@ "use strict";

const create_1 = require("../create");
exports.default = create_1.default({
exports.default = (0, create_1.default)({
name: 'not',

@@ -8,0 +8,0 @@ matches(matcherArgs, actual) {

@@ -21,7 +21,7 @@ "use strict";

else if (config.name != null) {
return `${config.name}(${arguments_1.default(matcherArgs)})`;
return `${config.name}(${(0, arguments_1.default)(matcherArgs)})`;
}
else {
return `[Matcher for (${arguments_1.default(matcherArgs)})]`;
return `[Matcher for (${(0, arguments_1.default)(matcherArgs)})]`;
}
};

@@ -8,3 +8,3 @@ "use strict";

lodash_1.default.each(expectedArgs, (expectedArg, i) => {
if (is_matcher_1.default(expectedArg)) {
if ((0, is_matcher_1.default)(expectedArg)) {
lodash_1.default.invoke(expectedArg, '__matches.afterSatisfaction', actualArgs[i]);

@@ -11,0 +11,0 @@ }

@@ -20,6 +20,6 @@ "use strict";

else if (lodash_1.default.isObjectLike(nameOrType)) {
return imitate_1.default(nameOrType);
return (0, imitate_1.default)(nameOrType);
}
else if (lodash_1.default.isString(nameOrType) || argCount === 0) {
return proxy_1.default(nameOrType, withDefaults(config));
return (0, proxy_1.default)(nameOrType, withDefaults(config));
}

@@ -34,3 +34,3 @@ else if (lodash_1.default.isFunction(nameOrType)) {

var createTestDoublesForFunctionNames = (names) => lodash_1.default.transform(names, (acc, funcName) => {
acc[funcName] = function_1.default(`.${String(funcName)}`);
acc[funcName] = (0, function_1.default)(`.${String(funcName)}`);
}, {});

@@ -37,0 +37,0 @@ 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.');

@@ -38,3 +38,3 @@ "use strict";

const nameWithProp = `${internalName || ''}.${String(propKey)}`;
const tdFunc = function_1.default(nameWithProp);
const tdFunc = (0, function_1.default)(nameWithProp);
const tdFuncProxy = new Proxy(tdFunc, generateHandler(nameWithProp, excludeMethods));

@@ -41,0 +41,0 @@ store_1.default.registerAlias(tdFunc, tdFuncProxy);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceEsm = void 0;
const lodash_1 = require("../wrap/lodash");

@@ -10,6 +11,6 @@ const quibble = require("quibble");

if (lodash_1.default.isString(target)) {
return module_1.default(...arguments);
return (0, module_1.default)(...arguments);
}
else {
return property_1.default(...arguments);
return (0, property_1.default)(...arguments);
}

@@ -24,4 +25,4 @@ }

// uses arguments.length to figure out what to do.
return module_1.replaceEsModule(...arguments);
return (0, module_1.replaceEsModule)(...arguments);
}
exports.replaceEsm = replaceEsm;

@@ -14,2 +14,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.replaceEsModule = void 0;
const quibble = require("quibble");

@@ -23,8 +24,8 @@ const imitate_1 = require("../../imitate");

if (typeof jest === 'object')
return jest_module_1.default(...arguments);
return (0, jest_module_1.default)(...arguments);
if (arguments.length > 1) {
return quibble(path, stub);
}
const realThing = require_actual_1.default(path);
const fakeThing = imitate_1.default(realThing, fake_name_1.default(path, realThing));
const realThing = (0, require_actual_1.default)(path);
const fakeThing = (0, imitate_1.default)(realThing, (0, fake_name_1.default)(path, realThing));
quibble(path, fakeThing);

@@ -42,3 +43,3 @@ return fakeThing;

const { modulePath, module } = await quibble.esmImportWithPath(path);
const _a = imitate_1.default(module, fake_name_1.default(path, module)), { default: fakeDefaultExport = undefined } = _a, fakeNamedExports = __rest(_a, ["default"]);
const _a = (0, imitate_1.default)(module, (0, fake_name_1.default)(path, module)), { default: fakeDefaultExport = undefined } = _a, fakeNamedExports = __rest(_a, ["default"]);
await quibble.esm(modulePath, fakeNamedExports, fakeDefaultExport);

@@ -45,0 +46,0 @@ return Object.assign({ default: fakeDefaultExport }, fakeNamedExports);

@@ -37,3 +37,3 @@ "use strict";

else {
return imitate_1.default(realThing, [property]);
return (0, imitate_1.default)(realThing, [property]);
}

@@ -45,4 +45,4 @@ };

if (realThing !== undefined && fakeType !== realType) {
log_1.default.warn('td.replace', `property "${property}" ${anything_1.default(realThing)} (${lodash_1.default.capitalize(realType)}) was replaced with ${anything_1.default(fakeThing)}, which has a different type (${lodash_1.default.capitalize(fakeType)}).`);
log_1.default.warn('td.replace', `property "${property}" ${(0, anything_1.default)(realThing)} (${lodash_1.default.capitalize(realType)}) was replaced with ${(0, anything_1.default)(fakeThing)}, which has a different type (${lodash_1.default.capitalize(fakeType)}).`);
}
};

@@ -9,6 +9,6 @@ "use strict";

case 'thenThrow': throw stubbing.currentOutcome;
case 'thenResolve': return create_promise_1.default(stubbing, true);
case 'thenReject': return create_promise_1.default(stubbing, false);
case 'thenResolve': return (0, create_promise_1.default)(stubbing, true);
case 'thenReject': return (0, create_promise_1.default)(stubbing, false);
}
}
exports.default = deliverOutcome;

@@ -7,4 +7,4 @@ "use strict";

function findLastStubbingMatch(double, call) {
return lodash_1.default.findLast(stubbing_register_1.default.instance.get(double), (stubbing) => args_match_1.default(stubbing.args, call.args, stubbing.config) && stubbing.hasTimesRemaining);
return lodash_1.default.findLast(stubbing_register_1.default.instance.get(double), (stubbing) => (0, args_match_1.default)(stubbing.args, call.args, stubbing.config) && stubbing.hasTimesRemaining);
}
exports.default = findLastStubbingMatch;

@@ -8,10 +8,10 @@ "use strict";

function satisfy(double, call) {
const stubbing = find_last_stubbing_match_1.default(double, call);
const stubbing = (0, find_last_stubbing_match_1.default)(double, call);
if (stubbing) {
stubbing.addSatisfyingCall(call);
invoke_callbacks_1.default(stubbing, call);
notify_after_satisfaction_1.default(stubbing.args, call.args);
return deliver_outcome_1.default(stubbing, call);
(0, invoke_callbacks_1.default)(stubbing, call);
(0, notify_after_satisfaction_1.default)(stubbing.args, call.args);
return (0, deliver_outcome_1.default)(stubbing, call);
}
}
exports.default = satisfy;

@@ -8,5 +8,5 @@ "use strict";

lodash_1.default.each(stubbing.args, (stubbingArg, i) => {
if (is_callback_1.default(stubbingArg)) {
if ((0, is_callback_1.default)(stubbingArg)) {
const actualCallback = call.args[i];
call_later_1.default(actualCallback, callbackArgs(stubbing, stubbingArg), stubbing.options.defer, stubbing.options.delay);
(0, call_later_1.default)(actualCallback, callbackArgs(stubbing, stubbingArg), stubbing.options.defer, stubbing.options.delay);
}

@@ -13,0 +13,0 @@ });

@@ -7,9 +7,9 @@ "use strict";

function createPromise(stubbing, willResolve) {
const Promise = config_1.default().promiseConstructor;
ensure_promise_1.default('error');
const Promise = (0, config_1.default)().promiseConstructor;
(0, ensure_promise_1.default)('error');
const value = stubbing.currentOutcome;
return new Promise((resolve, reject) => {
call_later_1.default(() => willResolve ? resolve(value) : reject(value), [value], stubbing.options.defer, stubbing.options.delay);
(0, call_later_1.default)(() => willResolve ? resolve(value) : reject(value), [value], stubbing.options.defer, stubbing.options.delay);
});
}
exports.default = createPromise;

@@ -11,3 +11,3 @@ "use strict";

log(testDouble, args, context) {
index_1.default.for(testDouble).calls.push({ args, context, cloneArgs: clone_deep_if_possible_1.default(args) });
index_1.default.for(testDouble).calls.push({ args, context, cloneArgs: (0, clone_deep_if_possible_1.default)(args) });
return callHistory.push({ testDouble, args, context });

@@ -34,3 +34,3 @@ },

const pastArgs = config.cloneArgs ? call.cloneArgs : call.args;
return args_match_1.default(args, pastArgs, config);
return (0, args_match_1.default)(args, pastArgs, config);
});

@@ -37,0 +37,0 @@ },

@@ -22,3 +22,3 @@ "use strict";

if (stubbing) {
notify_after_satisfaction_1.default(stubbing.args, actualArgs);
(0, notify_after_satisfaction_1.default)(stubbing.args, actualArgs);
return executePlan(stubbing, actualArgs, actualContext);

@@ -47,3 +47,3 @@ }

lodash_1.default.each(stubbing.args, (expectedArg, i) => {
if (is_callback_1.default(expectedArg)) {
if ((0, is_callback_1.default)(expectedArg)) {
callCallback(stubbing, actualArgs[i], callbackArgs(stubbing, expectedArg));

@@ -77,3 +77,3 @@ }

var createPromise = (stubbing, value, willResolve) => {
const Promise = config_1.default().promiseConstructor;
const Promise = (0, config_1.default)().promiseConstructor;
ensurePromise(Promise);

@@ -87,3 +87,3 @@ return new Promise((resolve, reject) => {

: lodash_1.default.last(stubbing.stubbedValues);
var isSatisfied = (stubbing, actualArgs) => args_match_1.default(stubbing.args, actualArgs, stubbing.config) &&
var isSatisfied = (stubbing, actualArgs) => (0, args_match_1.default)(stubbing.args, actualArgs, stubbing.config) &&
hasTimesRemaining(stubbing);

@@ -90,0 +90,0 @@ var hasTimesRemaining = (stubbing) => stubbing.config.times == null

@@ -10,3 +10,3 @@ "use strict";

}
else if (is_matcher_1.default(anything)) {
else if ((0, is_matcher_1.default)(anything)) {
return anything.__name;

@@ -23,3 +23,3 @@ }

transform(obj, prop, originalResult) {
if (is_matcher_1.default(obj[prop])) {
if ((0, is_matcher_1.default)(obj[prop])) {
return obj[prop].__name;

@@ -26,0 +26,0 @@ }

@@ -5,2 +5,2 @@ "use strict";

const anything_1 = require("./anything");
exports.default = (args, joiner = ', ', wrapper = '') => lodash_1.default.map(args, arg => `${wrapper}${anything_1.default(arg)}${wrapper}`).join(joiner);
exports.default = (args, joiner = ', ', wrapper = '') => lodash_1.default.map(args, arg => `${wrapper}${(0, anything_1.default)(arg)}${wrapper}`).join(joiner);

@@ -36,3 +36,3 @@ "use strict";

function ensureCloneableIfCloneArgs(last, config) {
if (config.cloneArgs && clone_deep_if_possible_1.default(last.args) === symbols_1.default.uncloneable) {
if (config.cloneArgs && (0, clone_deep_if_possible_1.default)(last.args) === symbols_1.default.uncloneable) {
return log_1.default.error('td.verify', `\

@@ -45,8 +45,8 @@ Failed to deep-clone arguments. Ensure lodash _.cloneDeep works on them

lodash_1.default.each(calls_1.default.where(testDouble, expectedArgs, config), (invocation) => {
notify_after_satisfaction_1.default(expectedArgs, invocation.args);
(0, notify_after_satisfaction_1.default)(expectedArgs, invocation.args);
});
};
var warnIfStubbed = (testDouble, actualArgs) => {
if (lodash_1.default.some(stubbings_1.default.for(testDouble), (stubbing) => args_match_1.default(stubbing.args, actualArgs, stubbing.config))) {
log_1.default.warn('td.verify', `test double${stringifyName(testDouble)} was both stubbed and verified with arguments (${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');
if (lodash_1.default.some(stubbings_1.default.for(testDouble), (stubbing) => (0, args_match_1.default)(stubbing.args, actualArgs, stubbing.config))) {
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');
}

@@ -65,3 +65,3 @@ };

Wanted:
- called with \`(${arguments_1.default(args)})\`${timesMessage(config)}${ignoreMessage(config)}.\
- called with \`(${(0, arguments_1.default)(args)})\`${timesMessage(config)}${ignoreMessage(config)}.\
`;

@@ -74,3 +74,3 @@ var invocationSummary = (testDouble, args, config) => {

else {
return lodash_1.default.reduce(calls, (desc, call) => desc + `\n - called with \`(${arguments_1.default(call.args)})\`.`, '\n\n All calls of the test double, in order were:');
return lodash_1.default.reduce(calls, (desc, call) => desc + `\n - called with \`(${(0, arguments_1.default)(call.args)})\`.`, '\n\n All calls of the test double, in order were:');
}

@@ -85,3 +85,3 @@ };

else {
return lodash_1.default.reduce(lodash_1.default.groupBy(calls, 'args'), (desc, callsMatchingArgs, args) => desc + `\n - called ${pluralize(callsMatchingArgs.length, 'time')} with \`(${arguments_1.default(callsMatchingArgs[0].args)})\`.`, `\n\n ${pluralize(calls.length, 'call')} that satisfied this verification:`);
return lodash_1.default.reduce(lodash_1.default.groupBy(calls, 'args'), (desc, callsMatchingArgs, args) => desc + `\n - called ${pluralize(callsMatchingArgs.length, 'time')} with \`(${(0, arguments_1.default)(callsMatchingArgs[0].args)})\`.`, `\n\n ${pluralize(calls.length, 'call')} that satisfied this verification:`);
}

@@ -88,0 +88,0 @@ };

@@ -9,11 +9,11 @@ "use strict";

function verify(__userInvokesDemonstrationHere__, config) {
const { double, call } = pop_demonstration_1.default();
if (did_call_occur_1.default(double, call, config)) {
notify_satisfied_matchers_1.default(double, call, config);
warn_if_also_stubbed_1.default(double, call, config);
const { double, call } = (0, pop_demonstration_1.default)();
if ((0, did_call_occur_1.default)(double, call, config)) {
(0, notify_satisfied_matchers_1.default)(double, call, config);
(0, warn_if_also_stubbed_1.default)(double, call, config);
}
else {
fail_1.default(double, call, config);
(0, fail_1.default)(double, call, config);
}
}
exports.default = verify;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = '3.16.7';
exports.default = '3.16.8';

@@ -56,3 +56,3 @@ "use strict";

function ensureCloneableIfCloneArgs(last, config) {
if (config.cloneArgs && clone_deep_if_possible_1.default(last.args) === symbols_1.default.uncloneable) {
if (config.cloneArgs && (0, clone_deep_if_possible_1.default)(last.args) === symbols_1.default.uncloneable) {
return log_1.default.error('td.when', `\

@@ -75,3 +75,3 @@ Failed to deep-clone arguments. Ensure lodash _.cloneDeep works on them

function warnIfPromiseless() {
if (config_1.default().promiseConstructor == null) {
if ((0, config_1.default)().promiseConstructor == null) {
log_1.default.warn('td.when', `\

@@ -78,0 +78,0 @@ no promise constructor is set, so this \`thenResolve\` or \`thenReject\` stubbing

@@ -23,3 +23,3 @@ "use strict";

thenResolve(...stubbedValues) {
ensure_promise_1.default('warn');
(0, ensure_promise_1.default)('warn');
completeStubbing('thenResolve', stubbedValues);

@@ -29,3 +29,3 @@ return double.fake;

thenReject(...stubbedErrors) {
ensure_promise_1.default('warn');
(0, ensure_promise_1.default)('warn');
completeStubbing('thenReject', stubbedErrors);

@@ -32,0 +32,0 @@ return double.fake;

@@ -11,6 +11,6 @@ "use strict";

const rehearsal = call_log_1.default.instance.pop();
ensure_rehearsal_1.default(rehearsal);
return chain_stubbing_1.default(rehearsal.double, (type, outcomes) => {
stubbing_register_1.default.instance.add(rehearsal.double, new stubbing_1.default(type, add_implied_callback_arg_if_necessary_1.default(type, rehearsal.call.args), outcomes, options));
(0, ensure_rehearsal_1.default)(rehearsal);
return (0, chain_stubbing_1.default)(rehearsal.double, (type, outcomes) => {
stubbing_register_1.default.instance.add(rehearsal.double, new stubbing_1.default(type, (0, add_implied_callback_arg_if_necessary_1.default)(type, rehearsal.call.args), outcomes, options));
});
};
{
"name": "testdouble",
"version": "3.16.7",
"version": "3.16.8",
"description": "A minimal test double library for TDD with JavaScript",

@@ -97,4 +97,4 @@ "homepage": "https://github.com/testdouble/testdouble.js",

"dependencies": {
"lodash": "^4.17.15",
"quibble": "^0.6.7",
"lodash": "^4.17.21",
"quibble": "^0.6.14",
"stringify-object-es5": "^2.5.0",

@@ -104,8 +104,8 @@ "theredoc": "^1.0.0"

"devDependencies": {
"@types/node": "^13.7.6",
"@typescript-eslint/eslint-plugin": "^2.21.0",
"@typescript-eslint/parser": "^2.21.0",
"browserify": "^16.5.0",
"@types/node": "^18.11.9",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"browserify": "^17.0.0",
"codeclimate-test-reporter": "^0.5.1",
"cross-conf-env": "^1.1.2",
"cross-conf-env": "^1.3.0",
"dedent": "^0.7.0",

@@ -115,13 +115,13 @@ "headerify": "^1.0.1",

"is-promise": "^4.0.0",
"mkdirp": "^1.0.3",
"mkdirp": "^1.0.4",
"npm-run-all": "^4.1.5",
"nyc": "^15.0.0",
"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"standard": "^14.3.1",
"teenytest": "^6.0.2",
"standard": "^17.0.0",
"teenytest": "^6.0.3",
"teenytest-promise": "^1.0.0",
"testdouble": "^3.12.5",
"ts-node": "^8.10.1",
"tsify": "^4.0.1",
"typescript": "^3.8.2"
"testdouble": "^3.16.7",
"ts-node": "^10.9.1",
"tsify": "^5.0.4",
"typescript": "^4.9.3"
},

@@ -128,0 +128,0 @@ "directories": {

# testdouble.js (AKA td.js)
[![Build Status](https://circleci.com/gh/testdouble/testdouble.js/tree/main.svg?style=svg)](https://circleci.com/gh/testdouble/testdouble.js/tree/main)
[![npmjs](https://img.shields.io/badge/npm-testdouble-red.svg)](https://www.npmjs.com/package/testdouble)

@@ -5,0 +4,0 @@ [![unpkg](https://img.shields.io/badge/unpkg-download-blue.svg)](https://unpkg.com/testdouble/dist/)

@@ -1,1 +0,1 @@

export default '3.16.7'
export default '3.16.8'

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc