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
{{ message }}
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.
Thats it, now when I run the test I get the following error:
$> yarn test
yarn run v1.21.1
$ stencil test --spec --e2e
[49:05.0] @stencil/core v1.8.6 🚚
[49:05.1] testing e2e and spec files
[49:05.1] build, error, dev mode, started ...
[49:05.2] transpile started ...
[49:05.2] transpile finished in 5 ms
[49:05.2] copy started ...
[49:05.2] generate styles started ...
[49:05.2] bundling components started ...
[49:05.3] generate styles finished in 52 ms
[49:06.0] copy finished (0 files) in 749 ms
[49:06.0] bundling components finished in 744 ms
[49:06.0] build finished in 908 ms
[49:06.1] jest args: --e2e --spec --max-workers=16
PASS src/utils/utils.spec.ts
FAIL src/components/my-component/my-component.spec.ts
● Test suite failed to run
Cannot find module '../esm/index.js' from 'index.js'
However, Jest was able to find:
'./my-component.css'
'./my-component.spec.ts'
'./my-component.tsx'
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['ts', 'tsx', 'js', 'jsx', 'json'].
See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:259:17)
at Object.<anonymous> (node_modules/@stencil/redux/dist/index.js:2:18)
Test Suites: 1 failed, 1 passed, 2 total
Tests: 4 passed, 4 total
Snapshots: 0 total
Time: 0.677s, estimated 1s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
If I remove import '@stencil/redux'; from my-component it all works again like a charm
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/[email protected], 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');
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
The text was updated successfully, but these errors were encountered: