Skip to content

travi-test/testdouble-esm-repro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

testdouble-esm-repro

this repository is a minimal reproduction of argument matching failing for imported functions when using testdouble in an ESM context

Steps to execute

  1. clone this repository
  2. run nvm use to switch your environment to the intended version of node (or nvm install if you don't already have a matching node version installed)
  3. run npm clean-install to install dependencies for the project
  4. run npm test to execute the unit tests demonstrating the problems

Highlights

  • the expectation of bar being called with baz as the only argument fails even though it is called that way in foo.js, which is the SUT for that test. This passes as expected in a non-esm environment when using td.replace rather than td.replaceEsm
  • baz has the same identity when imported into the test file and returned from the source file. this is the expected behavior
  • baz does not have the same identity when imported and returned the same way when td.replaceEsm is used in the test, even when the replaced module is unrelated.

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published