mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-20 14:13:08 +00:00
Merge pull request #1707 from balena-os/update-mocha-add-hooks
Upgrade mocha to v8, use mocha fixtures for chai plugins
This commit is contained in:
commit
b09c776680
790
package-lock.json
generated
790
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
28
package.json
28
package.json
@ -14,10 +14,10 @@
|
||||
"lint": "balena-lint -e ts -e js --typescript src/ test/ typings/ build-utils/ webpack.config.js && tsc --noEmit && tsc --noEmit --project tsconfig.js.json",
|
||||
"test": "npm run clean && npm run test-nolint",
|
||||
"posttest": "npm run lint",
|
||||
"test-nolint": "npm run test:build && TEST=1 mocha",
|
||||
"test-nolint": "npm run test:build && TEST=1 mocha --config test/.mocharc.js",
|
||||
"test:build": "npm run test-build && npm run testitems:copy && npm run packagejson:copy",
|
||||
"test:fast": "TEST=1 mocha --opts test/fast-mocha.opts",
|
||||
"test:debug": "npm run test:build && TEST=1 mocha --inspect-brk",
|
||||
"test:fast": "TEST=1 mocha --config test/.mocharc.fast.js",
|
||||
"test:debug": "npm run test:build && TEST=1 mocha --inspect-brk --config test/.mocharc.js",
|
||||
"prettify": "balena-lint -e ts -e js --typescript --fix src/ test/ typings/ build-utils/ webpack.config.js",
|
||||
"test-build": "tsc --project tsconfig.json",
|
||||
"release": "tsc --project tsconfig.release.json && mv build/src/* build",
|
||||
@ -42,7 +42,7 @@
|
||||
"@balena/contrato": "^0.6.0",
|
||||
"@balena/lint": "^5.1.0",
|
||||
"@types/bluebird": "^3.5.32",
|
||||
"@types/chai": "^4.2.12",
|
||||
"@types/chai": "^4.2.16",
|
||||
"@types/chai-as-promised": "^7.1.3",
|
||||
"@types/chai-like": "^1.1.0",
|
||||
"@types/chai-things": "0.0.34",
|
||||
@ -55,7 +55,7 @@
|
||||
"@types/lockfile": "^1.0.1",
|
||||
"@types/lodash": "^4.14.159",
|
||||
"@types/memoizee": "^0.4.4",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/mocha": "^8.2.2",
|
||||
"@types/mock-fs": "^4.13.0",
|
||||
"@types/morgan": "^1.9.0",
|
||||
"@types/node": "^12.12.54",
|
||||
@ -65,9 +65,9 @@
|
||||
"@types/rwlock": "^5.0.2",
|
||||
"@types/semver": "^7.3.3",
|
||||
"@types/shell-quote": "^1.7.0",
|
||||
"@types/sinon": "^7.5.2",
|
||||
"@types/sinon-chai": "^3.2.4",
|
||||
"@types/supertest": "^2.0.10",
|
||||
"@types/sinon": "^10.0.0",
|
||||
"@types/sinon-chai": "^3.2.5",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"@types/terser-webpack-plugin": "^3.0.0",
|
||||
"@types/tmp": "^0.1.0",
|
||||
"@types/webpack": "^4.41.21",
|
||||
@ -75,11 +75,11 @@
|
||||
"balena-register-device": "^7.2.0",
|
||||
"blinking": "^0.0.4",
|
||||
"bluebird": "^3.7.2",
|
||||
"chai": "^4.3.4",
|
||||
"chai-as-promised": "^7.1.1",
|
||||
"chai-events": "0.0.1",
|
||||
"chai-like": "^1.1.1",
|
||||
"chai-things": "^0.2.0",
|
||||
"chokidar": "^3.4.2",
|
||||
"chokidar": "^3.5.1",
|
||||
"common-tags": "^1.8.0",
|
||||
"copy-webpack-plugin": "^6.0.3",
|
||||
"deep-object-diff": "^1.1.0",
|
||||
@ -103,7 +103,7 @@
|
||||
"lodash": "^4.17.21",
|
||||
"memoizee": "^0.4.14",
|
||||
"mixpanel": "^0.10.3",
|
||||
"mocha": "^5.2.0",
|
||||
"mocha": "^8.3.2",
|
||||
"mock-fs": "^4.14.0",
|
||||
"morgan": "^1.10.0",
|
||||
"network-checker": "^0.1.1",
|
||||
@ -117,10 +117,10 @@
|
||||
"rimraf": "^2.7.1",
|
||||
"rwlock": "^5.0.0",
|
||||
"shell-quote": "^1.7.2",
|
||||
"sinon": "^7.5.0",
|
||||
"sinon-chai": "^3.5.0",
|
||||
"sinon": "^10.0.0",
|
||||
"sinon-chai": "^3.6.0",
|
||||
"strict-event-emitter-types": "^2.0.0",
|
||||
"supertest": "^4.0.2",
|
||||
"supertest": "^6.1.3",
|
||||
"tar-stream": "^2.1.3",
|
||||
"terser-webpack-plugin": "^4.1.0",
|
||||
"tmp": "^0.1.0",
|
||||
|
12
test/.mocharc.fast.js
Normal file
12
test/.mocharc.fast.js
Normal file
@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
bail: true, // Exit test script on first error
|
||||
exit: true, // Force Mocha to exit after tests complete
|
||||
recursive: true, // Look for tests in subdirectories
|
||||
require: [
|
||||
// Files to execute before running suites
|
||||
'ts-node/register/transpile-only',
|
||||
'test/config/fixtures.ts',
|
||||
],
|
||||
spec: ['test/**/*.spec.ts'],
|
||||
timeout: '30000',
|
||||
};
|
11
test/.mocharc.js
Normal file
11
test/.mocharc.js
Normal file
@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
bail: true, // Exit test script on first error
|
||||
exit: true, // Force Mocha to exit after tests complete
|
||||
recursive: true, // Look for tests in subdirectories
|
||||
require: [
|
||||
// Files to execute before running suites
|
||||
'build/test/config/fixtures.js',
|
||||
],
|
||||
spec: ['build/test/**/*.spec.js'],
|
||||
timeout: '30000',
|
||||
};
|
@ -1,6 +1,7 @@
|
||||
process.env.ROOT_MOUNTPOINT = './test/data';
|
||||
process.env.BOOT_MOUNTPOINT = '/mnt/boot';
|
||||
process.env.CONFIG_JSON_PATH = '/config.json';
|
||||
process.env.CONFIG_MOUNT_POINT = './test/data/config.json';
|
||||
process.env.DATABASE_PATH = './test/data/database.sqlite';
|
||||
process.env.DATABASE_PATH_2 = './test/data/database2.sqlite';
|
||||
process.env.DATABASE_PATH_3 = './test/data/database3.sqlite';
|
||||
@ -33,4 +34,3 @@ fs.writeFileSync(
|
||||
import './lib/mocked-dbus';
|
||||
import './lib/mocked-dockerode';
|
||||
import './lib/mocked-iptables';
|
||||
import './lib/mocked-event-tracker';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as _ from 'lodash';
|
||||
import { promises as fs } from 'fs';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as chai from 'chai';
|
||||
import prepare = require('./lib/prepare');
|
||||
import * as conf from '../src/config';
|
||||
|
||||
@ -10,10 +10,6 @@ import constants = require('../src/lib/constants');
|
||||
import { SchemaTypeKey } from '../src/config/schema-type';
|
||||
import { fnSchema } from '../src/config/functions';
|
||||
|
||||
// tslint:disable-next-line
|
||||
chai.use(require('chai-events'));
|
||||
const { expect } = chai;
|
||||
|
||||
describe('Config', () => {
|
||||
before(async () => {
|
||||
await prepare();
|
||||
|
@ -1,7 +1,5 @@
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import ChaiConfig = require('./lib/chai-config');
|
||||
const { assert, expect } = ChaiConfig;
|
||||
import { expect } from 'chai';
|
||||
|
||||
import Service from '../src/compose/service';
|
||||
import {
|
||||
@ -315,7 +313,7 @@ describe('compose/service', () => {
|
||||
},
|
||||
{ appName: 'test' } as any,
|
||||
);
|
||||
assert(svc1.isEqualConfig(svc2, {}));
|
||||
expect(svc1.isEqualConfig(svc2, {})).to.be.true;
|
||||
|
||||
svc2 = await Service.fromComposeObject(
|
||||
{
|
||||
@ -326,7 +324,7 @@ describe('compose/service', () => {
|
||||
},
|
||||
{ appName: 'test' } as any,
|
||||
);
|
||||
assert(!svc1.isEqualConfig(svc2, {}));
|
||||
expect(svc1.isEqualConfig(svc2, {})).to.be.false;
|
||||
});
|
||||
|
||||
it('should correctly compare non-ordered array parameters', async () => {
|
||||
@ -348,7 +346,7 @@ describe('compose/service', () => {
|
||||
},
|
||||
{ appName: 'test' } as any,
|
||||
);
|
||||
assert(svc1.isEqualConfig(svc2, {}));
|
||||
expect(svc1.isEqualConfig(svc2, {})).to.be.true;
|
||||
|
||||
svc2 = await Service.fromComposeObject(
|
||||
{
|
||||
@ -359,7 +357,7 @@ describe('compose/service', () => {
|
||||
},
|
||||
{ appName: 'test' } as any,
|
||||
);
|
||||
assert(svc1.isEqualConfig(svc2, {}));
|
||||
expect(svc1.isEqualConfig(svc2, {})).to.be.true;
|
||||
});
|
||||
|
||||
it('should correctly compare both ordered and non-ordered array parameters', async () => {
|
||||
@ -383,7 +381,7 @@ describe('compose/service', () => {
|
||||
},
|
||||
{ appName: 'test' } as any,
|
||||
);
|
||||
assert(svc1.isEqualConfig(svc2, {}));
|
||||
expect(svc1.isEqualConfig(svc2, {})).to.be.true;
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as _ from 'lodash';
|
||||
import { stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as chai from 'chai';
|
||||
import { StatusCodeError } from '../src/lib/errors';
|
||||
import prepare = require('./lib/prepare');
|
||||
import * as dockerUtils from '../src/lib/docker-utils';
|
||||
@ -14,10 +14,6 @@ import { loadTargetFromFile } from '../src/device-state/preload';
|
||||
import Service from '../src/compose/service';
|
||||
import { intialiseContractRequirements } from '../src/lib/contracts';
|
||||
|
||||
// tslint:disable-next-line
|
||||
chai.use(require('chai-events'));
|
||||
const { expect } = chai;
|
||||
|
||||
const mockedInitialConfig = {
|
||||
RESIN_SUPERVISOR_CONNECTIVITY_CHECK: 'true',
|
||||
RESIN_SUPERVISOR_DELTA: 'false',
|
||||
|
@ -1,7 +1,6 @@
|
||||
import * as mixpanel from 'mixpanel';
|
||||
import { SinonStub, stub, spy, SinonSpy } from 'sinon';
|
||||
|
||||
import { expect } from 'chai';
|
||||
import * as mixpanel from 'mixpanel';
|
||||
|
||||
import log from '../src/lib/supervisor-console';
|
||||
import supervisorVersion = require('../src/lib/supervisor-version');
|
||||
|
@ -2,12 +2,12 @@ import { stripIndent } from 'common-tags';
|
||||
import { promises as fs } from 'fs';
|
||||
import { Server } from 'net';
|
||||
import { SinonSpy, SinonStub, spy, stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import prepare = require('./lib/prepare');
|
||||
import * as config from '../src/config';
|
||||
import * as deviceState from '../src/device-state';
|
||||
import Log from '../src/lib/supervisor-console';
|
||||
import { expect } from 'chai';
|
||||
import balenaAPI = require('./lib/mocked-balena-api');
|
||||
import { schema } from '../src/config/schema';
|
||||
import ConfigJsonConfigBackend from '../src/config/configJson';
|
||||
@ -16,12 +16,11 @@ import { DeviceStatus } from '../src/types/state';
|
||||
import * as CurrentState from '../src/device-state/current-state';
|
||||
import * as ApiHelper from '../src/lib/api-helper';
|
||||
import supervisorVersion = require('../src/lib/supervisor-version');
|
||||
import * as eventTracker from '../src/event-tracker';
|
||||
|
||||
import { TypedError } from 'typed-error';
|
||||
import { DeviceNotFoundError } from '../src/lib/errors';
|
||||
|
||||
import { eventTrackSpy } from './lib/mocked-event-tracker';
|
||||
|
||||
let ApiBinder: typeof import('../src/api-binder');
|
||||
|
||||
class ExpectedError extends TypedError {}
|
||||
@ -83,8 +82,10 @@ describe('ApiBinder', () => {
|
||||
// We do not support older OS versions anymore, so we only test this case
|
||||
describe('on an OS with deviceApiKey support', () => {
|
||||
const components: Dictionary<any> = {};
|
||||
let eventTrackSpy: SinonSpy;
|
||||
|
||||
before(async () => {
|
||||
eventTrackSpy = spy(eventTracker, 'track');
|
||||
await initModels(components, '/config-apibinder.json');
|
||||
});
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { stripIndent } from 'common-tags';
|
||||
import { promises as fs } from 'fs';
|
||||
import { SinonStub, stub, spy, SinonSpy } from 'sinon';
|
||||
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as deviceConfig from '../src/device-config';
|
||||
import * as fsUtils from '../src/lib/fs-utils';
|
||||
import * as logger from '../src/logger';
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as Bluebird from 'bluebird';
|
||||
import * as _ from 'lodash';
|
||||
import { stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import Network from '../src/compose/network';
|
||||
|
||||
@ -10,7 +11,6 @@ import * as deviceState from '../src/device-state';
|
||||
import * as dockerUtils from '../src/lib/docker-utils';
|
||||
import * as images from '../src/compose/images';
|
||||
|
||||
import * as chai from 'chai';
|
||||
import prepare = require('./lib/prepare');
|
||||
import * as db from '../src/db';
|
||||
import * as dbFormat from '../src/device-state/db-format';
|
||||
@ -20,10 +20,6 @@ import { TargetApplication, TargetApplications } from '../src/types/state';
|
||||
|
||||
import * as applicationManager from '../src/compose/application-manager';
|
||||
|
||||
// tslint:disable-next-line
|
||||
chai.use(require('chai-events'));
|
||||
const { expect } = chai;
|
||||
|
||||
let availableImages: any[] | null;
|
||||
let targetState: any[] | null;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { stub } from 'sinon';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as config from '../src/config';
|
||||
import * as configUtils from '../src/config/utils';
|
||||
import { ExtraUEnv } from '../src/config/backends/extra-uEnv';
|
||||
|
@ -3,7 +3,6 @@ import { stub, SinonStub } from 'sinon';
|
||||
|
||||
import { docker } from '../src/lib/docker-utils';
|
||||
import * as logger from '../src/logger';
|
||||
|
||||
import Volume from '../src/compose/volume';
|
||||
import logTypes = require('../src/lib/log-types');
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
import * as assert from 'assert';
|
||||
import { expect } from 'chai';
|
||||
import * as Docker from 'dockerode';
|
||||
import * as sinon from 'sinon';
|
||||
@ -400,11 +399,10 @@ describe.skip('LocalModeManager', () => {
|
||||
});
|
||||
|
||||
try {
|
||||
await localMode.retrieveLatestSnapshot();
|
||||
assert.fail('Parsing error was expected');
|
||||
const result = await localMode.retrieveLatestSnapshot();
|
||||
expect(result).to.not.exist;
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
expect(e.message).to.contain('bad json');
|
||||
expect(e.message).to.match(/Cannot parse snapshot data.*"bad json"/);
|
||||
}
|
||||
});
|
||||
|
||||
@ -417,11 +415,12 @@ describe.skip('LocalModeManager', () => {
|
||||
});
|
||||
|
||||
try {
|
||||
await localMode.retrieveLatestSnapshot();
|
||||
assert.fail('Parsing error was expected');
|
||||
const result = await localMode.retrieveLatestSnapshot();
|
||||
expect(result).to.not.exist;
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
expect(e.message).to.contain('bad timestamp');
|
||||
expect(e.message).to.match(
|
||||
/Cannot parse snapshot data.*"bad timestamp"/,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { assert, expect } from 'chai';
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import * as semver from 'semver';
|
||||
|
||||
@ -95,8 +95,8 @@ describe('Container contracts', () => {
|
||||
expect(await osRelease.getOSSemver(constants.hostOSVersionPath)).to.equal(
|
||||
'2.0.6',
|
||||
);
|
||||
assert(semver.gt(supervisorVersionGreater, supervisorVersion));
|
||||
assert(semver.lt(supervisorVersionLesser, supervisorVersion));
|
||||
expect(semver.gt(supervisorVersionGreater, supervisorVersion)).to.be.true;
|
||||
expect(semver.lt(supervisorVersionLesser, supervisorVersion)).to.be.true;
|
||||
});
|
||||
|
||||
it('Should correctly run containers with no requirements', async () => {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import constants = require('../src/lib/constants');
|
||||
import { spawnJournalctl } from '../src/lib/journald';
|
||||
import { expect } from 'chai';
|
||||
|
||||
describe('journald', () => {
|
||||
let spawn: SinonStub;
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { promises as fs } from 'fs';
|
||||
import { stripIndent } from 'common-tags';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as fsUtils from '../src/lib/fs-utils';
|
||||
import { Extlinux } from '../src/config/backends/extlinux';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { expect } from 'chai';
|
||||
import prepare = require('./lib/prepare');
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import prepare = require('./lib/prepare');
|
||||
import * as config from '../src/config';
|
||||
import * as dbFormat from '../src/device-state/db-format';
|
||||
import * as targetStateCache from '../src/device-state/target-state-cache';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { AppendDirective } from '../src/config/backends/extlinux-file';
|
||||
import { expect } from 'chai';
|
||||
import { AppendDirective } from '../src/config/backends/extlinux-file';
|
||||
|
||||
describe('APPEND directive', () => {
|
||||
const supportedConfigValues = ['isolcpus'];
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FDTDirective } from '../src/config/backends/extlinux-file';
|
||||
import { expect } from 'chai';
|
||||
import { FDTDirective } from '../src/config/backends/extlinux-file';
|
||||
|
||||
describe('FDT directive', () => {
|
||||
const directive = new FDTDirective();
|
||||
|
@ -1,7 +1,4 @@
|
||||
import * as chai from 'chai';
|
||||
import { expect } from 'chai';
|
||||
import * as chaiThings from 'chai-things';
|
||||
import * as chaiLike from 'chai-like';
|
||||
import _ = require('lodash');
|
||||
|
||||
import * as dbFormat from '../src/device-state/db-format';
|
||||
@ -18,9 +15,6 @@ import Network from '../src/compose/network';
|
||||
import prepare = require('./lib/prepare');
|
||||
import { intialiseContractRequirements } from '../src/lib/contracts';
|
||||
|
||||
chai.use(chaiLike);
|
||||
chai.use(chaiThings);
|
||||
|
||||
describe('compose/application-manager', () => {
|
||||
before(async () => {
|
||||
await config.initialized;
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { promises as fs } from 'fs';
|
||||
import { stripIndent } from 'common-tags';
|
||||
import { SinonStub, spy, stub } from 'sinon';
|
||||
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as fsUtils from '../src/lib/fs-utils';
|
||||
import Log from '../src/lib/supervisor-console';
|
||||
import { ExtraUEnv } from '../src/config/backends/extra-uEnv';
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { promises as fs } from 'fs';
|
||||
|
||||
import { resolve } from 'path';
|
||||
|
||||
import { expect } from 'chai';
|
||||
|
||||
import Log from '../src/lib/supervisor-console';
|
||||
import { Odmdata } from '../src/config/backends/odmdata';
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { expect } from 'chai';
|
||||
|
||||
import * as commitStore from '../src/compose/commit';
|
||||
import * as db from '../src/db';
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as _ from 'lodash';
|
||||
import { expect } from 'chai';
|
||||
|
||||
import { docker } from '../src/lib/docker-utils';
|
||||
import { expect } from 'chai';
|
||||
import * as Images from '../src/compose/images';
|
||||
import * as mockedDockerode from './lib/mocked-dockerode';
|
||||
import * as mockedDatabase from './lib/mocked-database';
|
||||
@ -82,7 +82,7 @@ describe('compose/images', () => {
|
||||
await Images.remove(IMAGE_TO_REMOVE);
|
||||
// Check that docker does not have this image
|
||||
await expect(docker.getImage(IMAGE_TO_REMOVE.name).inspect()).to
|
||||
.eventually.be.empty;
|
||||
.eventually.be.undefined;
|
||||
// Check that the database longer has this image
|
||||
await expect(db.models('image').select().where(IMAGE_TO_REMOVE)).to
|
||||
.eventually.be.empty;
|
||||
@ -118,7 +118,7 @@ describe('compose/images', () => {
|
||||
await Images.remove(IMAGE_TO_REMOVE);
|
||||
// Check that docker does not have this image
|
||||
await expect(docker.getImage(IMAGE_TO_REMOVE.name).inspect()).to
|
||||
.eventually.be.empty;
|
||||
.eventually.be.undefined;
|
||||
// Check that the database no longer has this image
|
||||
await expect(db.models('image').select().where(IMAGE_TO_REMOVE)).to
|
||||
.eventually.be.empty;
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { SinonStub, stub, spy, SinonSpy } from 'sinon';
|
||||
import { Promise } from 'bluebird';
|
||||
|
||||
import * as _ from 'lodash';
|
||||
import rewire = require('rewire');
|
||||
|
||||
import { expect } from 'chai';
|
||||
|
||||
import { sleep } from './lib/helpers';
|
||||
import * as TargetState from '../src/device-state/target-state';
|
||||
import Log from '../src/lib/supervisor-console';
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { expect } from 'chai';
|
||||
import { stub, SinonStub } from 'sinon';
|
||||
import { VolumeInspectInfo } from 'dockerode';
|
||||
|
||||
import * as mockedDockerode from './lib/mocked-dockerode';
|
||||
import * as volumeManager from '../src/compose/volume-manager';
|
||||
import log from '../src/lib/supervisor-console';
|
||||
import Volume from '../src/compose/volume';
|
||||
import { VolumeInspectInfo } from 'dockerode';
|
||||
|
||||
describe('Volume Manager', () => {
|
||||
let logDebug: SinonStub;
|
||||
|
25
test/config/fixtures.ts
Normal file
25
test/config/fixtures.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import * as chai from 'chai';
|
||||
import * as chaiAsPromised from 'chai-as-promised';
|
||||
import * as sinonChai from 'sinon-chai';
|
||||
import * as chaiThings from 'chai-things';
|
||||
import * as chaiLike from 'chai-like';
|
||||
|
||||
/**
|
||||
* Mocha runs this EXACTLY ONCE before all tests to set up globals that
|
||||
* are used among all test files, such as chai assertion plugins. See
|
||||
* https://mochajs.org/#test-fixture-decision-tree-wizard-thing
|
||||
*
|
||||
* IMPORTANT: The functionality in this global fixture hook should not break any
|
||||
* suite run in isolation, and it should be required by ALL test suites.
|
||||
* If unsure whether to add to global fixtures, refer to the chart above.
|
||||
* Also, avoid setting global mutable variables here.
|
||||
*/
|
||||
export const mochaGlobalSetup = function () {
|
||||
console.log('Setting up global fixtures for tests...');
|
||||
|
||||
/* Setup chai assertion plugins */
|
||||
chai.use(chaiAsPromised);
|
||||
chai.use(sinonChai);
|
||||
chai.use(chaiLike);
|
||||
chai.use(chaiThings);
|
||||
};
|
@ -1,5 +0,0 @@
|
||||
--exit
|
||||
--require ts-node/register/transpile-only
|
||||
--timeout 30000
|
||||
--bail
|
||||
test/**/*.spec.ts
|
@ -1,8 +0,0 @@
|
||||
import * as chai from 'chai';
|
||||
import chaiAsPromised = require('chai-as-promised');
|
||||
import sinonChai = require('sinon-chai');
|
||||
|
||||
chai.use(chaiAsPromised as any);
|
||||
chai.use(sinonChai);
|
||||
|
||||
export = chai;
|
@ -1,4 +0,0 @@
|
||||
import * as eventTracker from '../../src/event-tracker';
|
||||
import { spy } from 'sinon';
|
||||
|
||||
export const eventTrackSpy = spy(eventTracker, 'track');
|
@ -1,3 +0,0 @@
|
||||
--exit
|
||||
--timeout 30000
|
||||
build/test/**/*.spec.js
|
Loading…
Reference in New Issue
Block a user