Skip to content

johncrim/repro-stencil-jest

Repository files navigation

Stencil + Jest bug Reproduction

To reproduce:

git clone git@github.com:johncrim/repro-stencil-jest.git
npm install
npm run jest

Yields this error:

    C:\src\github\johncrim\repro-stencil-jest\libs\util\util.mjs:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { Observable, NEVER } from 'rxjs';
                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      1 | import { Component, Prop, h, Element } from '@stencil/core';
      2 | import { format } from '../../utils/utils';
    > 3 | import { resizeObservable } from '../../../libs/util/util';
        | ^
      4 | import { Subscription } from 'rxjs';
      5 |
      6 | @Component({

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1728:14)
      at Object.<anonymous> (src/components/my-component/my-component.tsx:3:1)

To fix, downgrade to @stencil/core version 2.13.0 :

npm add @stencil/core@2.13.0
# Clear jest cache
npm run jest -- --clear-cache
npm run jest

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published