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
I don't have any solutions here. But I might be able to point in the right direction. I assume you're running your tests in the browser via Karma? And that you're trying to use td.replaceEsm?
require('module') is breaking because it's trying to require the built-in Node.js module, probably because you're in a browser environment. From the replaceEsm docs, I think it pretty much relies on running within Node.js.
It'd be pretty easy to resolve that issue within can-register-loader.js by wrapping in a try/catch. But then you'll have other issues, since it looks like quibble (what testdouble.js uses for module mocking) also depends on core Node.js modules.
The short answer is that you'll probably be happier if you don't try to use replaceEsm in the browser. And probably only use replace to replace properties, not modules.
I have an angular app, and
testdouble
in mydevDependencies
of my package file. When I try to run my angular test suite, I am getting:./node_modules/testdouble/lib/can-register-loader.js:1:15-32 - Error: Module not found: Error: Can't resolve 'module' in '/path/to/project/node_modules/testdouble/lib'
literally
require('module');
is breaking...I am wondering why this isn't an internal dependency of testdouble?
The text was updated successfully, but these errors were encountered: