diff --git a/package.json b/package.json index 30144b19..7698bf68 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "mocha": { "reporter": "spec", "require": "ts-node/register/transpile-only", + "file": "./tests/config-tests", "timeout": 12000, "_": "tests/**/*.spec.ts" }, diff --git a/tests/commands/build.spec.ts b/tests/commands/build.spec.ts index 2cd31520..ec6c0d04 100644 --- a/tests/commands/build.spec.ts +++ b/tests/commands/build.spec.ts @@ -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'; diff --git a/tests/commands/deploy.spec.ts b/tests/commands/deploy.spec.ts index 1b997460..4da394c3 100644 --- a/tests/commands/deploy.spec.ts +++ b/tests/commands/deploy.spec.ts @@ -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'; diff --git a/tests/commands/push.spec.ts b/tests/commands/push.spec.ts index 1e294532..6b5a678d 100644 --- a/tests/commands/push.spec.ts +++ b/tests/commands/push.spec.ts @@ -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'; diff --git a/tests/config-tests.ts b/tests/config-tests.ts index cb31e7c8..1d7cce7e 100644 --- a/tests/config-tests.ts +++ b/tests/config-tests.ts @@ -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; diff --git a/tests/helpers.ts b/tests/helpers.ts index b289e977..4fbad73f 100644 --- a/tests/helpers.ts +++ b/tests/helpers.ts @@ -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'; diff --git a/tests/utils/tarDirectory.spec.ts b/tests/utils/tarDirectory.spec.ts index 2775cf69..a6e3b3f6 100644 --- a/tests/utils/tarDirectory.spec.ts +++ b/tests/utils/tarDirectory.spec.ts @@ -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';