-
Notifications
You must be signed in to change notification settings - Fork 26
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
wdio-html-reporter is not working with WDIO version 8 #92
Comments
Thanks for the detailed analysis. I will look into upgrading this.
Rich
…On Fri, Dec 30, 2022 at 6:45 AM Andrii Lysenko ***@***.***> wrote:
On 2022-12-01 version 8 of WebdriverIO was released.
One of the braking changes
<https://github.com/webdriverio/webdriverio/blob/main/CHANGELOG.md#v800-2022-12-01>
is *Transition code base from CommonJS to ESM*
It means all modules of wdio 8 are now fully ESM and use ESM exports.
wdio-html-reporter still uses require() imports, which causes problem as
far as I understand.
*Steps to reproduce:*
1. Create a fresh wdio v8 project, with all defaults.
npm init wdio .
2. Install latest html reporter
npm i wdio-html-nice-reporter --save-dev
3. Add reporter to wdio config.
reporters: ['spec', 'html-nice']
4. Import from 'wdio-html-nice-reporter'
import {ReportAggregator} from 'wdio-html-nice-reporter';
5. Run sample test
npm run wdio
*Fragment of wdio.conf.ts:*
import type { Options } from ***@***.***/types'
import {ReportAggregator} from 'wdio-html-nice-reporter';
export const config: Options.Testrunner = {
runner: 'local',
autoCompileOpts: {
tsNodeOpts: {
project: './tsconfig.json'
}
},
specs: [
'./test/specs/**/*.ts'
],
reporters: ['html-nice'],
*Result:*
[0-0] 2022-12-30T13:17:04.411Z ERROR @wdio/local-runner: Failed launching test session: Error: Couldn't initialise "wdio-html-nice-reporter".
[0-0] Error [ERR_REQUIRE_ESM]: require() of ES Module ***@***.***\reporter\build\index.js from <path_to_project>\node_modules\wdio-html-nice-reporter\lib\htmlReporter.js not supported.
[0-0] Instead change the require of index.js in <path_to_project>\node_modules\wdio-html-nice-reporter\lib\htmlReporter.js to a dynamic import() which is available in all CommonJS modules.
[0-0] at require.extensions.<computed> [as .js] (<path_to_project>\node_modules\ts-node\dist\index.js:851:20)
[0-0] at Object.<anonymous> (<path_to_project>\node_modules\wdio-html-nice-reporter\lib\htmlReporter.js:6:36)
[0-0] at require.extensions.<computed> [as .js] (<path_to_project>\node_modules\ts-node\dist\index.js:851:20)
[0-0] at Object.<anonymous> (<path_to_project>\node_modules\wdio-html-nice-reporter\lib\index.js:7:40)
[0-0] at require.extensions.<computed> [as .js] (<path_to_project>\node_modules\ts-node\dist\index.js:851:20)
[0-0] at safeImport ***@***.***/utils/build/utils.js:210:15)
[0-0] at async initialisePlugin ***@***.***/utils/build/initialisePlugin.js:32:20)
[0-0] at async BaseReporter.initReporters ***@***.***/runner/build/reporter.js:23:27)
[0-0] at async Runner.run ***@***.***/runner/build/index.js:68:9)
[0-0] FAILED
*What happens as I understand:*
Test project (which is ESM module) imports 'wdio-html-nice-reporter'
(which is CommonJS), that is fine.
'wdio-html-nice-reporter' tries to import @wdio <https://github.com/wdio>\reporter
(which is ESM module) in CommonJS way (require() ).
This makes execution failed.
*package.json:*
{
"name": "my-new-project",
"type": "module",
"devDependencies": {
***@***.***/cli": "^8.0.15",
***@***.***/local-runner": "^8.0.15",
***@***.***/mocha-framework": "^8.0.14",
***@***.***/spec-reporter": "^8.0.14",
"i": "^0.3.7",
"npm": "^9.2.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.4",
"wdio-html-nice-reporter": "^8.0.6",
"wdio-wait-for": "^3.0.1"
},
"scripts": {
"wdio": "wdio run ./wdio.conf.ts"
}
}
node v19.2.0
npm v 9.2.0
Latest version of 'wdio-html-nice-reporter' 8.0.6 was released a month
before wdio 8.
To support wdio v8, 'wdio-html-nice-reporter' also has to become fully ESM.
—
Reply to this email directly, view it on GitHub
<https://github.com/rpii/wdio-html-reporter/issues/92>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEABIEIZN7JSJTYV6Y5UFSDWP3YKJANCNFSM6AAAAAATM57TEM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I have a beta version 8.1.0-beta2 posted in NPM that should work for you.
Please try it and let me know
Rich
…On Fri, Dec 30, 2022 at 9:32 AM Rich Peters ***@***.***> wrote:
Thanks for the detailed analysis. I will look into upgrading this.
Rich
On Fri, Dec 30, 2022 at 6:45 AM Andrii Lysenko ***@***.***>
wrote:
> On 2022-12-01 version 8 of WebdriverIO was released.
> One of the braking changes
> <https://github.com/webdriverio/webdriverio/blob/main/CHANGELOG.md#v800-2022-12-01>
> is *Transition code base from CommonJS to ESM*
> It means all modules of wdio 8 are now fully ESM and use ESM exports.
> wdio-html-reporter still uses require() imports, which causes problem as
> far as I understand.
>
> *Steps to reproduce:*
>
> 1. Create a fresh wdio v8 project, with all defaults.
> npm init wdio .
> 2. Install latest html reporter
> npm i wdio-html-nice-reporter --save-dev
> 3. Add reporter to wdio config.
> reporters: ['spec', 'html-nice']
> 4. Import from 'wdio-html-nice-reporter'
> import {ReportAggregator} from 'wdio-html-nice-reporter';
> 5. Run sample test
> npm run wdio
>
> *Fragment of wdio.conf.ts:*
>
> import type { Options } from ***@***.***/types'
> import {ReportAggregator} from 'wdio-html-nice-reporter';
>
> export const config: Options.Testrunner = {
>
> runner: 'local',
> autoCompileOpts: {
> tsNodeOpts: {
> project: './tsconfig.json'
> }
> },
>
> specs: [
> './test/specs/**/*.ts'
> ],
>
> reporters: ['html-nice'],
>
> *Result:*
>
> [0-0] 2022-12-30T13:17:04.411Z ERROR @wdio/local-runner: Failed launching test session: Error: Couldn't initialise "wdio-html-nice-reporter".
> [0-0] Error [ERR_REQUIRE_ESM]: require() of ES Module ***@***.***\reporter\build\index.js from <path_to_project>\node_modules\wdio-html-nice-reporter\lib\htmlReporter.js not supported.
> [0-0] Instead change the require of index.js in <path_to_project>\node_modules\wdio-html-nice-reporter\lib\htmlReporter.js to a dynamic import() which is available in all CommonJS modules.
> [0-0] at require.extensions.<computed> [as .js] (<path_to_project>\node_modules\ts-node\dist\index.js:851:20)
> [0-0] at Object.<anonymous> (<path_to_project>\node_modules\wdio-html-nice-reporter\lib\htmlReporter.js:6:36)
> [0-0] at require.extensions.<computed> [as .js] (<path_to_project>\node_modules\ts-node\dist\index.js:851:20)
> [0-0] at Object.<anonymous> (<path_to_project>\node_modules\wdio-html-nice-reporter\lib\index.js:7:40)
> [0-0] at require.extensions.<computed> [as .js] (<path_to_project>\node_modules\ts-node\dist\index.js:851:20)
> [0-0] at safeImport ***@***.***/utils/build/utils.js:210:15)
> [0-0] at async initialisePlugin ***@***.***/utils/build/initialisePlugin.js:32:20)
> [0-0] at async BaseReporter.initReporters ***@***.***/runner/build/reporter.js:23:27)
> [0-0] at async Runner.run ***@***.***/runner/build/index.js:68:9)
> [0-0] FAILED
>
> *What happens as I understand:*
> Test project (which is ESM module) imports 'wdio-html-nice-reporter'
> (which is CommonJS), that is fine.
> 'wdio-html-nice-reporter' tries to import @wdio <https://github.com/wdio>\reporter
> (which is ESM module) in CommonJS way (require() ).
> This makes execution failed.
>
> *package.json:*
>
> {
> "name": "my-new-project",
> "type": "module",
> "devDependencies": {
> ***@***.***/cli": "^8.0.15",
> ***@***.***/local-runner": "^8.0.15",
> ***@***.***/mocha-framework": "^8.0.14",
> ***@***.***/spec-reporter": "^8.0.14",
> "i": "^0.3.7",
> "npm": "^9.2.0",
> "ts-node": "^10.9.1",
> "typescript": "^4.9.4",
> "wdio-html-nice-reporter": "^8.0.6",
> "wdio-wait-for": "^3.0.1"
> },
> "scripts": {
> "wdio": "wdio run ./wdio.conf.ts"
> }
> }
>
> node v19.2.0
> npm v 9.2.0
>
> Latest version of 'wdio-html-nice-reporter' 8.0.6 was released a month
> before wdio 8.
> To support wdio v8, 'wdio-html-nice-reporter' also has to become fully
> ESM.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/rpii/wdio-html-reporter/issues/92>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AEABIEIZN7JSJTYV6Y5UFSDWP3YKJANCNFSM6AAAAAATM57TEM>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
@rpii 8.1.0-beta2 fixed the issue |
I still get the same error even with the beta release when I try to I import and create a new |
Can confirm I have the same issue, is there a workaround for this? |
After upgrading the version I am facing the issue: https://github.com/rpii/wdio-html-reporter/issues/100. Anyone has any workaround? StackTrace: 2023-08-03T08:36:21.912Z ERROR @wdio/config:ConfigParser: Failed loading configuration file: file:///Users/aaggarwal/Documents/Sumo-Repo/sumo-ui-test/UIE2ETests/wdio.conf.ts: ReportEvents is not a constructor |
On 2022-12-01 version 8 of WebdriverIO was released.
One of the braking changes is Transition code base from CommonJS to ESM
It means all modules of wdio 8 are now fully ESM and use ESM exports.
wdio-html-reporter still uses require() imports, which causes problem as far as I understand.
Steps to reproduce:
npm init wdio .
npm i wdio-html-nice-reporter --save-dev
reporters: ['spec', 'html-nice']
import {ReportAggregator} from 'wdio-html-nice-reporter';
npm run wdio
Fragment of wdio.conf.ts:
Result:
What happens as I understand:
Test project (which is ESM module) imports 'wdio-html-nice-reporter' (which is CommonJS), that is fine.
'wdio-html-nice-reporter' tries to import @wdio\reporter (which is ESM module) in CommonJS way (require() ).
This makes execution failed.
package.json:
node v19.2.0
npm v 9.2.0
Latest version of 'wdio-html-nice-reporter' 8.0.6 was released a month before wdio 8.
To support wdio v8, 'wdio-html-nice-reporter' also has to become fully ESM.
The text was updated successfully, but these errors were encountered: