Tests: Use a mocha file helper to always load config-tests first

Change-type: patch
This commit is contained in:
Pagan Gazzard 2020-08-11 16:04:28 +01:00
parent e7f753007f
commit 53b2b54b23
7 changed files with 6 additions and 25 deletions

View File

@ -94,6 +94,7 @@
"mocha": {
"reporter": "spec",
"require": "ts-node/register/transpile-only",
"file": "./tests/config-tests",
"timeout": 12000,
"_": "tests/**/*.spec.ts"
},

View File

@ -15,9 +15,6 @@
* limitations under the License.
*/
// tslint:disable-next-line:no-var-requires
require('../config-tests'); // required for side effects
import { expect } from 'chai';
import mock = require('mock-require');
import { promises as fs } from 'fs';

View File

@ -15,9 +15,6 @@
* limitations under the License.
*/
// tslint:disable-next-line:no-var-requires
require('../config-tests'); // required for side effects
import { expect } from 'chai';
import { promises as fs } from 'fs';
import * as path from 'path';

View File

@ -15,9 +15,6 @@
* limitations under the License.
*/
// tslint:disable-next-line:no-var-requires
require('../config-tests'); // required for side effects
import { expect } from 'chai';
import { promises as fs } from 'fs';
import * as path from 'path';

View File

@ -15,18 +15,12 @@
* limitations under the License.
*/
import { setMaxListeners } from '../build/app-common';
setMaxListeners(35); // it appears that 'nock' adds a bunch of listeners - bug?
import { EventEmitter } from 'events';
EventEmitter.defaultMaxListeners = 35; // it appears that 'nock' adds a bunch of listeners - bug?
// SL: Looks like it's not nock causing this, as have seen the problem triggered from help.spec,
// which is not using nock. Perhaps mocha/chai? (unlikely), or something in the CLI?
import { config as chaiCfg } from 'chai';
function configChai() {
chaiCfg.showDiff = true;
// enable diff comparison of large objects / arrays
chaiCfg.truncateThreshold = 0;
}
configChai();
chaiCfg.showDiff = true;
// enable diff comparison of large objects / arrays
chaiCfg.truncateThreshold = 0;

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
import './config-tests'; // required for side effects
import { execFile } from 'child_process';
import intercept = require('intercept-stdout');
import * as _ from 'lodash';

View File

@ -15,9 +15,6 @@
* limitations under the License.
*/
// tslint:disable-next-line:no-var-requires
require('./../config-tests'); // required for side effects
import { expect } from 'chai';
import * as _ from 'lodash';
import * as path from 'path';