You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the testdouble repo, I created examples/node-esm/test/lib/numbers-only-test.mjs with the following code.
importassertfrom'assert'importmochafrom'mocha'import*astdfrom'testdouble'mocha.describe('numbers-only',function(){mocha.it.only('goes boom',asyncfunction(){constisNumber=td.replace('is-number');constnumbersOnly=awaitimport('../../lib/numbers-only.mjs')td.when(isNumber('a string')).thenReturn(true)// tee-hee, this is sillyconstresult=numbersOnly.default('a string')assert.equal(result,true)});});
Based on what I read from the docs, I would expect this code to pass, but whenever ../../lib/numbers-only.mjs is loaded, the real is-number is resolved instead of the faked module.
Issue
the real module is being loaded instead of the fake.
Environment
node -v 20.1.0 or 22.3.0:
npm -v (or yarn --version) output: 10.5.2 or 10.8.1
npm ls testdouble (or yarn list testdouble) version: from the example
Description
In the testdouble repo, I created
examples/node-esm/test/lib/numbers-only-test.mjs
with the following code.Based on what I read from the docs, I would expect this code to pass, but whenever
../../lib/numbers-only.mjs
is loaded, the real is-number is resolved instead of the faked module.Issue
the real module is being loaded instead of the fake.
Environment
node -v
20.1.0 or 22.3.0:npm -v
(oryarn --version
) output: 10.5.2 or 10.8.1npm ls testdouble
(oryarn list testdouble
) version: from the exampleFailing Test
See above
Example Repo
See above
Runkit Notebook
var td = require('testdouble')
at the topCode-fenced Examples
The text was updated successfully, but these errors were encountered: