Closed esther-86 closed 9 months ago
ESM version: https://www.youtube.com/watch?v=sLW4YEl5IIA wdio/selenium-standalone-service uses ESM: https://openbase.com/js/@wdio/selenium-standalone-service (version 8)
Solution: Use "@wdio/selenium-standalone-service": "^7.30.0", "webdriverio": "^7.30.0"
I'm re-opening this because the above solution is actually just a workaround. I want to be able to use the latest wdio/selenium-standalone-service with webdriverio helper. I already tried to create a CodeceptJS project with TypeScript and set "type":"module" in package.json but I'm still getting this error (when I did something similar for webdriverio project without Codecept it was able to run)
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users//Desktop/Repositories/PoCs/codecept-ts-huong/codecept.conf.ts
require() of ES modules is not supported.
require() of /Users//Desktop/Repositories/PoCs/codecept-ts-huong/codecept.conf.ts from /Users//Desktop/Repositories/PoCs/codecept-ts-huong/node_modules/codeceptjs/lib/config.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.
Instead change the requiring code to use import(), or remove "type": "module" from /Users//Desktop/Repositories/PoCs/codecept-ts-huong/package.json.
at createErrRequireEsm (/Users//Desktop/Repositories/PoCs/codecept-ts-huong/node_modules/ts-node/dist-raw/node-internal-errors.js:46:15)
at assertScriptCanLoadAsCJSImpl (/Users//Desktop/Repositories/PoCs/codecept-ts-huong/node_modules/ts-node/dist-raw/node-internal-modules-cjs-loader.js:584:11)
at Object.require.extensions.<computed> [as .ts] (/Users//Desktop/Repositories/PoCs/codecept-ts-huong/node_modules/ts-node/src/index.ts:1610:5)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Function.Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at loadConfigFile (/Users//Desktop/Repositories/PoCs/codecept-ts-huong/node_modules/codeceptjs/lib/config.js:156:26)
at Function.load (/Users//Desktop/Repositories/PoCs/codecept-ts-huong/node_modules/codeceptjs/lib/config.js:95:16)
at module.exports.getConfig (/Users//Desktop/Repositories/PoCs/codecept-ts-huong/node_modules/codeceptjs/lib/command/utils.js:15:33)
I also took a look at these resources, and others, but am not understanding the problem, maybe because I am new to Javascript
https://stackoverflow.com/questions/69081410/error-err-require-esm-require-of-es-module-not-supported https://stackoverflow.com/questions/61401475/why-is-type-module-in-package-json-file https://codecept.discourse.group/t/selenium-standalone-service-plugin-can-not-working/236/2 https://github.com/standard-things/esm/issues/855
ESM version: https://www.youtube.com/watch?v=sLW4YEl5IIA wdio/selenium-standalone-service uses ESM: https://openbase.com/js/@wdio/selenium-standalone-service (version 8)
Solution: Use "@wdio/selenium-standalone-service": "^7.30.0", "webdriverio": "^7.30.0"
"@wdio/selenium-standalone-service": "^7.30.0",
"webdriverio": "^8.3.5"
this combination also works
This issue is stale because it has been open for 90 days with no activity.
Could this be reviewed? As of it's latest release @wdio/selenium-standalone-service
is no longer being maintained. This is because WebdriverIO has moved to eliminate driver services as of WebdriverIO 8.14.
Instructions for setting up Webdriver should probably be updated to no longer use @wdio/selenium-standalone-service
thank you @vcua-mobify once this https://github.com/codeceptjs/CodeceptJS/pull/4123 is merged, this won't be an issue anymore.
What are you trying to achieve?
I would like to run tests locally using @wdio/selenium-standalone-service
What do you get instead?
Could not load plugin wdio from module './plugin/wdio':
Details