Skip to content

Jest testing with stencil-hooks implementation #9

@tannerjt

Description

Attempting to run spec tests with components using stencil-hooks throws an error SyntaxError: Unexpected token 'export' because haunted library uses ESM export.

Although this isn't necessarily an issue directly related to stencil-hooks, I am curious if you've come across/solved this issue.

node_modules/haunted/lib/haunted.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export { html, render, component, createContext, virtual } from './lit-haunted.js';
                                                                                             ^^^^^^
SyntaxError: Unexpected token 'export'

  at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
  at Object.<anonymous> (node_modules/@saasquatch/stencil-hooks/build/stencil-hooks.js:1:98)

General recommendation is to modify transformIgnorePatterns for testing config, but I wasn't able to resolve using that approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions