-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests failing with 'TypeError: Cannot read property 'isPrototypeOf' of null' after updating 3.2.0 #270
Comments
No this is almost certainly a bug introduced in 3.2.0. Thanks for reporting it, I'll look into it tomorrow
… On Jun 25, 2017, at 19:37, kizaonline ***@***.***> wrote:
I'm attempting to update to 3.2.0, but the following td.replace is now failing, has there been a change to how td.replace should be used?
const td = require('testdouble')
test.only('Should succeed when passed valid input', (t) => {
const aws = td.replace('aws-sdk').S3
...
Stack trace is:
TypeError: Cannot read property 'isPrototypeOf' of null
(node:70949) DeprecationWarning: crypto.createCredentials is deprecated. Use tls.createSecureContext instead.
(node:70949) DeprecationWarning: crypto.Credentials is deprecated. Use tls.SecureContext instead.
at isNativePrototype (/apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/gather-props.js:30:41)
at exports.default (/apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/gather-props.js:17:11)
at exports.default (/apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/index.js:37:64)
at imitate (/apps/blob-uploader/node_modules/testdouble/lib/imitate/index.js:33:35)
at /apps/blob-uploader/node_modules/testdouble/lib/imitate/index.js:34:12
at /apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/index.js:38:83
at newValue (/apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/copy-props.js:39:20)
at /apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/copy-props.js:24:16
at /apps/blob-uploader/node_modules/lodash/transform.js:60:12
at /apps/blob-uploader/node_modules/lodash/_createBaseFor.js:17:11
at baseForOwn (/apps/blob-uploader/node_modules/lodash/_baseForOwn.js:13:20)
―
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Fixed by 737df04 Please keep in mind that testdouble.js is not intended for replacing third-party APIs like you're doing. Also, 3.2 performs a deep-replacement, and the aws-sdk module is absolutely massive. Each time you replace it, it'll probably take 1-2 seconds. I strongly advise you to create a wrapper around the third-party dependency and then wrap that instead. More reading on this here: Don't mock what you don't own |
Landed in 3.2.1 |
I'm attempting to update to 3.2.0, but the following td.replace is now failing, has there been a change to how td.replace should be used?
const td = require('testdouble')
test.only('Should succeed when passed valid input', (t) => {
const aws = td.replace('aws-sdk').S3
...
Stack trace is:
TypeError: Cannot read property 'isPrototypeOf' of null
(node:70949) DeprecationWarning: crypto.createCredentials is deprecated. Use tls.createSecureContext instead.
(node:70949) DeprecationWarning: crypto.Credentials is deprecated. Use tls.SecureContext instead.
at isNativePrototype (/apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/gather-props.js:30:41)
at exports.default (/apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/gather-props.js:17:11)
at exports.default (/apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/index.js:37:64)
at imitate (/apps/blob-uploader/node_modules/testdouble/lib/imitate/index.js:33:35)
at /apps/blob-uploader/node_modules/testdouble/lib/imitate/index.js:34:12
at /apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/index.js:38:83
at newValue (/apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/copy-props.js:39:20)
at /apps/blob-uploader/node_modules/testdouble/lib/imitate/overwrite-children/copy-props.js:24:16
at /apps/blob-uploader/node_modules/lodash/transform.js:60:12
at /apps/blob-uploader/node_modules/lodash/_createBaseFor.js:17:11
at baseForOwn (/apps/blob-uploader/node_modules/lodash/_baseForOwn.js:13:20)
The text was updated successfully, but these errors were encountered: