webdriverio-community / wdio-html-reporter

Fork of wdio-html-format-reporter
MIT License
18 stars 27 forks source link

wdio.conf.js need to be transpiled for wdio-html-reporter? #11

Closed bedoro closed 5 years ago

bedoro commented 5 years ago

Hello, I would like to use the HTML report and have added the reporter library as it is descibed in the docs:

import { ReportAggregator, HtmlReporter} from '@rpii/wdio-html-reporter' ;

When I run wdio wdioconf.js now, I get this error:

wdio wdio.conf.js

2019-08-26T15:00:29.378Z ERROR @wdio/config:ConfigParser: Failed loading configuration file: wdio.conf.js: Unexpected token {
wdio.conf.js:3
import { ReportAggregator, HtmlReporter} from '@rpii/wdio-html-reporter' ;
       ^

SyntaxError: Unexpected token {
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)

I understand what the error is telling me. But since the html-reporter is the only reason I need to transpile the config file, I'd like to hear the "best" way to do this from the authors of this plugin.

Surely, you guys should have had the same problem. :)

rpii commented 5 years ago

the plugin is transpiledand release with transpiled code.. if you use the legacy javascript syntax it will work fine. I dont have a sample of it at this location, but you could dig it out of some of the user comments in github.

On Mon, Aug 26, 2019 at 8:05 AM bedoro notifications@github.com wrote:

Hello, I would like to use the HTML report and have added the reporter library as it is descibed in the docs:

import { ReportAggregator, HtmlReporter} from '@rpii/wdio-html-reporter' ;

When I run wdio wdioconf.js now, I get this error:

wdio wdio.conf.js

2019-08-26T15:00:29.378Z ERROR @wdio/config:ConfigParser: Failed loading configuration file: wdio.conf.js: Unexpected token { wdio.conf.js:3 import { ReportAggregator, HtmlReporter} from '@rpii/wdio-html-reporter' ; ^

SyntaxError: Unexpected token { at new Script (vm.js:79:7) at createScript (vm.js:251:10) at Object.runInThisContext (vm.js:303:10) at Module._compile (internal/modules/cjs/loader.js:657:28) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18)

I understand what the error is telling me. But since the html-reporter is the only reason I need to transpile the config file, I'd like to hear the "best" way to do this from the authors of this plugin.

Surely, you guys should have had the same problem. :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rpii/wdio-html-reporter/issues/11?email_source=notifications&email_token=AEABIEJWON3LLXKBTMF3QBLQGPWINA5CNFSM4IPQUOT2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HHM34BA, or mute the thread https://github.com/notifications/unsubscribe-auth/AEABIEORIAZLTZL7JWFW3CDQGPWINANCNFSM4IPQUOTQ .

msyrus commented 5 years ago

An alternative import syntax could be

const { ReportAggregator, HtmlReporter } = require('@rpii/wdio-html-reporter') ;
rpii commented 5 years ago

thanks