2

I am setting up a custom reporter in WebdriverIO. This is currently my code:

let WDIOReporter = require ('@wdio/reporter');

module.exports = class HTMLReporter extends WDIOReporter {
    constructor (options) {
        super(options);
        console.log('initialized custom reporter with the following reporter options: ', options);
    }
}

When I run my program, I get the following error:

TypeError: Class extends value #<Object> is not a constructor or null at Object.<anonymous> (C:...\reporting\index.js:3:45)

This seems to be causing an error at the module.exports = class HTMLReporter extends WDIOReporter line.

How can I fix this issue? What am I doing wrong?


A few days back tried to achieve the same. Here is the way it worked for me The correct way to export is in index.js:

import {Foo} from './Foo/';
import {Bar} from './Bar/';


export { Foo };
export { Bar };

In Main.js

import {Foo} from './path-to-index.js'
4

1 回答 1

4

require ('@wdio/reporter').default改为这样做。

于 2019-02-22T09:35:22.720 回答