webdriverio / component-testing-examples

This repository contains several examples testing web components using WebdriverIO
https://webdriver.io
MIT License
16 stars 8 forks source link

npm run wdio - throws Must use import to load ES Module: throws #27

Open howdoilearn opened 1 month ago

howdoilearn commented 1 month ago

npm run wdio

of ES modules is not supported. require() of /Users/testuser/git/component-testing-examples/react-typescript-vite/wdio.conf.ts from /Users/testuser/git/component-testing-examples/react-typescript-vite/node_modules/@wdio/cli/node_modules/@wdio/config/build/lib/FileSystemPathService.js is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules.

christian-bromann commented 1 month ago

@howdoilearn thanks for raising an issue, mind providing a minimal reproducible example? It seems like a configuration issue.

howdoilearn commented 1 month ago

I just followed the instructions at - https://github.com/webdriverio/component-testing-examples

After I cloned the repo, I followed the instructions:-

"Switch to the desired example directory"

cd ./ I switched to - react-typescript-vite (there is no additional read me here so I followed the instructions in the main readme)

"Install dependencies" /this is fine /

npm install

Run WebdriverIO tests: This gives the "FileSystemPathService.js is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules."

npm run wdio

It is related to Typescript I am running component testing using wdio of js - for example there is no issue with the set up instructions and execution for - component-testing/svelte-example.js