Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ESM #66

Open
testgitdl opened this issue Nov 17, 2022 · 0 comments
Open

Support for ESM #66

testgitdl opened this issue Nov 17, 2022 · 0 comments

Comments

@testgitdl
Copy link

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant