mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-05-02 17:13:05 +00:00
commit
71ff73c641
13
package.json
13
package.json
@ -59,11 +59,11 @@
|
|||||||
"release": "ts-node --transpile-only automation/run.ts release",
|
"release": "ts-node --transpile-only automation/run.ts release",
|
||||||
"pretest": "npm run build",
|
"pretest": "npm run build",
|
||||||
"test": "npm run test:source && npm run test:standalone",
|
"test": "npm run test:source && npm run test:standalone",
|
||||||
"test:source": "cross-env BALENA_CLI_TEST_TYPE=source mocha --timeout 12000 -r ts-node/register/transpile-only \"tests/**/*.spec.ts\"",
|
"test:source": "cross-env BALENA_CLI_TEST_TYPE=source mocha",
|
||||||
"test:standalone": "npm run build:standalone && npm run test:standalone:fast",
|
"test:standalone": "npm run build:standalone && npm run test:standalone:fast",
|
||||||
"test:standalone:fast": "cross-env BALENA_CLI_TEST_TYPE=standalone mocha --timeout 12000 -r ts-node/register/transpile-only \"tests/**/*.spec.ts\"",
|
"test:standalone:fast": "cross-env BALENA_CLI_TEST_TYPE=standalone mocha",
|
||||||
"test:fast": "npm run build:fast && npm run test:source",
|
"test:fast": "npm run build:fast && npm run test:source",
|
||||||
"test:only": "npm run build:fast && cross-env BALENA_CLI_TEST_TYPE=source mocha --timeout 12000 -r ts-node/register/transpile-only \"tests/**/${npm_config_test}.spec.ts\"",
|
"test:only": "npm run build:fast && cross-env BALENA_CLI_TEST_TYPE=source mocha \"tests/**/${npm_config_test}.spec.ts\"",
|
||||||
"catch-uncommitted": "ts-node --transpile-only automation/run.ts catch-uncommitted",
|
"catch-uncommitted": "ts-node --transpile-only automation/run.ts catch-uncommitted",
|
||||||
"ci": "npm run test && npm run catch-uncommitted",
|
"ci": "npm run test && npm run catch-uncommitted",
|
||||||
"watch": "gulp watch",
|
"watch": "gulp watch",
|
||||||
@ -91,6 +91,13 @@
|
|||||||
"pre-commit": "node automation/check-npm-version.js && node automation/check-doc.js"
|
"pre-commit": "node automation/check-npm-version.js && node automation/check-doc.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mocha": {
|
||||||
|
"reporter": "spec",
|
||||||
|
"require": "ts-node/register/transpile-only",
|
||||||
|
"file": "./tests/config-tests",
|
||||||
|
"timeout": 12000,
|
||||||
|
"_": "tests/**/*.spec.ts"
|
||||||
|
},
|
||||||
"oclif": {
|
"oclif": {
|
||||||
"bin": "balena",
|
"bin": "balena",
|
||||||
"commands": "./build/actions-oclif",
|
"commands": "./build/actions-oclif",
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// tslint:disable-next-line:no-var-requires
|
|
||||||
require('../config-tests'); // required for side effects
|
|
||||||
|
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import mock = require('mock-require');
|
import mock = require('mock-require');
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// tslint:disable-next-line:no-var-requires
|
|
||||||
require('../config-tests'); // required for side effects
|
|
||||||
|
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// tslint:disable-next-line:no-var-requires
|
|
||||||
require('../config-tests'); // required for side effects
|
|
||||||
|
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
@ -15,18 +15,21 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { setMaxListeners } from '../build/app-common';
|
import { set as setEsVersion } from '@balena/es-version';
|
||||||
|
// Set the desired es version for downstream modules that support it
|
||||||
|
setEsVersion('es2018');
|
||||||
|
|
||||||
setMaxListeners(35); // it appears that 'nock' adds a bunch of listeners - bug?
|
import * as tmp from 'tmp';
|
||||||
|
tmp.setGracefulCleanup();
|
||||||
|
// Use a temporary dir for tests data
|
||||||
|
process.env.BALENARC_DATA_DIRECTORY = tmp.dirSync().name;
|
||||||
|
|
||||||
|
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,
|
// 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?
|
// which is not using nock. Perhaps mocha/chai? (unlikely), or something in the CLI?
|
||||||
|
|
||||||
import { config as chaiCfg } from 'chai';
|
import { config as chaiCfg } from 'chai';
|
||||||
|
|
||||||
function configChai() {
|
|
||||||
chaiCfg.showDiff = true;
|
chaiCfg.showDiff = true;
|
||||||
// enable diff comparison of large objects / arrays
|
// enable diff comparison of large objects / arrays
|
||||||
chaiCfg.truncateThreshold = 0;
|
chaiCfg.truncateThreshold = 0;
|
||||||
}
|
|
||||||
|
|
||||||
configChai();
|
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import './config-tests'; // required for side effects
|
|
||||||
|
|
||||||
import { execFile } from 'child_process';
|
import { execFile } from 'child_process';
|
||||||
import intercept = require('intercept-stdout');
|
import intercept = require('intercept-stdout');
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// tslint:disable-next-line:no-var-requires
|
|
||||||
require('./../config-tests'); // required for side effects
|
|
||||||
|
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user