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.
{
"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"
}
}
If to follow official documentation (https://webdriver.io/docs/api/expect-webdriverio/#default-options) and try to set custom matcher options on
beforehook, thenERR_REQUIRE_ESMhappens on the next line:import { setOptions } from 'expect-webdriverio'Error:
ENV: MacOS Ventura 13.1
Node version: 19.3.0
NPX version: 9.2.0
package.json: