Skip to content

Support for ESM #66

@testgitdl

Description

@testgitdl

I am having problems using this library as we have an Angular 14 with ESM project and when I'm trying to make use of it I get errors. Cannot require and have to use import. So below is the error that I get
Could not find a declaration file for module 'puppeteer-to-istanbul'. 'c:/_AutomationProjects/proj/test/myproj/node_modules/puppeteer-to-istanbul/index.js' implicitly has an 'any' type. Try `npm i --save-dev @types/puppeteer-to-istanbul` if it exists or add a new declaration (.d.ts) file containing `declare module 'puppeteer-to-istanbul';`ts(7016)
Do you know to to import them in an ESM project? I tried to use it as such:

  1. import PuppeteerToIstanbul from 'puppeteer-to-istanbul';
    while having added to my angular.json in the scripts section "allowedCommonJsDependencies": [ "puppeteer-to-istanbul" ]
  2. Also tried to add a declaration file puppeteer-to-istanbul.d.ts bu then when running my tests ("test-bdd-chrome": "SET NODE_OPTIONS=--loader ts-node/esm --loader ./loader.js --no-warnings --experimental-specifier-resolution=node && node ./node_modules/@cucumber/cucumber/bin/cucumber.js --tags "@xxx"") I also get an error:
    TypeError: Unable to require file: e2e\support\puppeteer-to-istanbul.d.ts This is usually the result of a faulty configuration or import. Make sure there is a `.js`, `.json` or other executable extension with loader attached before `ts-node` available.

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