Open scaljeri opened 4 years ago
I changed the import in app root and it works fine.
import '@stencil/redux';
to
import "@stencil/redux/dist/esm/index";
The reason below: When you run the tests using @stencil/redux@0.1.2, on the resolve module process, jest uses @stencil\redux\dist\index.js and in this file the index.js relative path is not right. Maybe it's a bug.
Inside @stencil\redux\dist\index.js has a WRONG path:
// stencilredux: CommonJS Main
module.exports = require('../esm/index.js');
And the RIGHT path should be:
// stencilredux: CommonJS Main
module.exports = require('./esm/index.js');
Alternatively adding a moduleNameMapper
config for jest did work for me too:
moduleNameMapper: {
'@stencil/redux': '@stencil/redux/dist/esm/index',
},
I have this issue that when I try to unit test my component I get errors when that component imports
@stencil/redux
To create this test project I just did
I installed
redux
and@stencil/redux
so mypackage.json
looks likeThis is what
my-component.tsx
looks like:And the
my-component.spec.ts
fileThats it, now when I run the test I get the following error:
If I remove
import '@stencil/redux';
frommy-component
it all works again like a charmThis error show similarities with this issue