webdriverio / webdriverio/expect-webdriverio
CJS Support
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 86
- Forks
- 61
- Avg merge
- 19h 12m
- Merged PRs (30d)
- 15
Description
If to follow official documentation (https://webdriver.io/docs/api/expect-webdriverio/#default-options) and try to set custom matcher options on before hook, then ERR_REQUIRE_ESM happens on the next line:
import { setOptions } from 'expect-webdriverio'
Error:
ERROR @wdio/config:ConfigParser: Failed loading configuration file: file://***/wdio.conf.js: require() of ES Module /Users/***/node_modules/expect-webdriverio/lib/index.js from /Users/***/wdio.conf.js not supported.
Instead change the require of index.js in /Users/***/wdio.conf.js to a dynamic import() which is available in all CommonJS modules.
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/***/node_modules/expect-webdriverio/lib/index.js from /Users/***/wdio.conf.js not supported.
Instead change the require of index.js in /Users/***/wdio.conf.js to a dynamic import() which is available in all CommonJS modules.
ENV: MacOS Ventura 13.1
Node version: 19.3.0
NPX version: 9.2.0
package.json:
{
"dependencies": {
"@babel/cli": "^7.20.7",
"@babel/core": "^7.20.7",
"@babel/preset-env": "^7.20.2",
"@babel/register": "^7.18.9",
"@wdio/allure-reporter": "^8.0.13",
"@wdio/cli": "^8.0.13",
"@wdio/concise-reporter": "^8.3.0",
"@wdio/local-runner": "^8.0.13",
"@wdio/mocha-framework": "^8.0.13",
"@wdio/spec-reporter": "^8.0.13",
"chromedriver": "^108.0.0",
"csv-parse": "^5.3.3",
"fs": "^0.0.1-security",
"fs-extra": "^11.1.0",
"jest-matcher-utils": "^29.4.1",
"wdio-chromedriver-service": "^8.0.1",
"wdio-wait-for": "^3.0.1"
},
"scripts": {
"wdio": "wdio run ./wdio.conf.js"
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the documented setOptions import from a CommonJS wdio.conf.js, then inspect the package entry point at expect-webdriverio/lib/index.js and the configuration-loading path. Compare the package.json module settings with the example in the linked documentation. Done means the documented configuration works without ERR_REQUIRE_ESM.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100