We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Destructuring modules to use with method replace
When I try this: const { one, two } = td.replace('../any/jsfile');
const { one, two } = td.replace('../any/jsfile');
Where jsfile has:
jsfile
one, two, };
Thrown an error like this:
⠧ TypeError: Cannot read property 'length' of undefined
node -v
npm -v
yarn --version
npm ls testdouble
yarn list testdouble
The text was updated successfully, but these errors were encountered:
Seems to work for me on latest.
File: foo.js:
foo.js
module.exports = { one: function () { return 1 }, two: function () { return 2 } }
File: bar.js
bar.js
const td = require('testdouble') const { one, two } = td.replace('./foo') console.log('one', one) console.log('two', two)
Running node bar.js yields output:
node bar.js
one [test double for "./foo: .one"] two [test double for "./foo: .two"]
Closing without a reproduction
Sorry, something went wrong.
No branches or pull requests
Description
Destructuring modules to use with method replace
Issue
When I try this:
const { one, two } = td.replace('../any/jsfile');
Where
jsfile
has:Thrown an error like this:
Environment
node -v
output: v10.16.0npm -v
(oryarn --version
) output: 6.10.1npm ls testdouble
(oryarn list testdouble
) version: testdouble@3.12.2The text was updated successfully, but these errors were encountered: