@noldova/context.testing 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/api/index.d.ts +2015 -0
- package/api/index.js +42 -0
- package/api/index.js.map +1 -0
- package/decorators/category.js +23 -0
- package/decorators/category.js.map +1 -0
- package/decorators/skip.js +17 -0
- package/decorators/skip.js.map +1 -0
- package/decorators/test-class.js +12 -0
- package/decorators/test-class.js.map +1 -0
- package/decorators/test-data.js +23 -0
- package/decorators/test-data.js.map +1 -0
- package/decorators/test-method.js +12 -0
- package/decorators/test-method.js.map +1 -0
- package/enums/test-outcome.js +14 -0
- package/enums/test-outcome.js.map +1 -0
- package/enums/test-worker-message-kind.js +17 -0
- package/enums/test-worker-message-kind.js.map +1 -0
- package/enums/test-worker-value-kind.js +16 -0
- package/enums/test-worker-value-kind.js.map +1 -0
- package/exceptions/assert-failed.exception.js +19 -0
- package/exceptions/assert-failed.exception.js.map +1 -0
- package/exceptions/test-timeout.exception.js +20 -0
- package/exceptions/test-timeout.exception.js.map +1 -0
- package/exceptions/testing.exception.js +14 -0
- package/exceptions/testing.exception.js.map +1 -0
- package/interfaces/i-clock.js +9 -0
- package/interfaces/i-clock.js.map +1 -0
- package/interfaces/i-coverage-range.js +9 -0
- package/interfaces/i-coverage-range.js.map +1 -0
- package/interfaces/i-coverage-report.js +9 -0
- package/interfaces/i-coverage-report.js.map +1 -0
- package/interfaces/i-function-coverage.js +9 -0
- package/interfaces/i-function-coverage.js.map +1 -0
- package/interfaces/i-script-coverage.js +9 -0
- package/interfaces/i-script-coverage.js.map +1 -0
- package/interfaces/i-source-map-data.js +9 -0
- package/interfaces/i-source-map-data.js.map +1 -0
- package/interfaces/i-test-progress-listener.js +9 -0
- package/interfaces/i-test-progress-listener.js.map +1 -0
- package/models/coverage/block-coverage.js +21 -0
- package/models/coverage/block-coverage.js.map +1 -0
- package/models/coverage/coverage-project.js +23 -0
- package/models/coverage/coverage-project.js.map +1 -0
- package/models/coverage/coverage-range.js +18 -0
- package/models/coverage/coverage-range.js.map +1 -0
- package/models/coverage/coverage-result.js +28 -0
- package/models/coverage/coverage-result.js.map +1 -0
- package/models/coverage/file-coverage.js +45 -0
- package/models/coverage/file-coverage.js.map +1 -0
- package/models/coverage/function-coverage.js +14 -0
- package/models/coverage/function-coverage.js.map +1 -0
- package/models/coverage/line-range.js +25 -0
- package/models/coverage/line-range.js.map +1 -0
- package/models/coverage/mapped-source-line.js +22 -0
- package/models/coverage/mapped-source-line.js.map +1 -0
- package/models/coverage/source-map-segment.js +18 -0
- package/models/coverage/source-map-segment.js.map +1 -0
- package/models/decorators/test-data-entry.js +17 -0
- package/models/decorators/test-data-entry.js.map +1 -0
- package/models/decorators/test-marks.js +16 -0
- package/models/decorators/test-marks.js.map +1 -0
- package/models/discovery/discovered-test-class.js +36 -0
- package/models/discovery/discovered-test-class.js.map +1 -0
- package/models/discovery/discovered-test-method.js +42 -0
- package/models/discovery/discovered-test-method.js.map +1 -0
- package/models/discovery/test-project.js +20 -0
- package/models/discovery/test-project.js.map +1 -0
- package/models/execution/test-worker-message.js +76 -0
- package/models/execution/test-worker-message.js.map +1 -0
- package/models/execution/test-worker-record.js +75 -0
- package/models/execution/test-worker-record.js.map +1 -0
- package/models/execution/test-worker-result.js +45 -0
- package/models/execution/test-worker-result.js.map +1 -0
- package/models/execution/test-worker-run.js +31 -0
- package/models/execution/test-worker-run.js.map +1 -0
- package/models/execution/test-worker-start.js +33 -0
- package/models/execution/test-worker-start.js.map +1 -0
- package/models/execution/test-worker-text.js +17 -0
- package/models/execution/test-worker-text.js.map +1 -0
- package/models/execution/test-worker-value.js +104 -0
- package/models/execution/test-worker-value.js.map +1 -0
- package/models/reporting/coverage-report-row.js +22 -0
- package/models/reporting/coverage-report-row.js.map +1 -0
- package/models/results/test-class-result.js +29 -0
- package/models/results/test-class-result.js.map +1 -0
- package/models/results/test-method-result.js +59 -0
- package/models/results/test-method-result.js.map +1 -0
- package/models/results/test-run-result.js +34 -0
- package/models/results/test-run-result.js.map +1 -0
- package/models/results/test-run-totals.js +36 -0
- package/models/results/test-run-totals.js.map +1 -0
- package/models/results/test-selection.js +33 -0
- package/models/results/test-selection.js.map +1 -0
- package/package.json +25 -4
- package/resources.js +309 -0
- package/resources.js.map +1 -0
- package/services/assert.js +92 -0
- package/services/assert.js.map +1 -0
- package/services/coverage/coverage-analyzer.js +52 -0
- package/services/coverage/coverage-analyzer.js.map +1 -0
- package/services/coverage/coverage-report.reader.js +126 -0
- package/services/coverage/coverage-report.reader.js.map +1 -0
- package/services/coverage/file-coverage-analyzer.js +206 -0
- package/services/coverage/file-coverage-analyzer.js.map +1 -0
- package/services/coverage/source-map.js +135 -0
- package/services/coverage/source-map.js.map +1 -0
- package/services/discovery/test-discovery.js +198 -0
- package/services/discovery/test-discovery.js.map +1 -0
- package/services/execution/parallel-test-runner.js +24 -0
- package/services/execution/parallel-test-runner.js.map +1 -0
- package/services/execution/test-executor.js +116 -0
- package/services/execution/test-executor.js.map +1 -0
- package/services/execution/test-run-entry-point.js +89 -0
- package/services/execution/test-run-entry-point.js.map +1 -0
- package/services/execution/test-run-supervisor.js +251 -0
- package/services/execution/test-run-supervisor.js.map +1 -0
- package/services/execution/test-run-worker-entry-point.js +18 -0
- package/services/execution/test-run-worker-entry-point.js.map +1 -0
- package/services/execution/test-run-worker.js +116 -0
- package/services/execution/test-run-worker.js.map +1 -0
- package/services/execution/test-runner.js +58 -0
- package/services/execution/test-runner.js.map +1 -0
- package/services/reporting/coverage-report-writer.js +81 -0
- package/services/reporting/coverage-report-writer.js.map +1 -0
- package/services/reporting/test-console-reporter.js +72 -0
- package/services/reporting/test-console-reporter.js.map +1 -0
- package/services/reporting/test-report-writer.js +111 -0
- package/services/reporting/test-report-writer.js.map +1 -0
- package/services/timing/system-clock.js +26 -0
- package/services/timing/system-clock.js.map +1 -0
- package/README.md +0 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { nameof } from "@noldova/context.core";
|
|
9
|
+
import { ArgumentException, ArgumentOutOfRangeException } from "@noldova/context.exceptions";
|
|
10
|
+
import { Resources } from "../../resources.js";
|
|
11
|
+
export class MappedSourceLine {
|
|
12
|
+
sourcePath;
|
|
13
|
+
line;
|
|
14
|
+
constructor(sourcePath, line) {
|
|
15
|
+
ArgumentException.throwIfNullOrWhitespace(sourcePath, nameof(t => t.sourcePath));
|
|
16
|
+
if (!Number.isInteger(line) || line < 1)
|
|
17
|
+
throw new ArgumentOutOfRangeException(nameof(t => t.line), line, Resources.lineInvalid);
|
|
18
|
+
this.sourcePath = sourcePath;
|
|
19
|
+
this.line = line;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=mapped-source-line.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapped-source-line.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/coverage/mapped-source-line.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,gBAAgB;IACX,UAAU,CAAS;IACnB,IAAI,CAAS;IAE7B,YAAmB,UAAkB,EAAE,IAAY;QACjD,iBAAiB,CAAC,uBAAuB,CAAC,UAAU,EAAE,MAAM,CAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;QACnG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC;YACrC,MAAM,IAAI,2BAA2B,CAAC,MAAM,CAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;QAE5G,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class SourceMapSegment {
|
|
9
|
+
generatedColumn;
|
|
10
|
+
sourcePath;
|
|
11
|
+
sourceLine;
|
|
12
|
+
constructor(generatedColumn, sourcePath, sourceLine) {
|
|
13
|
+
this.generatedColumn = generatedColumn;
|
|
14
|
+
this.sourcePath = sourcePath;
|
|
15
|
+
this.sourceLine = sourceLine;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=source-map-segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-map-segment.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/coverage/source-map-segment.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,OAAO,gBAAgB;IACX,eAAe,CAAS;IACxB,UAAU,CAAqB;IAC/B,UAAU,CAAqB;IAE/C,YAAmB,eAAuB,EAAE,UAAmB,EAAE,UAAmB;QAClF,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { nameof } from "@noldova/context.core";
|
|
9
|
+
import { ArgumentException } from "@noldova/context.exceptions";
|
|
10
|
+
export class TestDataEntry {
|
|
11
|
+
values;
|
|
12
|
+
constructor(values) {
|
|
13
|
+
ArgumentException.throwIfEmpty(values, nameof(t => t.values));
|
|
14
|
+
this.values = [...values];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=test-data-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-data-entry.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/decorators/test-data-entry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,OAAO,aAAa;IACR,MAAM,CAAqB;IAE3C,YAAmB,MAA0B;QAC3C,iBAAiB,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7E,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { Resources } from "../../resources.js";
|
|
9
|
+
export class TestMarks {
|
|
10
|
+
static CATEGORY = Symbol(Resources.categoryMarkDescription);
|
|
11
|
+
static TEST_CLASS = Symbol(Resources.testClassMarkDescription);
|
|
12
|
+
static TEST_DATA = Symbol(Resources.testDataMarkDescription);
|
|
13
|
+
static TEST_METHOD = Symbol(Resources.testMethodMarkDescription);
|
|
14
|
+
static SKIP = Symbol(Resources.skipMarkDescription);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=test-marks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-marks.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/decorators/test-marks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,SAAS;IACb,MAAM,CAAU,QAAQ,GAAkB,MAAM,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IACpF,MAAM,CAAU,UAAU,GAAkB,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;IACvF,MAAM,CAAU,SAAS,GAAkB,MAAM,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAC;IACrF,MAAM,CAAU,WAAW,GAAkB,MAAM,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;IACzF,MAAM,CAAU,IAAI,GAAkB,MAAM,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;CACpF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { nameof } from "@noldova/context.core";
|
|
9
|
+
import { ArgumentException } from "@noldova/context.exceptions";
|
|
10
|
+
export class DiscoveredTestClass {
|
|
11
|
+
packageName;
|
|
12
|
+
className;
|
|
13
|
+
filePath;
|
|
14
|
+
testClassConstructor;
|
|
15
|
+
skipReason;
|
|
16
|
+
methods;
|
|
17
|
+
categories;
|
|
18
|
+
constructor(packageName, className, filePath, testClassConstructor, skipReason, methods, categories = []) {
|
|
19
|
+
ArgumentException.throwIfNullOrWhitespace(packageName, nameof(t => t.packageName));
|
|
20
|
+
ArgumentException.throwIfNullOrWhitespace(className, nameof(t => t.className));
|
|
21
|
+
ArgumentException.throwIfNullOrWhitespace(filePath, nameof(t => t.filePath));
|
|
22
|
+
if (!Object.isUndefined(skipReason))
|
|
23
|
+
ArgumentException.throwIfNullOrWhitespace(skipReason, nameof(t => t.skipReason));
|
|
24
|
+
ArgumentException.throwIfEmpty(methods, nameof(t => t.methods));
|
|
25
|
+
for (const category of categories)
|
|
26
|
+
ArgumentException.throwIfNullOrWhitespace(category, nameof(t => t.categories));
|
|
27
|
+
this.packageName = packageName;
|
|
28
|
+
this.className = className;
|
|
29
|
+
this.filePath = filePath;
|
|
30
|
+
this.testClassConstructor = testClassConstructor;
|
|
31
|
+
this.skipReason = skipReason;
|
|
32
|
+
this.methods = [...methods];
|
|
33
|
+
this.categories = [...new Set(categories)];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=discovered-test-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovered-test-class.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/discovery/discovered-test-class.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAIhE,MAAM,OAAO,mBAAmB;IACd,WAAW,CAAS;IACpB,SAAS,CAAS;IAClB,QAAQ,CAAS;IACjB,oBAAoB,CAAmB;IACvC,UAAU,CAAqB;IAC/B,OAAO,CAAkC;IACzC,UAAU,CAAoB;IAE9C,YACE,WAAmB,EACnB,SAAiB,EACjB,QAAgB,EAChB,oBAAsC,EACtC,UAA8B,EAC9B,OAAwC,EACxC,UAAU,GAAsB,EAAE;Q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|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { nameof } from "@noldova/context.core";
|
|
9
|
+
import { ArgumentException, ArgumentOutOfRangeException } from "@noldova/context.exceptions";
|
|
10
|
+
import { Resources } from "../../resources.js";
|
|
11
|
+
export class DiscoveredTestMethod {
|
|
12
|
+
methodName;
|
|
13
|
+
testDataIndex;
|
|
14
|
+
testData;
|
|
15
|
+
skipReason;
|
|
16
|
+
categories;
|
|
17
|
+
displayName;
|
|
18
|
+
constructor(methodName, testDataIndex, testData, skipReason, categories = []) {
|
|
19
|
+
ArgumentException.throwIfNullOrWhitespace(methodName, nameof(t => t.methodName));
|
|
20
|
+
if (Object.isUndefined(testDataIndex)) {
|
|
21
|
+
if (testData.length > 0)
|
|
22
|
+
throw new ArgumentException(Resources.testDataIdentityInvalid, nameof(t => t.testData));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
if (!Number.isInteger(testDataIndex) || testDataIndex < 0)
|
|
26
|
+
throw new ArgumentOutOfRangeException(nameof(t => t.testDataIndex), testDataIndex, Resources.testDataIndexInvalid);
|
|
27
|
+
if (testData.length === 0)
|
|
28
|
+
throw new ArgumentException(Resources.testDataIdentityInvalid, nameof(t => t.testData));
|
|
29
|
+
}
|
|
30
|
+
if (!Object.isUndefined(skipReason))
|
|
31
|
+
ArgumentException.throwIfNullOrWhitespace(skipReason, nameof(t => t.skipReason));
|
|
32
|
+
for (const category of categories)
|
|
33
|
+
ArgumentException.throwIfNullOrWhitespace(category, nameof(t => t.categories));
|
|
34
|
+
this.methodName = methodName;
|
|
35
|
+
this.testDataIndex = testDataIndex;
|
|
36
|
+
this.testData = [...testData];
|
|
37
|
+
this.skipReason = skipReason;
|
|
38
|
+
this.categories = [...new Set(categories)];
|
|
39
|
+
this.displayName = Object.isUndefined(this.testDataIndex) ? this.methodName : `${this.methodName}[${this.testDataIndex}]`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=discovered-test-method.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovered-test-method.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/discovery/discovered-test-method.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,oBAAoB;IACf,UAAU,CAAS;IACnB,aAAa,CAAqB;IAClC,QAAQ,CAAqB;IAC7B,UAAU,CAAqB;IAC/B,UAAU,CAAoB;IAC9B,WAAW,CAAS;IAEpC,YACE,UAAkB,EAClB,aAAiC,EACjC,QAA4B,EAC5B,UAA8B,EAC9B,UAAU,GAAsB,EAAE;QAClC,iBAAiB,CAAC,uBAAuB,CAAC,UAAU,EAAE,MAAM,CAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;QACvG,IAAI,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC;YACtC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;gBACrB,MAAM,IAAI,iBAAiB,CAAC,SAAS,CAAC,uBAAuB,EAAE,MAAM,CAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClH,CAAC;aACI,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,aAAa,GAAG,CAAC;gBACvD,MAAM,IAAI,2BAA2B,CAAC,MAAM,CAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,aAAa,EAAE,SAAS,CAAC,oBAAoB,CAAC,CAAC;YAE3I,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;gBACvB,MAAM,IAAI,iBAAiB,CAAC,SAAS,CAAC,uBAAuB,EAAE,MAAM,CAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClH,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;YACjC,iBAAiB,CAAC,uBAAuB,CAAC,UAAU,EAAE,MAAM,CAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;QACzG,KAAK,MAAM,QAAQ,IAAI,UAAU;YAC/B,iBAAiB,CAAC,uBAAuB,CAAC,QAAQ,EAAE,MAAM,CAAuB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;QAEvG,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC;IAC5H,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { nameof } from "@noldova/context.core";
|
|
9
|
+
import { ArgumentException } from "@noldova/context.exceptions";
|
|
10
|
+
export class TestProject {
|
|
11
|
+
packageName;
|
|
12
|
+
rootDirectory;
|
|
13
|
+
constructor(packageName, rootDirectory) {
|
|
14
|
+
ArgumentException.throwIfNullOrWhitespace(packageName, nameof(t => t.packageName));
|
|
15
|
+
ArgumentException.throwIfNullOrWhitespace(rootDirectory, nameof(t => t.rootDirectory));
|
|
16
|
+
this.packageName = packageName;
|
|
17
|
+
this.rootDirectory = rootDirectory;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=test-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-project.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/discovery/test-project.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,OAAO,WAAW;IACN,WAAW,CAAS;IACpB,aAAa,CAAS;IAEtC,YAAmB,WAAmB,EAAE,aAAqB;QAC3D,iBAAiB,CAAC,uBAAuB,CAAC,WAAW,EAAE,MAAM,CAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QAChG,iBAAiB,CAAC,uBAAuB,CAAC,aAAa,EAAE,MAAM,CAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC;QAEpG,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { nameof } from "@noldova/context.core";
|
|
9
|
+
import { TestWorkerMessageKind } from "../../enums/test-worker-message-kind.js";
|
|
10
|
+
import { TestingException } from "../../exceptions/testing.exception.js";
|
|
11
|
+
import { Resources } from "../../resources.js";
|
|
12
|
+
import { TestWorkerRecord } from "./test-worker-record.js";
|
|
13
|
+
import { TestWorkerResult } from "./test-worker-result.js";
|
|
14
|
+
export class TestWorkerMessage {
|
|
15
|
+
static KINDS = new Set(Object.values(TestWorkerMessageKind));
|
|
16
|
+
kind;
|
|
17
|
+
classIndex;
|
|
18
|
+
methodIndex;
|
|
19
|
+
filePath;
|
|
20
|
+
result;
|
|
21
|
+
classCount;
|
|
22
|
+
methodCount;
|
|
23
|
+
discoveredCount;
|
|
24
|
+
constructor(kind, classIndex, methodIndex, filePath, result, classCount, methodCount, discoveredCount) {
|
|
25
|
+
this.kind = kind;
|
|
26
|
+
this.classIndex = classIndex;
|
|
27
|
+
this.methodIndex = methodIndex;
|
|
28
|
+
this.filePath = filePath;
|
|
29
|
+
this.result = result;
|
|
30
|
+
this.classCount = classCount;
|
|
31
|
+
this.methodCount = methodCount;
|
|
32
|
+
this.discoveredCount = discoveredCount;
|
|
33
|
+
}
|
|
34
|
+
static imported(filePath) {
|
|
35
|
+
return new TestWorkerMessage(TestWorkerMessageKind.Imported, 0, 0, filePath, undefined, 0, 0, 0);
|
|
36
|
+
}
|
|
37
|
+
static ready(classCount, methodCount, discoveredCount) {
|
|
38
|
+
return new TestWorkerMessage(TestWorkerMessageKind.Ready, 0, 0, String.empty, undefined, classCount, methodCount, discoveredCount);
|
|
39
|
+
}
|
|
40
|
+
static started(classIndex, methodIndex) {
|
|
41
|
+
return new TestWorkerMessage(TestWorkerMessageKind.Started, classIndex, methodIndex, String.empty, undefined, 0, 0, 0);
|
|
42
|
+
}
|
|
43
|
+
static methodCompleted(classIndex, methodIndex, result) {
|
|
44
|
+
return new TestWorkerMessage(TestWorkerMessageKind.MethodCompleted, classIndex, methodIndex, String.empty, result, 0, 0, 0);
|
|
45
|
+
}
|
|
46
|
+
static timedOut(classIndex, methodIndex, filePath) {
|
|
47
|
+
return new TestWorkerMessage(TestWorkerMessageKind.TimedOut, classIndex, methodIndex, filePath, undefined, 0, 0, 0);
|
|
48
|
+
}
|
|
49
|
+
static classCompleted(classIndex, filePath) {
|
|
50
|
+
return new TestWorkerMessage(TestWorkerMessageKind.ClassCompleted, classIndex, 0, filePath, undefined, 0, 0, 0);
|
|
51
|
+
}
|
|
52
|
+
static from(value) {
|
|
53
|
+
const record = TestWorkerRecord.from(value);
|
|
54
|
+
const kind = record.string(nameof(t => t.kind));
|
|
55
|
+
if (!TestWorkerMessage.isKind(kind))
|
|
56
|
+
throw new TestingException(Resources.testWorkerDataInvalid);
|
|
57
|
+
const result = record.value(nameof(t => t.result));
|
|
58
|
+
return new TestWorkerMessage(kind, record.count(nameof(t => t.classIndex)), record.count(nameof(t => t.methodIndex)), record.string(nameof(t => t.filePath)), Object.isUndefined(result) ? result : TestWorkerResult.from(result), record.count(nameof(t => t.classCount)), record.count(nameof(t => t.methodCount)), record.count(nameof(t => t.discoveredCount)));
|
|
59
|
+
}
|
|
60
|
+
toData() {
|
|
61
|
+
return {
|
|
62
|
+
kind: this.kind,
|
|
63
|
+
classIndex: this.classIndex,
|
|
64
|
+
methodIndex: this.methodIndex,
|
|
65
|
+
filePath: this.filePath,
|
|
66
|
+
result: this.result?.toData(),
|
|
67
|
+
classCount: this.classCount,
|
|
68
|
+
methodCount: this.methodCount,
|
|
69
|
+
discoveredCount: this.discoveredCount,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
static isKind(value) {
|
|
73
|
+
return TestWorkerMessage.KINDS.has(value);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=test-worker-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-worker-message.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/execution/test-worker-message.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAU,KAAK,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAEnF,IAAI,CAAwB;IAC5B,UAAU,CAAS;IACnB,WAAW,CAAS;IACpB,QAAQ,CAAS;IACjB,MAAM,CAA+B;IACrC,UAAU,CAAS;IACnB,WAAW,CAAS;IACpB,eAAe,CAAS;IAExC,YAAoB,IAA2B,EAAE,UAAkB,EAAE,WAAmB,EAAE,QAAgB,EAAE,MAAoC,EAC9I,UAAkB,EAAE,WAAmB,EAAE,eAAuB;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,QAAgB;QACrC,OAAO,IAAI,iB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C,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;IAEM,MAAM;QACX,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE;YAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,eAAe,EAAE,IAAI,CAAC,eAAe;SACtC,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,MAAM,CAAC,KAAa;QACjC,OAAO,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import "@noldova/context.core";
|
|
9
|
+
import { TestingException } from "../../exceptions/testing.exception.js";
|
|
10
|
+
import { Resources } from "../../resources.js";
|
|
11
|
+
export class TestWorkerRecord {
|
|
12
|
+
fields;
|
|
13
|
+
constructor(fields) {
|
|
14
|
+
this.fields = fields;
|
|
15
|
+
}
|
|
16
|
+
static from(value) {
|
|
17
|
+
if (!Object.isObject(value) || Array.isArray(value))
|
|
18
|
+
throw new TestingException(Resources.testWorkerDataInvalid);
|
|
19
|
+
return new TestWorkerRecord(new Map(Object.entries(value)));
|
|
20
|
+
}
|
|
21
|
+
string(name) {
|
|
22
|
+
const value = this.fields.get(name);
|
|
23
|
+
if (!Object.isString(value))
|
|
24
|
+
throw new TestingException(Resources.testWorkerDataInvalid);
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
optionalString(name) {
|
|
28
|
+
const value = this.fields.get(name);
|
|
29
|
+
return Object.isUndefined(value) ? value : this.string(name);
|
|
30
|
+
}
|
|
31
|
+
boolean(name) {
|
|
32
|
+
const value = this.fields.get(name);
|
|
33
|
+
if (!Object.isBoolean(value))
|
|
34
|
+
throw new TestingException(Resources.testWorkerDataInvalid);
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
count(name) {
|
|
38
|
+
return TestWorkerRecord.toCount(this.fields.get(name));
|
|
39
|
+
}
|
|
40
|
+
optionalCount(name) {
|
|
41
|
+
const value = this.fields.get(name);
|
|
42
|
+
return Object.isUndefined(value) ? value : this.count(name);
|
|
43
|
+
}
|
|
44
|
+
duration(name) {
|
|
45
|
+
const value = this.fields.get(name);
|
|
46
|
+
if (!Object.isNumber(value) || !Number.isFinite(value) || value < 0)
|
|
47
|
+
throw new TestingException(Resources.testWorkerDataInvalid);
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
strings(name) {
|
|
51
|
+
return this.values(name).map(t => {
|
|
52
|
+
if (!Object.isString(t))
|
|
53
|
+
throw new TestingException(Resources.testWorkerDataInvalid);
|
|
54
|
+
return t;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
records(name) {
|
|
58
|
+
return this.values(name).map(t => TestWorkerRecord.from(t));
|
|
59
|
+
}
|
|
60
|
+
value(name) {
|
|
61
|
+
return this.fields.get(name);
|
|
62
|
+
}
|
|
63
|
+
values(name) {
|
|
64
|
+
const value = this.fields.get(name);
|
|
65
|
+
if (!Array.isArray(value))
|
|
66
|
+
throw new TestingException(Resources.testWorkerDataInvalid);
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
static toCount(value) {
|
|
70
|
+
if (!Object.isNumber(value) || !Number.isInteger(value) || value < 0)
|
|
71
|
+
throw new TestingException(Resources.testWorkerDataInvalid);
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=test-worker-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-worker-record.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/execution/test-worker-record.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,OAAO,gBAAgB;IACV,MAAM,CAA+B;IAEtD,YAAoB,MAAoC;QACtD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,KAAc;QAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACjD,MAAM,IAAI,gBAAgB,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAE9D,OAAO,IAAI,gBAAgB,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IAEM,MAAM,CAAC,IAAY;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YACzB,MAAM,IAAI,gBAAgB,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAE9D,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,cAAc,CAAC,IAAY;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAA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qB,CAAC,CAAC;YAE9D,OAAO,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,OAAO,CAAC,IAAY;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;IAEM,KAAK,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAEM,MAAM,CAAC,IAAY;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACvB,MAAM,IAAI,gBAAgB,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAE9D,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,MAAM,CAAC,OAAO,CAAC,KAAc;QACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;YAClE,MAAM,IAAI,gBAAgB,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAE9D,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { nameof } from "@noldova/context.core";
|
|
9
|
+
import { TestOutcome } from "../../enums/test-outcome.js";
|
|
10
|
+
import { TestingException } from "../../exceptions/testing.exception.js";
|
|
11
|
+
import { Resources } from "../../resources.js";
|
|
12
|
+
import { TestMethodResult } from "../results/test-method-result.js";
|
|
13
|
+
import { TestWorkerRecord } from "./test-worker-record.js";
|
|
14
|
+
import { TestWorkerValue } from "./test-worker-value.js";
|
|
15
|
+
export class TestWorkerResult {
|
|
16
|
+
static OUTCOMES = new Set(Object.values(TestOutcome));
|
|
17
|
+
methodResult;
|
|
18
|
+
constructor(methodResult) {
|
|
19
|
+
this.methodResult = methodResult;
|
|
20
|
+
}
|
|
21
|
+
static from(value) {
|
|
22
|
+
const record = TestWorkerRecord.from(value);
|
|
23
|
+
const outcome = record.string(nameof(t => t.outcome));
|
|
24
|
+
if (!TestWorkerResult.isOutcome(outcome))
|
|
25
|
+
throw new TestingException(Resources.testWorkerDataInvalid);
|
|
26
|
+
return new TestWorkerResult(new TestMethodResult(record.string(nameof(t => t.packageName)), record.string(nameof(t => t.className)), record.string(nameof(t => t.methodName)), record.optionalCount(nameof(t => t.testDataIndex)), record.values(nameof(t => t.testData)).map(t => TestWorkerValue.from(t).toValue()), outcome, record.duration(nameof(t => t.durationMilliseconds)), TestWorkerValue.from(record.value(nameof(t => t.failure))).toValue(), record.optionalString(nameof(t => t.skipReason))));
|
|
27
|
+
}
|
|
28
|
+
toData() {
|
|
29
|
+
return {
|
|
30
|
+
packageName: this.methodResult.packageName,
|
|
31
|
+
className: this.methodResult.className,
|
|
32
|
+
methodName: this.methodResult.methodName,
|
|
33
|
+
testDataIndex: this.methodResult.testDataIndex,
|
|
34
|
+
testData: this.methodResult.testData.map(t => TestWorkerValue.of(t).toData()),
|
|
35
|
+
outcome: this.methodResult.outcome,
|
|
36
|
+
durationMilliseconds: this.methodResult.durationMilliseconds,
|
|
37
|
+
failure: TestWorkerValue.of(this.methodResult.failure).toData(),
|
|
38
|
+
skipReason: this.methodResult.skipReason,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
static isOutcome(value) {
|
|
42
|
+
return TestWorkerResult.OUTCOMES.has(value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=test-worker-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-worker-result.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/execution/test-worker-result.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAU,QAAQ,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;IAE5E,YAAY,CAAmB;IAE/C,YAAmB,YAA8B;QAC/C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,KAAc;QAC/B,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC;YACtC,MAAM,IAAI,gBAAgB,CAAC,SAAS,CAAC,qBAAqB,CAAC,CAAC;QAE9D,OAAO,IAAI,gBAAgB,CAAC,IAAI,gBAAgB,CAC9C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,C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AAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC7E,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;YAClC,oBAAoB,EAAE,IAAI,CAAC,YAAY,CAAC,oBAAoB;YAC5D,OAAO,EAAE,eAAe,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE;YAC/D,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU;SACzC,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,SAAS,CAAC,KAAa;QACpC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { nameof } from "@noldova/context.core";
|
|
9
|
+
import { TestWorkerRecord } from "./test-worker-record.js";
|
|
10
|
+
export class TestWorkerRun {
|
|
11
|
+
classIndex;
|
|
12
|
+
startMethodIndex;
|
|
13
|
+
isStartMethodStopped;
|
|
14
|
+
constructor(classIndex, startMethodIndex, isStartMethodStopped) {
|
|
15
|
+
this.classIndex = classIndex;
|
|
16
|
+
this.startMethodIndex = startMethodIndex;
|
|
17
|
+
this.isStartMethodStopped = isStartMethodStopped;
|
|
18
|
+
}
|
|
19
|
+
static from(value) {
|
|
20
|
+
const record = TestWorkerRecord.from(value);
|
|
21
|
+
return new TestWorkerRun(record.count(nameof(t => t.classIndex)), record.count(nameof(t => t.startMethodIndex)), record.boolean(nameof(t => t.isStartMethodStopped)));
|
|
22
|
+
}
|
|
23
|
+
toData() {
|
|
24
|
+
return {
|
|
25
|
+
classIndex: this.classIndex,
|
|
26
|
+
startMethodIndex: this.startMethodIndex,
|
|
27
|
+
isStartMethodStopped: this.isStartMethodStopped,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=test-worker-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-worker-run.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/execution/test-worker-run.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,OAAO,aAAa;IACR,UAAU,CAAS;IACnB,gBAAgB,CAAS;IACzB,oBAAoB,CAAU;IAE9C,YAAmB,UAAkB,EAAE,gBAAwB,EAAE,oBAA6B;QAC5F,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,KAAc;QAC/B,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,OAAO,IAAI,aAAa,CACtB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,EACtD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,EAC5D,MAAM,CAAC,OAAO,CAAC,MAAM,CAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IAEM,MAAM;QACX,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB;SAChD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { nameof } from "@noldova/context.core";
|
|
9
|
+
import { TestProject } from "../discovery/test-project.js";
|
|
10
|
+
import { TestWorkerRecord } from "./test-worker-record.js";
|
|
11
|
+
export class TestWorkerStart {
|
|
12
|
+
testProjects;
|
|
13
|
+
filters;
|
|
14
|
+
timeoutMilliseconds;
|
|
15
|
+
constructor(testProjects, filters, timeoutMilliseconds) {
|
|
16
|
+
this.testProjects = testProjects;
|
|
17
|
+
this.filters = filters;
|
|
18
|
+
this.timeoutMilliseconds = timeoutMilliseconds;
|
|
19
|
+
}
|
|
20
|
+
static from(value) {
|
|
21
|
+
const record = TestWorkerRecord.from(value);
|
|
22
|
+
return new TestWorkerStart(record.records(nameof(t => t.testProjects))
|
|
23
|
+
.map(t => new TestProject(t.string(nameof(p => p.packageName)), t.string(nameof(p => p.rootDirectory)))), record.strings(nameof(t => t.filters)), record.count(nameof(t => t.timeoutMilliseconds)));
|
|
24
|
+
}
|
|
25
|
+
toData() {
|
|
26
|
+
return {
|
|
27
|
+
testProjects: this.testProjects.map(t => ({ packageName: t.packageName, rootDirectory: t.rootDirectory })),
|
|
28
|
+
filters: [...this.filters],
|
|
29
|
+
timeoutMilliseconds: this.timeoutMilliseconds,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=test-worker-start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-worker-start.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/execution/test-worker-start.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,M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AE,WAAW,EAAE,CAAC,CAAC,WAAW,EAAE,aAAa,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;YAC1G,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;YAC1B,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;SAC9C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
export class TestWorkerText {
|
|
9
|
+
text;
|
|
10
|
+
constructor(text) {
|
|
11
|
+
this.text = text;
|
|
12
|
+
}
|
|
13
|
+
toString() {
|
|
14
|
+
return this.text;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=test-worker-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-worker-text.js","sourceRoot":"","sources":["../../../../../src/noldova.context.testing/src/models/execution/test-worker-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,OAAO,cAAc;IACT,IAAI,CAAS;IAE7B,YAAmB,IAAY;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) Noldova.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import { nameof } from "@noldova/context.core";
|
|
9
|
+
import { TestWorkerValueKind } from "../../enums/test-worker-value-kind.js";
|
|
10
|
+
import { AssertFailedException } from "../../exceptions/assert-failed.exception.js";
|
|
11
|
+
import { TestTimeoutException } from "../../exceptions/test-timeout.exception.js";
|
|
12
|
+
import { TestingException } from "../../exceptions/testing.exception.js";
|
|
13
|
+
import { Resources } from "../../resources.js";
|
|
14
|
+
import { TestWorkerRecord } from "./test-worker-record.js";
|
|
15
|
+
import { TestWorkerText } from "./test-worker-text.js";
|
|
16
|
+
export class TestWorkerValue {
|
|
17
|
+
static KINDS = new Set(Object.values(TestWorkerValueKind));
|
|
18
|
+
kind;
|
|
19
|
+
value;
|
|
20
|
+
name;
|
|
21
|
+
message;
|
|
22
|
+
stack;
|
|
23
|
+
timeoutMilliseconds;
|
|
24
|
+
details;
|
|
25
|
+
constructor(kind, value, name, message, stack, timeoutMilliseconds, details) {
|
|
26
|
+
this.kind = kind;
|
|
27
|
+
this.value = value;
|
|
28
|
+
this.name = name;
|
|
29
|
+
this.message = message;
|
|
30
|
+
this.stack = stack;
|
|
31
|
+
this.timeoutMilliseconds = timeoutMilliseconds;
|
|
32
|
+
this.details = details;
|
|
33
|
+
}
|
|
34
|
+
static of(value) {
|
|
35
|
+
if (TestWorkerValue.isPlain(value))
|
|
36
|
+
return new TestWorkerValue(TestWorkerValueKind.Value, value, String.empty, String.empty, undefined, 0, []);
|
|
37
|
+
if (value instanceof TestTimeoutException)
|
|
38
|
+
return TestWorkerValue.ofError(TestWorkerValueKind.Timeout, value, value.timeoutMilliseconds, []);
|
|
39
|
+
if (value instanceof AssertFailedException)
|
|
40
|
+
return TestWorkerValue.ofError(TestWorkerValueKind.Assert, value, 0, [TestWorkerValue.of(value.expected), TestWorkerValue.of(value.actual)]);
|
|
41
|
+
if (value instanceof Error)
|
|
42
|
+
return TestWorkerValue.ofError(TestWorkerValueKind.Error, value, 0, []);
|
|
43
|
+
return new TestWorkerValue(TestWorkerValueKind.Text, undefined, String.empty, TestWorkerValue.print(value), undefined, 0, []);
|
|
44
|
+
}
|
|
45
|
+
static from(value) {
|
|
46
|
+
const record = TestWorkerRecord.from(value);
|
|
47
|
+
const kind = record.string(nameof(t => t.kind));
|
|
48
|
+
const plain = record.value(nameof(t => t.value));
|
|
49
|
+
const details = record.values(nameof(t => t.details)).map(t => TestWorkerValue.from(t));
|
|
50
|
+
if (!TestWorkerValue.isKind(kind) || !TestWorkerValue.isPlain(plain) || details.length !== (kind === TestWorkerValueKind.Assert ? 2 : 0))
|
|
51
|
+
throw new TestingException(Resources.testWorkerDataInvalid);
|
|
52
|
+
return new TestWorkerValue(kind, plain, record.string(nameof(t => t.name)), record.string(nameof(t => t.message)), record.optionalString(nameof(t => t.stack)), record.count(nameof(t => t.timeoutMilliseconds)), details);
|
|
53
|
+
}
|
|
54
|
+
toData() {
|
|
55
|
+
return {
|
|
56
|
+
kind: this.kind,
|
|
57
|
+
value: this.value,
|
|
58
|
+
name: this.name,
|
|
59
|
+
message: this.message,
|
|
60
|
+
stack: this.stack,
|
|
61
|
+
timeoutMilliseconds: this.timeoutMilliseconds,
|
|
62
|
+
details: this.details.map(t => t.toData()),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
toValue() {
|
|
66
|
+
if (this.kind === TestWorkerValueKind.Value)
|
|
67
|
+
return this.value;
|
|
68
|
+
if (this.kind === TestWorkerValueKind.Text)
|
|
69
|
+
return new TestWorkerText(this.message);
|
|
70
|
+
const error = this.toError();
|
|
71
|
+
error.name = this.name;
|
|
72
|
+
if (!Object.isUndefined(this.stack))
|
|
73
|
+
error.stack = this.stack;
|
|
74
|
+
return error;
|
|
75
|
+
}
|
|
76
|
+
static ofError(kind, error, timeoutMilliseconds, details) {
|
|
77
|
+
const stack = error.stack;
|
|
78
|
+
return new TestWorkerValue(kind, undefined, TestWorkerValue.print(error.name), TestWorkerValue.print(error.message), Object.isString(stack) ? stack : undefined, timeoutMilliseconds, details);
|
|
79
|
+
}
|
|
80
|
+
static isPlain(value) {
|
|
81
|
+
return Object.isNullOrUndefined(value) || Object.isString(value) || Object.isNumber(value) || Object.isBoolean(value) || Object.isBigInt(value);
|
|
82
|
+
}
|
|
83
|
+
static isKind(value) {
|
|
84
|
+
return TestWorkerValue.KINDS.has(value);
|
|
85
|
+
}
|
|
86
|
+
static print(value) {
|
|
87
|
+
try {
|
|
88
|
+
return String(value);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return Resources.unprintableValue;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
toError() {
|
|
95
|
+
if (this.kind === TestWorkerValueKind.Timeout)
|
|
96
|
+
return new TestTimeoutException(this.timeoutMilliseconds);
|
|
97
|
+
if (this.kind === TestWorkerValueKind.Assert) {
|
|
98
|
+
const [expected, actual] = this.details.map(t => t.toValue());
|
|
99
|
+
return new AssertFailedException(this.message, expected, actual);
|
|
100
|
+
}
|
|
101
|
+
return new Error(this.message);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=test-worker-value.js.map
|