- Linting (ESLint): Make path dynamic in preparation for possible move to own library and to avoid complaints when mochawesome.json not yet built

This commit is contained in:
Brett Zamir
2020-04-03 07:56:59 +08:00
parent 27ff9c3240
commit 3c10411594
2 changed files with 4 additions and 8 deletions

View File

@@ -20,6 +20,8 @@ const reporterFile = process.argv[2]
? process.argv[2].replace(/^--/u, '')
: 'spec';
const path = '../mochawesome.json';
// eslint-disable-next-line import/no-dynamic-require
const MochaReporter = require(`mocha/lib/reporters/${reporterFile}.js`);
const Suite = require('mocha/lib/suite.js');
@@ -36,7 +38,8 @@ const {constants: {
EVENT_TEST_PENDING
}} = require('mocha/lib/runner.js');
const {results, stats} = require('../mochawesome.json');
// eslint-disable-next-line import/no-dynamic-require
const {results, stats} = require(path);
const runner = new Runner(
new Suite('', null, true)