@villedemontreal/logger 6.6.3 → 6.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/configs.d.ts +1 -0
- package/dist/config/configs.d.ts.map +1 -0
- package/dist/src/config/configs.d.ts +1 -0
- package/dist/src/config/configs.d.ts.map +1 -0
- package/dist/src/config/constants.d.ts +1 -0
- package/dist/src/config/constants.d.ts.map +1 -0
- package/dist/src/config/constants.js +1 -1
- package/dist/src/config/constants.js.map +1 -1
- package/dist/src/consoleStream.d.ts +1 -0
- package/dist/src/consoleStream.d.ts.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lazyLogger.d.ts +1 -0
- package/dist/src/lazyLogger.d.ts.map +1 -0
- package/dist/src/logger.d.ts +1 -0
- package/dist/src/logger.d.ts.map +1 -0
- package/dist/src/logger.js +4 -1
- package/dist/src/logger.js.map +1 -1
- package/dist/src/logger.test.d.ts +1 -0
- package/dist/src/logger.test.d.ts.map +1 -0
- package/dist/src/logger.test.js +86 -96
- package/dist/src/logger.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +30 -30
- package/src/config/constants.ts +1 -1
- package/src/logger.test.ts +5 -4
- package/src/logger.ts +4 -4
- package/dist/scripts/index.d.ts +0 -6
- package/dist/scripts/index.js +0 -35
- package/dist/scripts/index.js.map +0 -1
- package/dist/scripts/lint.d.ts +0 -6
- package/dist/scripts/lint.js +0 -31
- package/dist/scripts/lint.js.map +0 -1
- package/dist/scripts/lintFix.d.ts +0 -6
- package/dist/scripts/lintFix.js +0 -40
- package/dist/scripts/lintFix.js.map +0 -1
- package/dist/scripts/scripts-tests/testingGlobalOptions.d.ts +0 -4
- package/dist/scripts/scripts-tests/testingGlobalOptions.js +0 -3
- package/dist/scripts/scripts-tests/testingGlobalOptions.js.map +0 -1
- package/dist/scripts/scripts-tests/testingScript1.d.ts +0 -7
- package/dist/scripts/scripts-tests/testingScript1.js +0 -40
- package/dist/scripts/scripts-tests/testingScript1.js.map +0 -1
- package/dist/scripts/scripts-tests/testingScript2.d.ts +0 -7
- package/dist/scripts/scripts-tests/testingScript2.js +0 -28
- package/dist/scripts/scripts-tests/testingScript2.js.map +0 -1
- package/dist/scripts/tests/index.d.ts +0 -3
- package/dist/scripts/tests/index.js +0 -10
- package/dist/scripts/tests/index.js.map +0 -1
- package/dist/scripts/tests/showCoverage.d.ts +0 -13
- package/dist/scripts/tests/showCoverage.js +0 -55
- package/dist/scripts/tests/showCoverage.js.map +0 -1
- package/dist/scripts/tests/test.d.ts +0 -13
- package/dist/scripts/tests/test.js +0 -42
- package/dist/scripts/tests/test.js.map +0 -1
- package/dist/scripts/tests/testUnits.d.ts +0 -15
- package/dist/scripts/tests/testUnits.js +0 -109
- package/dist/scripts/tests/testUnits.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lintFix.js","sourceRoot":"","sources":["../../scripts/lintFix.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6DAAiE;AACjE,+BAA+B;AAC/B,+CAA4C;AAE5C,MAAa,aAAc,SAAQ,gBAAU;IAC3C,IAAI,IAAI;QACN,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,gDAAgD,CAAC;IAC1D,CAAC;IAEe,IAAI;;YAClB,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,GAAG,iBAAO,CAAC,IAAI,KAAK,CAAC,CAAC;YAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;YAChD,MAAM,IAAI,CAAC,kBAAkB,CAAC,GAAG,WAAW,6BAA6B,EAAE;gBACzE,SAAS;gBACT,WAAW;aACZ,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;YAC9C,MAAM,IAAI,CAAC,kBAAkB,CAAC,GAAG,WAAW,2BAA2B,EAAE;gBACvE,OAAO;gBACP,WAAW;aACZ,CAAC,CAAC;QACL,CAAC;KAAA;CACF;AAvBD,sCAuBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testingGlobalOptions.js","sourceRoot":"","sources":["../../../scripts/scripts-tests/testingGlobalOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ScriptBase } from '@villedemontreal/scripting';
|
|
2
|
-
import { ITestingGlobalOptions } from './testingGlobalOptions';
|
|
3
|
-
export declare class TestingScript1 extends ScriptBase<{}, ITestingGlobalOptions> {
|
|
4
|
-
get name(): string;
|
|
5
|
-
get description(): string;
|
|
6
|
-
protected main(): Promise<void>;
|
|
7
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TestingScript1 = void 0;
|
|
13
|
-
const scripting_1 = require("@villedemontreal/scripting");
|
|
14
|
-
const testingScript2_1 = require("./testingScript2");
|
|
15
|
-
class TestingScript1 extends scripting_1.ScriptBase {
|
|
16
|
-
get name() {
|
|
17
|
-
// ==========================================
|
|
18
|
-
// A script with a name starting with
|
|
19
|
-
// `TESTING_SCRIPT_NAME_PREFIX` will only be
|
|
20
|
-
// registered/available when tests are run.
|
|
21
|
-
// ==========================================
|
|
22
|
-
return `${scripting_1.TESTING_SCRIPT_NAME_PREFIX}testingScript1`;
|
|
23
|
-
}
|
|
24
|
-
get description() {
|
|
25
|
-
return `testingScript1 description`;
|
|
26
|
-
}
|
|
27
|
-
main() {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
this.logger.info(`In testingScript1. custom option: ${this.options.custom}`);
|
|
30
|
-
// ==========================================
|
|
31
|
-
// We do not explicitly pass the `--custom`
|
|
32
|
-
// option to the second script. It should be added
|
|
33
|
-
// automatically since it is a global option.
|
|
34
|
-
// ==========================================
|
|
35
|
-
yield this.invokeScript(testingScript2_1.TestingScript2, {}, {});
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.TestingScript1 = TestingScript1;
|
|
40
|
-
//# sourceMappingURL=testingScript1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testingScript1.js","sourceRoot":"","sources":["../../../scripts/scripts-tests/testingScript1.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAoF;AAEpF,qDAAkD;AAElD,MAAa,cAAe,SAAQ,sBAAqC;IACvE,IAAI,IAAI;QACN,6CAA6C;QAC7C,qCAAqC;QACrC,4CAA4C;QAC5C,2CAA2C;QAC3C,6CAA6C;QAC7C,OAAO,GAAG,sCAA0B,gBAAgB,CAAC;IACvD,CAAC;IAED,IAAI,WAAW;QACb,OAAO,4BAA4B,CAAC;IACtC,CAAC;IAEe,IAAI;;YAClB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qCAAqC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YAC7E,6CAA6C;YAC7C,2CAA2C;YAC3C,kDAAkD;YAClD,6CAA6C;YAC7C,6CAA6C;YAC7C,MAAM,IAAI,CAAC,YAAY,CAAC,+BAAc,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QAClD,CAAC;KAAA;CACF;AAvBD,wCAuBC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ScriptBase } from '@villedemontreal/scripting';
|
|
2
|
-
import { ITestingGlobalOptions } from './testingGlobalOptions';
|
|
3
|
-
export declare class TestingScript2 extends ScriptBase<{}, ITestingGlobalOptions> {
|
|
4
|
-
get name(): string;
|
|
5
|
-
get description(): string;
|
|
6
|
-
protected main(): Promise<void>;
|
|
7
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TestingScript2 = void 0;
|
|
13
|
-
const scripting_1 = require("@villedemontreal/scripting");
|
|
14
|
-
class TestingScript2 extends scripting_1.ScriptBase {
|
|
15
|
-
get name() {
|
|
16
|
-
return `${scripting_1.TESTING_SCRIPT_NAME_PREFIX}testingScript1`;
|
|
17
|
-
}
|
|
18
|
-
get description() {
|
|
19
|
-
return `testingScript2 description`;
|
|
20
|
-
}
|
|
21
|
-
main() {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
this.logger.info(`In testingScript2. custom option: ${this.options.custom}`);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.TestingScript2 = TestingScript2;
|
|
28
|
-
//# sourceMappingURL=testingScript2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testingScript2.js","sourceRoot":"","sources":["../../../scripts/scripts-tests/testingScript2.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAoF;AAGpF,MAAa,cAAe,SAAQ,sBAAqC;IACvE,IAAI,IAAI;QACN,OAAO,GAAG,sCAA0B,gBAAgB,CAAC;IACvD,CAAC;IAED,IAAI,WAAW;QACb,OAAO,4BAA4B,CAAC;IACtC,CAAC;IAEe,IAAI;;YAClB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qCAAqC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/E,CAAC;KAAA;CACF;AAZD,wCAYC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestUnitsScript = exports.TestScript = exports.ShowCoverageScript = void 0;
|
|
4
|
-
var showCoverage_1 = require("./showCoverage");
|
|
5
|
-
Object.defineProperty(exports, "ShowCoverageScript", { enumerable: true, get: function () { return showCoverage_1.ShowCoverageScript; } });
|
|
6
|
-
var test_1 = require("./test");
|
|
7
|
-
Object.defineProperty(exports, "TestScript", { enumerable: true, get: function () { return test_1.TestScript; } });
|
|
8
|
-
var testUnits_1 = require("./testUnits");
|
|
9
|
-
Object.defineProperty(exports, "TestUnitsScript", { enumerable: true, get: function () { return testUnits_1.TestUnitsScript; } });
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../scripts/tests/index.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AAA3C,kHAAA,kBAAkB,OAAA;AAC3B,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,yCAA8C;AAArC,4GAAA,eAAe,OAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from '@caporal/core';
|
|
2
|
-
import { ScriptBase } from '@villedemontreal/scripting/dist/src';
|
|
3
|
-
export interface Options {
|
|
4
|
-
report?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare class ShowCoverageScript extends ScriptBase<Options> {
|
|
7
|
-
get name(): string;
|
|
8
|
-
get description(): string;
|
|
9
|
-
protected get requiredDependencies(): string[];
|
|
10
|
-
protected configure(command: Command): Promise<void>;
|
|
11
|
-
protected main(): Promise<void>;
|
|
12
|
-
protected getReportDir(): string;
|
|
13
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ShowCoverageScript = void 0;
|
|
13
|
-
const core_1 = require("@caporal/core");
|
|
14
|
-
const src_1 = require("@villedemontreal/scripting/dist/src");
|
|
15
|
-
const path = require("path");
|
|
16
|
-
const configs_1 = require("../../config/configs");
|
|
17
|
-
class ShowCoverageScript extends src_1.ScriptBase {
|
|
18
|
-
get name() {
|
|
19
|
-
return 'show-coverage';
|
|
20
|
-
}
|
|
21
|
-
get description() {
|
|
22
|
-
return `Open the tests coverage report.`;
|
|
23
|
-
}
|
|
24
|
-
get requiredDependencies() {
|
|
25
|
-
return ['nyc'];
|
|
26
|
-
}
|
|
27
|
-
configure(command) {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
command.option(`--report <path>`, `The relative path to the coverage report directory.`, {
|
|
30
|
-
default: `output/coverage`,
|
|
31
|
-
validator: core_1.program.STRING,
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
main() {
|
|
36
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
if (process.platform === 'win32') {
|
|
38
|
-
yield this.invokeShellCommand('start', ['', this.getReportDir()], {
|
|
39
|
-
useShellOption: true,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
yield this.invokeShellCommand('open', [this.getReportDir()]);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
getReportDir() {
|
|
48
|
-
var _a;
|
|
49
|
-
const projectRoot = `${configs_1.configs.root}/..`;
|
|
50
|
-
const reportDir = path.resolve(projectRoot, (_a = this.options.report) !== null && _a !== void 0 ? _a : '', 'lcov-report/index.html');
|
|
51
|
-
return reportDir;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.ShowCoverageScript = ShowCoverageScript;
|
|
55
|
-
//# sourceMappingURL=showCoverage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"showCoverage.js","sourceRoot":"","sources":["../../../scripts/tests/showCoverage.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAiD;AACjD,6DAAiE;AACjE,6BAA6B;AAC7B,kDAA+C;AAM/C,MAAa,kBAAmB,SAAQ,gBAAmB;IACzD,IAAI,IAAI;QACN,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,iCAAiC,CAAC;IAC3C,CAAC;IAED,IAAc,oBAAoB;QAChC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEe,SAAS,CAAC,OAAgB;;YACxC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,qDAAqD,EAAE;gBACvF,OAAO,EAAE,iBAAiB;gBAC1B,SAAS,EAAE,cAAO,CAAC,MAAM;aAC1B,CAAC,CAAC;QACL,CAAC;KAAA;IAEe,IAAI;;YAClB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;gBACjC,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE;oBAChE,cAAc,EAAE,IAAI;iBACrB,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC;KAAA;IAES,YAAY;;QACpB,MAAM,WAAW,GAAG,GAAG,iBAAO,CAAC,IAAI,KAAK,CAAC;QACzC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAC5B,WAAW,EACX,MAAA,IAAI,CAAC,OAAO,CAAC,MAAM,mCAAI,EAAE,EACzB,wBAAwB,CACzB,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAvCD,gDAuCC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Command } from '@caporal/core';
|
|
2
|
-
import { ScriptBase } from '@villedemontreal/scripting/dist/src';
|
|
3
|
-
export interface Options {
|
|
4
|
-
bail?: boolean;
|
|
5
|
-
jenkins?: boolean;
|
|
6
|
-
report?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare class TestScript extends ScriptBase<Options> {
|
|
9
|
-
get name(): string;
|
|
10
|
-
get description(): string;
|
|
11
|
-
protected configure(command: Command): Promise<void>;
|
|
12
|
-
protected main(): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TestScript = void 0;
|
|
13
|
-
const core_1 = require("@caporal/core");
|
|
14
|
-
const src_1 = require("@villedemontreal/scripting/dist/src");
|
|
15
|
-
const lint_1 = require("../lint");
|
|
16
|
-
const testUnits_1 = require("./testUnits");
|
|
17
|
-
class TestScript extends src_1.ScriptBase {
|
|
18
|
-
get name() {
|
|
19
|
-
return 'test';
|
|
20
|
-
}
|
|
21
|
-
get description() {
|
|
22
|
-
return `Run the unit tests + the linting validations.`;
|
|
23
|
-
}
|
|
24
|
-
configure(command) {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
command.option(`--bail`, `Stop the execution of the tests as soon as an error occures.`);
|
|
27
|
-
command.option(`--jenkins`, `Configure the tests to be run by Jenkins.`);
|
|
28
|
-
command.option(`--report <path>`, `The relative path to the report, when the tests are run for Jenkins.`, {
|
|
29
|
-
default: `output/test-results/report.xml`,
|
|
30
|
-
validator: core_1.program.STRING,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
main() {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
yield this.invokeScript(lint_1.LintScript, {}, {});
|
|
37
|
-
yield this.invokeScript(testUnits_1.TestUnitsScript, this.options, {});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.TestScript = TestScript;
|
|
42
|
-
//# sourceMappingURL=test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../scripts/tests/test.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAiD;AACjD,6DAAiE;AACjE,kCAAqC;AACrC,2CAA8C;AAQ9C,MAAa,UAAW,SAAQ,gBAAmB;IACjD,IAAI,IAAI;QACN,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,+CAA+C,CAAC;IACzD,CAAC;IAEe,SAAS,CAAC,OAAgB;;YACxC,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,8DAA8D,CAAC,CAAC;YACzF,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,2CAA2C,CAAC,CAAC;YACzE,OAAO,CAAC,MAAM,CACZ,iBAAiB,EACjB,sEAAsE,EACtE;gBACE,OAAO,EAAE,gCAAgC;gBACzC,SAAS,EAAE,cAAO,CAAC,MAAM;aAC1B,CACF,CAAC;QACJ,CAAC;KAAA;IAEe,IAAI;;YAClB,MAAM,IAAI,CAAC,YAAY,CAAC,iBAAU,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;YAC5C,MAAM,IAAI,CAAC,YAAY,CAAC,2BAAe,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC7D,CAAC;KAAA;CACF;AA1BD,gCA0BC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Command } from '@caporal/core';
|
|
2
|
-
import { ScriptBase } from '@villedemontreal/scripting/dist/src';
|
|
3
|
-
export interface Options {
|
|
4
|
-
bail?: boolean;
|
|
5
|
-
jenkins?: boolean;
|
|
6
|
-
report?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare class TestUnitsScript extends ScriptBase<Options> {
|
|
9
|
-
get name(): string;
|
|
10
|
-
get description(): string;
|
|
11
|
-
protected configure(command: Command): Promise<void>;
|
|
12
|
-
protected get requiredDependencies(): string[];
|
|
13
|
-
private addQuotes;
|
|
14
|
-
protected main(): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.TestUnitsScript = void 0;
|
|
13
|
-
const core_1 = require("@caporal/core");
|
|
14
|
-
const src_1 = require("@villedemontreal/scripting/dist/src");
|
|
15
|
-
const _ = require("lodash");
|
|
16
|
-
const configs_1 = require("../../config/configs");
|
|
17
|
-
const TESTS_LOCATIONS = [`${configs_1.configs.root}/src/**/*.test.js`, `${configs_1.configs.root}/tests/**/*.test.js`];
|
|
18
|
-
class TestUnitsScript extends src_1.ScriptBase {
|
|
19
|
-
get name() {
|
|
20
|
-
return 'test-units';
|
|
21
|
-
}
|
|
22
|
-
get description() {
|
|
23
|
-
return `Run the unit tests.`;
|
|
24
|
-
}
|
|
25
|
-
configure(command) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
command.option(`--bail`, `Stop the execution of the tests as soon as an error occures.`);
|
|
28
|
-
command.option(`--jenkins`, `Configure the tests to be run by Jenkins.`);
|
|
29
|
-
command.option(`--report <path>`, `The relative path to the report, when the tests are run for Jenkins.`, {
|
|
30
|
-
default: `output/test-results/report.xml`,
|
|
31
|
-
validator: core_1.program.STRING,
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
get requiredDependencies() {
|
|
36
|
-
const deps = ['mocha'];
|
|
37
|
-
if (this.options.jenkins) {
|
|
38
|
-
deps.push('mocha-jenkins-reporter');
|
|
39
|
-
}
|
|
40
|
-
return deps;
|
|
41
|
-
}
|
|
42
|
-
addQuotes(tokens) {
|
|
43
|
-
if (_.isNil(tokens) || tokens.length === 0) {
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
return tokens.map((token) => {
|
|
47
|
-
return _.isNil(token) ? token : `"${_.trim(token, '"')}"`;
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
main() {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const cmdArgs = [];
|
|
53
|
-
const projectRoot = `${configs_1.configs.root}/..`;
|
|
54
|
-
if (yield this.isProjectDirectDependency(`nyc`)) {
|
|
55
|
-
cmdArgs.push(`${projectRoot}/node_modules/nyc/bin/nyc`);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
this.logger.warn(`The "nyc" direct dependency was not found in your project. The tests will be run using Mocha only!`);
|
|
59
|
-
}
|
|
60
|
-
cmdArgs.push(`${projectRoot}/node_modules/mocha/bin/_mocha`);
|
|
61
|
-
// ==========================================
|
|
62
|
-
// The test locations need to be quoted because
|
|
63
|
-
// they may contain a "**" wildcard that some
|
|
64
|
-
// shells may interpret differently otherwise!
|
|
65
|
-
//
|
|
66
|
-
// @see https://mochajs.org/#the-test-directory
|
|
67
|
-
// ==========================================
|
|
68
|
-
cmdArgs.push(...this.addQuotes(TESTS_LOCATIONS));
|
|
69
|
-
cmdArgs.push(`--exit`);
|
|
70
|
-
// ==========================================
|
|
71
|
-
// Stop testing as soon as one test fails?
|
|
72
|
-
// ==========================================
|
|
73
|
-
if (this.options.bail) {
|
|
74
|
-
cmdArgs.push('--bail');
|
|
75
|
-
}
|
|
76
|
-
// ==========================================
|
|
77
|
-
// For Jenkins, the path to the report to generate
|
|
78
|
-
// can be passed :
|
|
79
|
-
// - as a command line param :
|
|
80
|
-
// "run test-units --jenkins --report output/test-results/report.xml"
|
|
81
|
-
// - as an "JUNIT_REPORT_PATH" environment variable.
|
|
82
|
-
//
|
|
83
|
-
// By default, the path will be "output/test-results/report.xml"
|
|
84
|
-
// ==========================================
|
|
85
|
-
if (this.options.jenkins) {
|
|
86
|
-
if (this.options.report) {
|
|
87
|
-
process.env.JUNIT_REPORT_PATH = this.options.report;
|
|
88
|
-
}
|
|
89
|
-
else if (!process.env.JUNIT_REPORT_PATH) {
|
|
90
|
-
process.env.JUNIT_REPORT_PATH = `${projectRoot}/output/test-results/report.xml`;
|
|
91
|
-
}
|
|
92
|
-
this.logger.info('Exporting tests to junit file ' + process.env.JUNIT_REPORT_PATH);
|
|
93
|
-
cmdArgs.push('--reporter');
|
|
94
|
-
cmdArgs.push('mocha-jenkins-reporter');
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
yield this.invokeShellCommand('node', cmdArgs, {
|
|
98
|
-
useTestsNodeAppInstance: true,
|
|
99
|
-
});
|
|
100
|
-
this.logger.info(" \u21b3 type 'run show-coverage' (or './run show-coverage' on Linux/Mac) to display the HTML report");
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
throw new Error('Some unit tests failed');
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.TestUnitsScript = TestUnitsScript;
|
|
109
|
-
//# sourceMappingURL=testUnits.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testUnits.js","sourceRoot":"","sources":["../../../scripts/tests/testUnits.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAiD;AACjD,6DAAiE;AACjE,4BAA4B;AAC5B,kDAA+C;AAE/C,MAAM,eAAe,GA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