Skip to content

Commit 17039b3

Browse files
committed
2.1.2
1 parent 37fc578 commit 17039b3

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

dist/testdouble.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
2+
33
*
44
* A minimal test double library for TDD with JavaScript
55
*
@@ -9358,10 +9358,12 @@ var fakeObject = function fakeObject(nameOrType, config) {
93589358
return createTestDoublesForPlainObject(nameOrType);
93599359
} else if (_lodashWrap2.default.isArray(nameOrType)) {
93609360
return createTestDoublesForFunctionNames(nameOrType);
9361+
} else if (_lodashWrap2.default.isString(nameOrType) || nameOrType === undefined) {
9362+
return createTestDoubleViaProxy(nameOrType, withDefaults(config));
93619363
} else if (_lodashWrap2.default.isFunction(nameOrType)) {
9362-
return ensureFunctionIsNotPassed();
9364+
ensureFunctionIsNotPassed();
93639365
} else {
9364-
return createTestDoubleViaProxy(nameOrType, withDefaults(config));
9366+
ensureOtherGarbageIsNotPassed();
93659367
}
93669368
};
93679369

@@ -9396,6 +9398,14 @@ var ensureProxySupport = function ensureProxySupport(name) {
93969398
}
93979399
};
93989400

9401+
var ensureFunctionIsNotPassed = function ensureFunctionIsNotPassed() {
9402+
return _log2.default.error('td.object', 'Functions are not valid arguments to `td.object` (as of [email protected]). Please use `td.function()` or `td.constructor()` instead for creating fake functions.');
9403+
};
9404+
9405+
var ensureOtherGarbageIsNotPassed = function ensureOtherGarbageIsNotPassed() {
9406+
return _log2.default.error('td.object', 'To create a fake object with td.object(), pass it a plain object that contains\nfunctions, an array of function names, or (if your runtime supports ES Proxy\nobjects) a string name.\n\nIf you passed td.object an instance of a custom type, consider passing the\ntype\'s constructor to `td.constructor()` instead.\n');
9407+
};
9408+
93999409
var withDefaults = function withDefaults(config) {
94009410
return _lodashWrap2.default.extend({}, DEFAULT_OPTIONS, config);
94019411
};
@@ -9411,10 +9421,6 @@ var nameOf = function nameOf(nameOrType) {
94119421
return _lodashWrap2.default.isString(nameOrType) ? nameOrType : '';
94129422
};
94139423

9414-
var ensureFunctionIsNotPassed = function ensureFunctionIsNotPassed() {
9415-
return _log2.default.error('td.object', 'Functions are not valid arguments to `td.object` (as of [email protected]). Please use `td.function()` or `td.constructor()` instead for creating fake functions.');
9416-
};
9417-
94189424
},{"./constructor":259,"./function":261,"./log":262,"./replace/is-constructor":276,"./util/copy-properties":286,"./util/lodash-wrap":288}],274:[function(require,module,exports){
94199425
'use strict';
94209426

@@ -10433,7 +10439,7 @@ var ignoreMessage = function ignoreMessage(config) {
1043310439
Object.defineProperty(exports, "__esModule", {
1043410440
value: true
1043510441
});
10436-
exports.default = '2.1.1';
10442+
exports.default = '2.1.2';
1043710443

1043810444
},{}],291:[function(require,module,exports){
1043910445
'use strict';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "testdouble",
3-
"version": "2.1.1",
3+
"version": "2.1.2",
44
"description": "A minimal test double library for TDD with JavaScript",
55
"homepage": "https://github.com/testdouble/testdouble.js",
66
"author": {

src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default '2.1.1'
1+
export default '2.1.2'

0 commit comments

Comments
 (0)