@playwright/test 1.36.0-alpha-jun-30-2023 → 1.36.0-alpha-jul-2-2023
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/lib/isomorphic/teleReceiver.js +18 -6
- package/lib/reporters/base.js +16 -3
- package/lib/reporters/blob.js +11 -8
- package/lib/reporters/dot.js +2 -2
- package/lib/reporters/empty.js +19 -1
- package/lib/reporters/html.js +7 -3
- package/lib/reporters/internalReporter.js +28 -54
- package/lib/reporters/json.js +6 -2
- package/lib/reporters/junit.js +6 -2
- package/lib/reporters/line.js +5 -2
- package/lib/reporters/list.js +5 -2
- package/lib/reporters/merge.js +18 -8
- package/lib/reporters/multiplexer.js +23 -40
- package/lib/reporters/reporterV2.js +118 -0
- package/lib/reporters/teleEmitter.js +15 -2
- package/lib/runner/reporters.js +13 -14
- package/lib/runner/runner.js +3 -2
- package/lib/runner/tasks.js +2 -2
- package/lib/runner/uiMode.js +7 -7
- package/lib/runner/watchMode.js +4 -4
- package/package.json +2 -2
|
@@ -29,9 +29,11 @@ class TeleReporterReceiver {
|
|
|
29
29
|
this._reporter = void 0;
|
|
30
30
|
this._tests = new Map();
|
|
31
31
|
this._rootDir = void 0;
|
|
32
|
+
this._listOnly = false;
|
|
32
33
|
this._clearPreviousResultsWhenTestBegins = false;
|
|
33
34
|
this._reuseTestCases = void 0;
|
|
34
35
|
this._reportConfig = void 0;
|
|
36
|
+
this._config = void 0;
|
|
35
37
|
this._rootSuite = new TeleSuite('', 'root');
|
|
36
38
|
this._pathSeparator = pathSeparator;
|
|
37
39
|
this._reporter = reporter;
|
|
@@ -43,8 +45,12 @@ class TeleReporterReceiver {
|
|
|
43
45
|
method,
|
|
44
46
|
params
|
|
45
47
|
} = message;
|
|
48
|
+
if (method === 'onConfigure') {
|
|
49
|
+
this._onConfigure(params.config);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
46
52
|
if (method === 'onBegin') {
|
|
47
|
-
this._onBegin(params.
|
|
53
|
+
this._onBegin(params.projects);
|
|
48
54
|
return;
|
|
49
55
|
}
|
|
50
56
|
if (method === 'onTestBegin') {
|
|
@@ -77,9 +83,15 @@ class TeleReporterReceiver {
|
|
|
77
83
|
_setClearPreviousResultsWhenTestBegins() {
|
|
78
84
|
this._clearPreviousResultsWhenTestBegins = true;
|
|
79
85
|
}
|
|
80
|
-
|
|
81
|
-
var _this$_reportConfig
|
|
86
|
+
_onConfigure(config) {
|
|
87
|
+
var _this$_reportConfig;
|
|
82
88
|
this._rootDir = ((_this$_reportConfig = this._reportConfig) === null || _this$_reportConfig === void 0 ? void 0 : _this$_reportConfig.rootDir) || config.rootDir;
|
|
89
|
+
this._listOnly = config.listOnly;
|
|
90
|
+
this._config = this._parseConfig(config);
|
|
91
|
+
this._reporter.onConfigure(this._config);
|
|
92
|
+
}
|
|
93
|
+
_onBegin(projects) {
|
|
94
|
+
var _this$_reporter$onBeg, _this$_reporter;
|
|
83
95
|
for (const project of projects) {
|
|
84
96
|
let projectSuite = this._rootSuite.suites.find(suite => suite.project().id === project.id);
|
|
85
97
|
if (!projectSuite) {
|
|
@@ -93,7 +105,7 @@ class TeleReporterReceiver {
|
|
|
93
105
|
|
|
94
106
|
// Remove deleted tests when listing. Empty suites will be auto-filtered
|
|
95
107
|
// in the UI layer.
|
|
96
|
-
if (
|
|
108
|
+
if (this._listOnly) {
|
|
97
109
|
const testIds = new Set();
|
|
98
110
|
const collectIds = suite => {
|
|
99
111
|
suite.tests.map(t => t.testId).forEach(testId => testIds.add(testId));
|
|
@@ -107,7 +119,7 @@ class TeleReporterReceiver {
|
|
|
107
119
|
filterTests(projectSuite);
|
|
108
120
|
}
|
|
109
121
|
}
|
|
110
|
-
(_this$_reporter$onBeg = (_this$_reporter = this._reporter).onBegin) === null || _this$_reporter$onBeg === void 0 ? void 0 : _this$_reporter$onBeg.call(_this$_reporter, this.
|
|
122
|
+
(_this$_reporter$onBeg = (_this$_reporter = this._reporter).onBegin) === null || _this$_reporter$onBeg === void 0 ? void 0 : _this$_reporter$onBeg.call(_this$_reporter, this._rootSuite);
|
|
111
123
|
}
|
|
112
124
|
_onTestBegin(testId, payload) {
|
|
113
125
|
var _this$_reporter$onTes, _this$_reporter2;
|
|
@@ -187,7 +199,7 @@ class TeleReporterReceiver {
|
|
|
187
199
|
}
|
|
188
200
|
_onEnd(result) {
|
|
189
201
|
var _this$_reporter$onEnd, _this$_reporter9;
|
|
190
|
-
return (
|
|
202
|
+
return (_this$_reporter$onEnd = (_this$_reporter9 = this._reporter).onEnd) === null || _this$_reporter$onEnd === void 0 ? void 0 : _this$_reporter$onEnd.call(_this$_reporter9, result);
|
|
191
203
|
}
|
|
192
204
|
_onExit() {
|
|
193
205
|
var _this$_reporter$onExi, _this$_reporter10;
|
package/lib/reporters/base.js
CHANGED
|
@@ -51,9 +51,14 @@ class BaseReporter {
|
|
|
51
51
|
this._omitFailures = options.omitFailures || false;
|
|
52
52
|
this._ttyWidthForTest = parseInt(process.env.PWTEST_TTY_WIDTH || '', 10);
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
version() {
|
|
55
|
+
return 'v2';
|
|
56
|
+
}
|
|
57
|
+
onConfigure(config) {
|
|
56
58
|
this.config = config;
|
|
59
|
+
}
|
|
60
|
+
onBegin(suite) {
|
|
61
|
+
this.monotonicStartTime = (0, _utils.monotonicTime)();
|
|
57
62
|
this.suite = suite;
|
|
58
63
|
this.totalTestCount = suite.allTests().length;
|
|
59
64
|
}
|
|
@@ -74,6 +79,7 @@ class BaseReporter {
|
|
|
74
79
|
result[kOutputSymbol] = result[kOutputSymbol] || [];
|
|
75
80
|
result[kOutputSymbol].push(output);
|
|
76
81
|
}
|
|
82
|
+
onTestBegin(test, result) {}
|
|
77
83
|
onTestEnd(test, result) {
|
|
78
84
|
// Ignore any tests that are run in parallel.
|
|
79
85
|
for (let suite = test.parent; suite; suite = suite.parent) {
|
|
@@ -92,6 +98,12 @@ class BaseReporter {
|
|
|
92
98
|
this.duration = (0, _utils.monotonicTime)() - this.monotonicStartTime;
|
|
93
99
|
this.result = result;
|
|
94
100
|
}
|
|
101
|
+
onStepBegin(test, result, step) {}
|
|
102
|
+
onStepEnd(test, result, step) {}
|
|
103
|
+
async onExit() {}
|
|
104
|
+
printsToStdio() {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
95
107
|
ttyWidth() {
|
|
96
108
|
return this._ttyWidthForTest || process.stdout.columns || 0;
|
|
97
109
|
}
|
|
@@ -104,7 +116,8 @@ class BaseReporter {
|
|
|
104
116
|
return fitToWidth(line, ttyWidth, prefix);
|
|
105
117
|
}
|
|
106
118
|
generateStartingMessage() {
|
|
107
|
-
|
|
119
|
+
var _this$config$metadata;
|
|
120
|
+
const jobs = (_this$config$metadata = this.config.metadata.actualWorkers) !== null && _this$config$metadata !== void 0 ? _this$config$metadata : this.config.workers;
|
|
108
121
|
const shardDetails = this.config.shard ? `, shard ${this.config.shard.current} of ${this.config.shard.total}` : '';
|
|
109
122
|
if (!this.totalTestCount) return '';
|
|
110
123
|
return '\n' + _utilsBundle.colors.dim('Running ') + this.totalTestCount + _utilsBundle.colors.dim(` test${this.totalTestCount !== 1 ? 's' : ''} using `) + jobs + _utilsBundle.colors.dim(` worker${jobs !== 1 ? 's' : ''}${shardDetails}`);
|
package/lib/reporters/blob.js
CHANGED
|
@@ -46,16 +46,17 @@ class BlobReporter extends _teleEmitter.TeleReporterEmitter {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
onBegin(config, suite) {
|
|
49
|
+
onConfigure(config) {
|
|
53
50
|
this._outputDir = _path.default.resolve(this._options.configDir, this._options.outputDir || 'blob-report');
|
|
51
|
+
this._reportName = this._computeReportName(config);
|
|
52
|
+
super.onConfigure(config);
|
|
53
|
+
}
|
|
54
|
+
onBegin(suite) {
|
|
55
|
+
// Note: config.outputDir is cleared betwee onConfigure and onBegin, so we call mkdir here.
|
|
54
56
|
_fs.default.mkdirSync(_path.default.join(this._outputDir, 'resources'), {
|
|
55
57
|
recursive: true
|
|
56
58
|
});
|
|
57
|
-
|
|
58
|
-
super.onBegin(config, suite);
|
|
59
|
+
super.onBegin(suite);
|
|
59
60
|
}
|
|
60
61
|
async onEnd(result) {
|
|
61
62
|
await super.onEnd(result);
|
|
@@ -67,12 +68,14 @@ class BlobReporter extends _teleEmitter.TeleReporterEmitter {
|
|
|
67
68
|
const zipFileName = _path.default.join(this._outputDir, this._reportName + '.zip');
|
|
68
69
|
zipFile.outputStream.pipe(_fs.default.createWriteStream(zipFileName)).on('close', () => {
|
|
69
70
|
zipFinishPromise.resolve(undefined);
|
|
70
|
-
});
|
|
71
|
+
}).on('error', error => zipFinishPromise.reject(error));
|
|
71
72
|
zipFile.addReadStream(content, this._reportName + '.jsonl');
|
|
72
73
|
zipFile.end();
|
|
73
74
|
await Promise.all([...this._copyFilePromises,
|
|
74
75
|
// Requires Node v14.18.0+
|
|
75
|
-
zipFinishPromise.catch(e =>
|
|
76
|
+
zipFinishPromise.catch(e => {
|
|
77
|
+
throw new Error(`Failed to write report ${zipFileName}: ` + e.message);
|
|
78
|
+
})]);
|
|
76
79
|
}
|
|
77
80
|
_serializeAttachments(attachments) {
|
|
78
81
|
return super._serializeAttachments(attachments).map(attachment => {
|
package/lib/reporters/dot.js
CHANGED
|
@@ -30,8 +30,8 @@ class DotReporter extends _base.BaseReporter {
|
|
|
30
30
|
printsToStdio() {
|
|
31
31
|
return true;
|
|
32
32
|
}
|
|
33
|
-
onBegin(
|
|
34
|
-
super.onBegin(
|
|
33
|
+
onBegin(suite) {
|
|
34
|
+
super.onBegin(suite);
|
|
35
35
|
console.log(this.generateStartingMessage());
|
|
36
36
|
}
|
|
37
37
|
onStdOut(chunk, test, result) {
|
package/lib/reporters/empty.js
CHANGED
|
@@ -20,6 +20,24 @@ exports.default = void 0;
|
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
class EmptyReporter {
|
|
23
|
+
class EmptyReporter {
|
|
24
|
+
onConfigure(config) {}
|
|
25
|
+
onBegin(suite) {}
|
|
26
|
+
onTestBegin(test, result) {}
|
|
27
|
+
onStdOut(chunk, test, result) {}
|
|
28
|
+
onStdErr(chunk, test, result) {}
|
|
29
|
+
onTestEnd(test, result) {}
|
|
30
|
+
async onEnd(result) {}
|
|
31
|
+
async onExit() {}
|
|
32
|
+
onError(error) {}
|
|
33
|
+
onStepBegin(test, result, step) {}
|
|
34
|
+
onStepEnd(test, result, step) {}
|
|
35
|
+
printsToStdio() {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
version() {
|
|
39
|
+
return 'v2';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
24
42
|
var _default = EmptyReporter;
|
|
25
43
|
exports.default = _default;
|
package/lib/reporters/html.js
CHANGED
|
@@ -16,6 +16,7 @@ var _base = require("./base");
|
|
|
16
16
|
var _util = require("../util");
|
|
17
17
|
var _zipBundle = require("playwright-core/lib/zipBundle");
|
|
18
18
|
var _config = require("../common/config");
|
|
19
|
+
var _empty = _interopRequireDefault(require("./empty"));
|
|
19
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
21
|
/**
|
|
21
22
|
* Copyright (c) Microsoft Corporation.
|
|
@@ -33,8 +34,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
33
34
|
* limitations under the License.
|
|
34
35
|
*/
|
|
35
36
|
|
|
36
|
-
class HtmlReporter {
|
|
37
|
+
class HtmlReporter extends _empty.default {
|
|
37
38
|
constructor(options) {
|
|
39
|
+
super();
|
|
38
40
|
this.config = void 0;
|
|
39
41
|
this.suite = void 0;
|
|
40
42
|
this._options = void 0;
|
|
@@ -47,8 +49,10 @@ class HtmlReporter {
|
|
|
47
49
|
printsToStdio() {
|
|
48
50
|
return false;
|
|
49
51
|
}
|
|
50
|
-
|
|
52
|
+
onConfigure(config) {
|
|
51
53
|
this.config = config;
|
|
54
|
+
}
|
|
55
|
+
onBegin(suite) {
|
|
52
56
|
const {
|
|
53
57
|
outputFolder,
|
|
54
58
|
open,
|
|
@@ -58,7 +62,7 @@ class HtmlReporter {
|
|
|
58
62
|
this._open = open;
|
|
59
63
|
this._attachmentsBaseURL = attachmentsBaseURL;
|
|
60
64
|
const reportedWarnings = new Set();
|
|
61
|
-
for (const project of config.projects) {
|
|
65
|
+
for (const project of this.config.projects) {
|
|
62
66
|
if (outputFolder.startsWith(project.outputDir) || project.outputDir.startsWith(outputFolder)) {
|
|
63
67
|
const key = outputFolder + '|' + project.outputDir;
|
|
64
68
|
if (reportedWarnings.has(key)) continue;
|
|
@@ -8,7 +8,6 @@ var _fs = _interopRequireDefault(require("fs"));
|
|
|
8
8
|
var _utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
9
9
|
var _babelBundle = require("../transform/babelBundle");
|
|
10
10
|
var _test = require("../common/test");
|
|
11
|
-
var _multiplexer = require("./multiplexer");
|
|
12
11
|
var _base = require("./base");
|
|
13
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
13
|
/**
|
|
@@ -28,90 +27,65 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
28
27
|
*/
|
|
29
28
|
|
|
30
29
|
class InternalReporter {
|
|
31
|
-
constructor(
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
30
|
+
constructor(reporter) {
|
|
31
|
+
this._reporter = void 0;
|
|
32
|
+
this._didBegin = false;
|
|
34
33
|
this._config = void 0;
|
|
35
|
-
this.
|
|
34
|
+
this._reporter = reporter;
|
|
35
|
+
}
|
|
36
|
+
version() {
|
|
37
|
+
return 'v2';
|
|
36
38
|
}
|
|
37
39
|
onConfigure(config) {
|
|
38
40
|
this._config = config;
|
|
41
|
+
this._reporter.onConfigure(config);
|
|
39
42
|
}
|
|
40
|
-
onBegin(
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
this._deferred = null;
|
|
44
|
-
for (const item of deferred) {
|
|
45
|
-
if (item.error) this.onError(item.error);
|
|
46
|
-
if (item.stdout) this.onStdOut(item.stdout.chunk, item.stdout.test, item.stdout.result);
|
|
47
|
-
if (item.stderr) this.onStdErr(item.stderr.chunk, item.stderr.test, item.stderr.result);
|
|
48
|
-
}
|
|
43
|
+
onBegin(suite) {
|
|
44
|
+
this._didBegin = true;
|
|
45
|
+
this._reporter.onBegin(suite);
|
|
49
46
|
}
|
|
50
47
|
onTestBegin(test, result) {
|
|
51
|
-
this.
|
|
48
|
+
this._reporter.onTestBegin(test, result);
|
|
52
49
|
}
|
|
53
50
|
onStdOut(chunk, test, result) {
|
|
54
|
-
|
|
55
|
-
this._deferred.push({
|
|
56
|
-
stdout: {
|
|
57
|
-
chunk,
|
|
58
|
-
test,
|
|
59
|
-
result
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
this._multiplexer.onStdOut(chunk, test, result);
|
|
51
|
+
this._reporter.onStdOut(chunk, test, result);
|
|
65
52
|
}
|
|
66
53
|
onStdErr(chunk, test, result) {
|
|
67
|
-
|
|
68
|
-
this._deferred.push({
|
|
69
|
-
stderr: {
|
|
70
|
-
chunk,
|
|
71
|
-
test,
|
|
72
|
-
result
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
this._multiplexer.onStdErr(chunk, test, result);
|
|
54
|
+
this._reporter.onStdErr(chunk, test, result);
|
|
78
55
|
}
|
|
79
56
|
onTestEnd(test, result) {
|
|
80
57
|
this._addSnippetToTestErrors(test, result);
|
|
81
|
-
this.
|
|
58
|
+
this._reporter.onTestEnd(test, result);
|
|
82
59
|
}
|
|
83
60
|
async onEnd(result) {
|
|
84
|
-
if (this.
|
|
61
|
+
if (!this._didBegin) {
|
|
85
62
|
// onBegin was not reported, emit it.
|
|
86
|
-
this.onBegin(
|
|
63
|
+
this.onBegin(new _test.Suite('', 'root'));
|
|
87
64
|
}
|
|
88
|
-
await this.
|
|
65
|
+
await this._reporter.onEnd(result);
|
|
89
66
|
}
|
|
90
67
|
async onExit() {
|
|
91
|
-
await this.
|
|
68
|
+
await this._reporter.onExit();
|
|
92
69
|
}
|
|
93
70
|
onError(error) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
error
|
|
97
|
-
});
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
addLocationAndSnippetToError(this._config.config, error);
|
|
101
|
-
this._multiplexer.onError(error);
|
|
71
|
+
addLocationAndSnippetToError(this._config, error);
|
|
72
|
+
this._reporter.onError(error);
|
|
102
73
|
}
|
|
103
74
|
onStepBegin(test, result, step) {
|
|
104
|
-
this.
|
|
75
|
+
this._reporter.onStepBegin(test, result, step);
|
|
105
76
|
}
|
|
106
77
|
onStepEnd(test, result, step) {
|
|
107
78
|
this._addSnippetToStepError(test, step);
|
|
108
|
-
this.
|
|
79
|
+
this._reporter.onStepEnd(test, result, step);
|
|
80
|
+
}
|
|
81
|
+
printsToStdio() {
|
|
82
|
+
return this._reporter.printsToStdio();
|
|
109
83
|
}
|
|
110
84
|
_addSnippetToTestErrors(test, result) {
|
|
111
|
-
for (const error of result.errors) addLocationAndSnippetToError(this._config
|
|
85
|
+
for (const error of result.errors) addLocationAndSnippetToError(this._config, error, test.location.file);
|
|
112
86
|
}
|
|
113
87
|
_addSnippetToStepError(test, step) {
|
|
114
|
-
if (step.error) addLocationAndSnippetToError(this._config
|
|
88
|
+
if (step.error) addLocationAndSnippetToError(this._config, step.error, test.location.file);
|
|
115
89
|
}
|
|
116
90
|
}
|
|
117
91
|
exports.InternalReporter = InternalReporter;
|
package/lib/reporters/json.js
CHANGED
|
@@ -11,6 +11,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
11
11
|
var _base = require("./base");
|
|
12
12
|
var _utils = require("playwright-core/lib/utils");
|
|
13
13
|
var _config = require("../common/config");
|
|
14
|
+
var _empty = _interopRequireDefault(require("./empty"));
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
16
|
/**
|
|
16
17
|
* Copyright (c) Microsoft Corporation.
|
|
@@ -31,8 +32,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
31
32
|
function toPosixPath(aPath) {
|
|
32
33
|
return aPath.split(_path.default.sep).join(_path.default.posix.sep);
|
|
33
34
|
}
|
|
34
|
-
class JSONReporter {
|
|
35
|
+
class JSONReporter extends _empty.default {
|
|
35
36
|
constructor(options = {}) {
|
|
37
|
+
super();
|
|
36
38
|
this.config = void 0;
|
|
37
39
|
this.suite = void 0;
|
|
38
40
|
this._errors = [];
|
|
@@ -42,8 +44,10 @@ class JSONReporter {
|
|
|
42
44
|
printsToStdio() {
|
|
43
45
|
return !this._outputFile;
|
|
44
46
|
}
|
|
45
|
-
|
|
47
|
+
onConfigure(config) {
|
|
46
48
|
this.config = config;
|
|
49
|
+
}
|
|
50
|
+
onBegin(suite) {
|
|
47
51
|
this.suite = suite;
|
|
48
52
|
}
|
|
49
53
|
onError(error) {
|
package/lib/reporters/junit.js
CHANGED
|
@@ -8,6 +8,7 @@ var _fs = _interopRequireDefault(require("fs"));
|
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
var _utils = require("playwright-core/lib/utils");
|
|
10
10
|
var _base = require("./base");
|
|
11
|
+
var _empty = _interopRequireDefault(require("./empty"));
|
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
13
|
/**
|
|
13
14
|
* Copyright (c) Microsoft Corporation.
|
|
@@ -25,8 +26,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
26
|
* limitations under the License.
|
|
26
27
|
*/
|
|
27
28
|
|
|
28
|
-
class JUnitReporter {
|
|
29
|
+
class JUnitReporter extends _empty.default {
|
|
29
30
|
constructor(options = {}) {
|
|
31
|
+
super();
|
|
30
32
|
this.config = void 0;
|
|
31
33
|
this.suite = void 0;
|
|
32
34
|
this.timestamp = void 0;
|
|
@@ -42,8 +44,10 @@ class JUnitReporter {
|
|
|
42
44
|
printsToStdio() {
|
|
43
45
|
return !this.outputFile;
|
|
44
46
|
}
|
|
45
|
-
|
|
47
|
+
onConfigure(config) {
|
|
46
48
|
this.config = config;
|
|
49
|
+
}
|
|
50
|
+
onBegin(suite) {
|
|
47
51
|
this.suite = suite;
|
|
48
52
|
this.timestamp = new Date();
|
|
49
53
|
this.startTime = (0, _utils.monotonicTime)();
|
package/lib/reporters/line.js
CHANGED
|
@@ -32,8 +32,8 @@ class LineReporter extends _base.BaseReporter {
|
|
|
32
32
|
printsToStdio() {
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
|
-
onBegin(
|
|
36
|
-
super.onBegin(
|
|
35
|
+
onBegin(suite) {
|
|
36
|
+
super.onBegin(suite);
|
|
37
37
|
console.log(this.generateStartingMessage());
|
|
38
38
|
console.log();
|
|
39
39
|
}
|
|
@@ -59,13 +59,16 @@ class LineReporter extends _base.BaseReporter {
|
|
|
59
59
|
console.log();
|
|
60
60
|
}
|
|
61
61
|
onTestBegin(test, result) {
|
|
62
|
+
super.onTestBegin(test, result);
|
|
62
63
|
++this._current;
|
|
63
64
|
this._updateLine(test, result, undefined);
|
|
64
65
|
}
|
|
65
66
|
onStepBegin(test, result, step) {
|
|
67
|
+
super.onStepBegin(test, result, step);
|
|
66
68
|
if (step.category === 'test.step') this._updateLine(test, result, step);
|
|
67
69
|
}
|
|
68
70
|
onStepEnd(test, result, step) {
|
|
71
|
+
super.onStepEnd(test, result, step);
|
|
69
72
|
if (step.category === 'test.step') this._updateLine(test, result, step.parent);
|
|
70
73
|
}
|
|
71
74
|
onTestEnd(test, result) {
|
package/lib/reporters/list.js
CHANGED
|
@@ -46,8 +46,8 @@ class ListReporter extends _base.BaseReporter {
|
|
|
46
46
|
printsToStdio() {
|
|
47
47
|
return true;
|
|
48
48
|
}
|
|
49
|
-
onBegin(
|
|
50
|
-
super.onBegin(
|
|
49
|
+
onBegin(suite) {
|
|
50
|
+
super.onBegin(suite);
|
|
51
51
|
const startingMessage = this.generateStartingMessage();
|
|
52
52
|
if (startingMessage) {
|
|
53
53
|
console.log(startingMessage);
|
|
@@ -55,6 +55,7 @@ class ListReporter extends _base.BaseReporter {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
onTestBegin(test, result) {
|
|
58
|
+
super.onTestBegin(test, result);
|
|
58
59
|
if (this._liveTerminal) this._maybeWriteNewLine();
|
|
59
60
|
this._resultIndex.set(result, String(this._resultIndex.size + 1));
|
|
60
61
|
if (this._liveTerminal) {
|
|
@@ -74,6 +75,7 @@ class ListReporter extends _base.BaseReporter {
|
|
|
74
75
|
this._dumpToStdio(test, chunk, process.stderr);
|
|
75
76
|
}
|
|
76
77
|
onStepBegin(test, result, step) {
|
|
78
|
+
super.onStepBegin(test, result, step);
|
|
77
79
|
if (step.category !== 'test.step') return;
|
|
78
80
|
const testIndex = this._resultIndex.get(result);
|
|
79
81
|
if (!this._printSteps) {
|
|
@@ -93,6 +95,7 @@ class ListReporter extends _base.BaseReporter {
|
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
onStepEnd(test, result, step) {
|
|
98
|
+
super.onStepEnd(test, result, step);
|
|
96
99
|
if (step.category !== 'test.step') return;
|
|
97
100
|
const testIndex = this._resultIndex.get(result);
|
|
98
101
|
if (!this._printSteps) {
|
package/lib/reporters/merge.js
CHANGED
|
@@ -62,23 +62,23 @@ async function extractReportFromZip(file) {
|
|
|
62
62
|
}
|
|
63
63
|
async function mergeEvents(dir, shardReportFiles) {
|
|
64
64
|
const events = [];
|
|
65
|
+
const configureEvents = [];
|
|
65
66
|
const beginEvents = [];
|
|
66
67
|
const endEvents = [];
|
|
67
68
|
for (const reportFile of shardReportFiles) {
|
|
68
69
|
const reportJsonl = await extractReportFromZip(_path.default.join(dir, reportFile));
|
|
69
70
|
const parsedEvents = parseEvents(reportJsonl);
|
|
70
71
|
for (const event of parsedEvents) {
|
|
71
|
-
if (event.method === 'onBegin') beginEvents.push(event);else if (event.method === 'onEnd') endEvents.push(event);else if (event.method === 'onBlobReportMetadata') new ProjectNamePatcher(event.params.projectSuffix).patchEvents(parsedEvents);else events.push(event);
|
|
72
|
+
if (event.method === 'onConfigure') configureEvents.push(event);else if (event.method === 'onBegin') beginEvents.push(event);else if (event.method === 'onEnd') endEvents.push(event);else if (event.method === 'onBlobReportMetadata') new ProjectNamePatcher(event.params.projectSuffix).patchEvents(parsedEvents);else events.push(event);
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
|
-
return [mergeBeginEvents(beginEvents), ...events, mergeEndEvents(endEvents), {
|
|
75
|
+
return [mergeConfigureEvents(configureEvents), mergeBeginEvents(beginEvents), ...events, mergeEndEvents(endEvents), {
|
|
75
76
|
method: 'onExit',
|
|
76
77
|
params: undefined
|
|
77
78
|
}];
|
|
78
79
|
}
|
|
79
|
-
function
|
|
80
|
-
if (!
|
|
81
|
-
const projects = [];
|
|
80
|
+
function mergeConfigureEvents(configureEvents) {
|
|
81
|
+
if (!configureEvents.length) throw new Error('No configure events found');
|
|
82
82
|
let config = {
|
|
83
83
|
configFile: undefined,
|
|
84
84
|
globalTimeout: 0,
|
|
@@ -91,8 +91,18 @@ function mergeBeginEvents(beginEvents) {
|
|
|
91
91
|
workers: 0,
|
|
92
92
|
listOnly: false
|
|
93
93
|
};
|
|
94
|
+
for (const event of configureEvents) config = mergeConfigs(config, event.params.config);
|
|
95
|
+
return {
|
|
96
|
+
method: 'onConfigure',
|
|
97
|
+
params: {
|
|
98
|
+
config
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function mergeBeginEvents(beginEvents) {
|
|
103
|
+
if (!beginEvents.length) throw new Error('No begin events found');
|
|
104
|
+
const projects = [];
|
|
94
105
|
for (const event of beginEvents) {
|
|
95
|
-
config = mergeConfigs(config, event.params.config);
|
|
96
106
|
const shardProjects = event.params.projects;
|
|
97
107
|
for (const shardProject of shardProjects) {
|
|
98
108
|
const mergedProject = projects.find(p => p.id === shardProject.id);
|
|
@@ -102,7 +112,6 @@ function mergeBeginEvents(beginEvents) {
|
|
|
102
112
|
return {
|
|
103
113
|
method: 'onBegin',
|
|
104
114
|
params: {
|
|
105
|
-
config,
|
|
106
115
|
projects
|
|
107
116
|
}
|
|
108
117
|
};
|
|
@@ -114,7 +123,8 @@ function mergeConfigs(to, from) {
|
|
|
114
123
|
metadata: {
|
|
115
124
|
...to.metadata,
|
|
116
125
|
...from.metadata,
|
|
117
|
-
totalTime: to.metadata.totalTime + from.metadata.totalTime
|
|
126
|
+
totalTime: to.metadata.totalTime + from.metadata.totalTime,
|
|
127
|
+
actualWorkers: (to.metadata.actualWorkers || 0) + (from.metadata.actualWorkers || 0)
|
|
118
128
|
},
|
|
119
129
|
workers: to.workers + from.workers
|
|
120
130
|
};
|
|
@@ -25,64 +25,47 @@ class Multiplexer {
|
|
|
25
25
|
this._reporters = void 0;
|
|
26
26
|
this._reporters = reporters;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
version() {
|
|
29
|
+
return 'v2';
|
|
30
|
+
}
|
|
31
|
+
onConfigure(config) {
|
|
32
|
+
for (const reporter of this._reporters) wrap(() => reporter.onConfigure(config));
|
|
33
|
+
}
|
|
34
|
+
onBegin(suite) {
|
|
35
|
+
for (const reporter of this._reporters) wrap(() => reporter.onBegin(suite));
|
|
33
36
|
}
|
|
34
37
|
onTestBegin(test, result) {
|
|
35
|
-
for (const reporter of this._reporters) wrap(() =>
|
|
36
|
-
var _reporter$onTestBegin;
|
|
37
|
-
return (_reporter$onTestBegin = reporter.onTestBegin) === null || _reporter$onTestBegin === void 0 ? void 0 : _reporter$onTestBegin.call(reporter, test, result);
|
|
38
|
-
});
|
|
38
|
+
for (const reporter of this._reporters) wrap(() => reporter.onTestBegin(test, result));
|
|
39
39
|
}
|
|
40
40
|
onStdOut(chunk, test, result) {
|
|
41
|
-
for (const reporter of this._reporters) wrap(() =>
|
|
42
|
-
var _reporter$onStdOut;
|
|
43
|
-
return (_reporter$onStdOut = reporter.onStdOut) === null || _reporter$onStdOut === void 0 ? void 0 : _reporter$onStdOut.call(reporter, chunk, test, result);
|
|
44
|
-
});
|
|
41
|
+
for (const reporter of this._reporters) wrap(() => reporter.onStdOut(chunk, test, result));
|
|
45
42
|
}
|
|
46
43
|
onStdErr(chunk, test, result) {
|
|
47
|
-
for (const reporter of this._reporters) wrap(() =>
|
|
48
|
-
var _reporter$onStdErr;
|
|
49
|
-
return (_reporter$onStdErr = reporter.onStdErr) === null || _reporter$onStdErr === void 0 ? void 0 : _reporter$onStdErr.call(reporter, chunk, test, result);
|
|
50
|
-
});
|
|
44
|
+
for (const reporter of this._reporters) wrap(() => reporter.onStdErr(chunk, test, result));
|
|
51
45
|
}
|
|
52
46
|
onTestEnd(test, result) {
|
|
53
|
-
for (const reporter of this._reporters) wrap(() =>
|
|
54
|
-
var _reporter$onTestEnd;
|
|
55
|
-
return (_reporter$onTestEnd = reporter.onTestEnd) === null || _reporter$onTestEnd === void 0 ? void 0 : _reporter$onTestEnd.call(reporter, test, result);
|
|
56
|
-
});
|
|
47
|
+
for (const reporter of this._reporters) wrap(() => reporter.onTestEnd(test, result));
|
|
57
48
|
}
|
|
58
49
|
async onEnd(result) {
|
|
59
|
-
for (const reporter of this._reporters) await wrapAsync(() =>
|
|
60
|
-
var _reporter$onEnd;
|
|
61
|
-
return (_reporter$onEnd = reporter.onEnd) === null || _reporter$onEnd === void 0 ? void 0 : _reporter$onEnd.call(reporter, result);
|
|
62
|
-
});
|
|
50
|
+
for (const reporter of this._reporters) await wrapAsync(() => reporter.onEnd(result));
|
|
63
51
|
}
|
|
64
52
|
async onExit() {
|
|
65
|
-
for (const reporter of this._reporters) await wrapAsync(() =>
|
|
66
|
-
var _reporter$onExit;
|
|
67
|
-
return (_reporter$onExit = reporter.onExit) === null || _reporter$onExit === void 0 ? void 0 : _reporter$onExit.call(reporter);
|
|
68
|
-
});
|
|
53
|
+
for (const reporter of this._reporters) await wrapAsync(() => reporter.onExit());
|
|
69
54
|
}
|
|
70
55
|
onError(error) {
|
|
71
|
-
for (const reporter of this._reporters) wrap(() =>
|
|
72
|
-
var _reporter$onError;
|
|
73
|
-
return (_reporter$onError = reporter.onError) === null || _reporter$onError === void 0 ? void 0 : _reporter$onError.call(reporter, error);
|
|
74
|
-
});
|
|
56
|
+
for (const reporter of this._reporters) wrap(() => reporter.onError(error));
|
|
75
57
|
}
|
|
76
58
|
onStepBegin(test, result, step) {
|
|
77
|
-
for (const reporter of this._reporters) wrap(() =>
|
|
78
|
-
var _reporter$onStepBegin;
|
|
79
|
-
return (_reporter$onStepBegin = reporter.onStepBegin) === null || _reporter$onStepBegin === void 0 ? void 0 : _reporter$onStepBegin.call(reporter, test, result, step);
|
|
80
|
-
});
|
|
59
|
+
for (const reporter of this._reporters) wrap(() => reporter.onStepBegin(test, result, step));
|
|
81
60
|
}
|
|
82
61
|
onStepEnd(test, result, step) {
|
|
83
|
-
for (const reporter of this._reporters) wrap(() =>
|
|
84
|
-
|
|
85
|
-
|
|
62
|
+
for (const reporter of this._reporters) wrap(() => reporter.onStepEnd(test, result, step));
|
|
63
|
+
}
|
|
64
|
+
printsToStdio() {
|
|
65
|
+
return this._reporters.some(r => {
|
|
66
|
+
let prints = true;
|
|
67
|
+
wrap(() => prints = r.printsToStdio());
|
|
68
|
+
return prints;
|
|
86
69
|
});
|
|
87
70
|
}
|
|
88
71
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.wrapReporterAsV2 = wrapReporterAsV2;
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) Microsoft Corporation.
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
function wrapReporterAsV2(reporter) {
|
|
24
|
+
try {
|
|
25
|
+
if ('version' in reporter && reporter.version() === 'v2') return reporter;
|
|
26
|
+
} catch (e) {}
|
|
27
|
+
return new ReporterV2Wrapper(reporter);
|
|
28
|
+
}
|
|
29
|
+
class ReporterV2Wrapper {
|
|
30
|
+
constructor(reporter) {
|
|
31
|
+
this._reporter = void 0;
|
|
32
|
+
this._deferred = [];
|
|
33
|
+
this._config = void 0;
|
|
34
|
+
this._reporter = reporter;
|
|
35
|
+
}
|
|
36
|
+
version() {
|
|
37
|
+
return 'v2';
|
|
38
|
+
}
|
|
39
|
+
onConfigure(config) {
|
|
40
|
+
this._config = config;
|
|
41
|
+
}
|
|
42
|
+
onBegin(suite) {
|
|
43
|
+
var _this$_reporter$onBeg, _this$_reporter;
|
|
44
|
+
(_this$_reporter$onBeg = (_this$_reporter = this._reporter).onBegin) === null || _this$_reporter$onBeg === void 0 ? void 0 : _this$_reporter$onBeg.call(_this$_reporter, this._config, suite);
|
|
45
|
+
const deferred = this._deferred;
|
|
46
|
+
this._deferred = null;
|
|
47
|
+
for (const item of deferred) {
|
|
48
|
+
if (item.error) this.onError(item.error);
|
|
49
|
+
if (item.stdout) this.onStdOut(item.stdout.chunk, item.stdout.test, item.stdout.result);
|
|
50
|
+
if (item.stderr) this.onStdErr(item.stderr.chunk, item.stderr.test, item.stderr.result);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
onTestBegin(test, result) {
|
|
54
|
+
var _this$_reporter$onTes, _this$_reporter2;
|
|
55
|
+
(_this$_reporter$onTes = (_this$_reporter2 = this._reporter).onTestBegin) === null || _this$_reporter$onTes === void 0 ? void 0 : _this$_reporter$onTes.call(_this$_reporter2, test, result);
|
|
56
|
+
}
|
|
57
|
+
onStdOut(chunk, test, result) {
|
|
58
|
+
var _this$_reporter$onStd, _this$_reporter3;
|
|
59
|
+
if (this._deferred) {
|
|
60
|
+
this._deferred.push({
|
|
61
|
+
stdout: {
|
|
62
|
+
chunk,
|
|
63
|
+
test,
|
|
64
|
+
result
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
(_this$_reporter$onStd = (_this$_reporter3 = this._reporter).onStdOut) === null || _this$_reporter$onStd === void 0 ? void 0 : _this$_reporter$onStd.call(_this$_reporter3, chunk, test, result);
|
|
70
|
+
}
|
|
71
|
+
onStdErr(chunk, test, result) {
|
|
72
|
+
var _this$_reporter$onStd2, _this$_reporter4;
|
|
73
|
+
if (this._deferred) {
|
|
74
|
+
this._deferred.push({
|
|
75
|
+
stderr: {
|
|
76
|
+
chunk,
|
|
77
|
+
test,
|
|
78
|
+
result
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
(_this$_reporter$onStd2 = (_this$_reporter4 = this._reporter).onStdErr) === null || _this$_reporter$onStd2 === void 0 ? void 0 : _this$_reporter$onStd2.call(_this$_reporter4, chunk, test, result);
|
|
84
|
+
}
|
|
85
|
+
onTestEnd(test, result) {
|
|
86
|
+
var _this$_reporter$onTes2, _this$_reporter5;
|
|
87
|
+
(_this$_reporter$onTes2 = (_this$_reporter5 = this._reporter).onTestEnd) === null || _this$_reporter$onTes2 === void 0 ? void 0 : _this$_reporter$onTes2.call(_this$_reporter5, test, result);
|
|
88
|
+
}
|
|
89
|
+
async onEnd(result) {
|
|
90
|
+
var _this$_reporter$onEnd, _this$_reporter6;
|
|
91
|
+
await ((_this$_reporter$onEnd = (_this$_reporter6 = this._reporter).onEnd) === null || _this$_reporter$onEnd === void 0 ? void 0 : _this$_reporter$onEnd.call(_this$_reporter6, result));
|
|
92
|
+
}
|
|
93
|
+
async onExit() {
|
|
94
|
+
var _this$_reporter$onExi, _this$_reporter7;
|
|
95
|
+
await ((_this$_reporter$onExi = (_this$_reporter7 = this._reporter).onExit) === null || _this$_reporter$onExi === void 0 ? void 0 : _this$_reporter$onExi.call(_this$_reporter7));
|
|
96
|
+
}
|
|
97
|
+
onError(error) {
|
|
98
|
+
var _this$_reporter$onErr, _this$_reporter8;
|
|
99
|
+
if (this._deferred) {
|
|
100
|
+
this._deferred.push({
|
|
101
|
+
error
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
(_this$_reporter$onErr = (_this$_reporter8 = this._reporter).onError) === null || _this$_reporter$onErr === void 0 ? void 0 : _this$_reporter$onErr.call(_this$_reporter8, error);
|
|
106
|
+
}
|
|
107
|
+
onStepBegin(test, result, step) {
|
|
108
|
+
var _this$_reporter$onSte, _this$_reporter9;
|
|
109
|
+
(_this$_reporter$onSte = (_this$_reporter9 = this._reporter).onStepBegin) === null || _this$_reporter$onSte === void 0 ? void 0 : _this$_reporter$onSte.call(_this$_reporter9, test, result, step);
|
|
110
|
+
}
|
|
111
|
+
onStepEnd(test, result, step) {
|
|
112
|
+
var _this$_reporter$onSte2, _this$_reporter10;
|
|
113
|
+
(_this$_reporter$onSte2 = (_this$_reporter10 = this._reporter).onStepEnd) === null || _this$_reporter$onSte2 === void 0 ? void 0 : _this$_reporter$onSte2.call(_this$_reporter10, test, result, step);
|
|
114
|
+
}
|
|
115
|
+
printsToStdio() {
|
|
116
|
+
return this._reporter.printsToStdio ? this._reporter.printsToStdio() : true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -33,13 +33,23 @@ class TeleReporterEmitter {
|
|
|
33
33
|
this._messageSink = messageSink;
|
|
34
34
|
this._skipBuffers = skipBuffers;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
version() {
|
|
37
|
+
return 'v2';
|
|
38
|
+
}
|
|
39
|
+
onConfigure(config) {
|
|
37
40
|
this._rootDir = config.rootDir;
|
|
41
|
+
this._messageSink({
|
|
42
|
+
method: 'onConfigure',
|
|
43
|
+
params: {
|
|
44
|
+
config: this._serializeConfig(config)
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
onBegin(suite) {
|
|
38
49
|
const projects = suite.suites.map(projectSuite => this._serializeProject(projectSuite));
|
|
39
50
|
this._messageSink({
|
|
40
51
|
method: 'onBegin',
|
|
41
52
|
params: {
|
|
42
|
-
config: this._serializeConfig(config),
|
|
43
53
|
projects
|
|
44
54
|
}
|
|
45
55
|
});
|
|
@@ -127,6 +137,9 @@ class TeleReporterEmitter {
|
|
|
127
137
|
});
|
|
128
138
|
}
|
|
129
139
|
async onExit() {}
|
|
140
|
+
printsToStdio() {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
130
143
|
_serializeConfig(config) {
|
|
131
144
|
var _FullConfigInternal$f;
|
|
132
145
|
return {
|
package/lib/runner/reporters.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ListModeReporter = void 0;
|
|
7
6
|
exports.createReporters = createReporters;
|
|
8
7
|
var _path = _interopRequireDefault(require("path"));
|
|
9
8
|
var _base = require("../reporters/base");
|
|
@@ -18,6 +17,7 @@ var _list = _interopRequireDefault(require("../reporters/list"));
|
|
|
18
17
|
var _markdown = _interopRequireDefault(require("../reporters/markdown"));
|
|
19
18
|
var _loadUtils = require("./loadUtils");
|
|
20
19
|
var _blob = require("../reporters/blob");
|
|
20
|
+
var _reporterV = require("../reporters/reporterV2");
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
22
|
/**
|
|
23
23
|
* Copyright Microsoft Corporation. All rights reserved.
|
|
@@ -38,6 +38,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
38
38
|
async function createReporters(config, mode, descriptions) {
|
|
39
39
|
var _descriptions;
|
|
40
40
|
const defaultReporters = {
|
|
41
|
+
blob: _blob.BlobReporter,
|
|
41
42
|
dot: mode === 'list' ? ListModeReporter : _dot.default,
|
|
42
43
|
line: mode === 'list' ? ListModeReporter : _line.default,
|
|
43
44
|
list: mode === 'list' ? ListModeReporter : _list.default,
|
|
@@ -46,7 +47,6 @@ async function createReporters(config, mode, descriptions) {
|
|
|
46
47
|
junit: _junit.default,
|
|
47
48
|
null: _empty.default,
|
|
48
49
|
html: mode === 'ui' ? _line.default : _html.default,
|
|
49
|
-
blob: _blob.BlobReporter,
|
|
50
50
|
markdown: _markdown.default
|
|
51
51
|
};
|
|
52
52
|
const reporters = [];
|
|
@@ -61,17 +61,14 @@ async function createReporters(config, mode, descriptions) {
|
|
|
61
61
|
reporters.push(new defaultReporters[name](options));
|
|
62
62
|
} else {
|
|
63
63
|
const reporterConstructor = await (0, _loadUtils.loadReporter)(config, name);
|
|
64
|
-
reporters.push(new reporterConstructor(options));
|
|
64
|
+
reporters.push((0, _reporterV.wrapReporterAsV2)(new reporterConstructor(options)));
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
if (process.env.PW_TEST_REPORTER) {
|
|
68
68
|
const reporterConstructor = await (0, _loadUtils.loadReporter)(config, process.env.PW_TEST_REPORTER);
|
|
69
|
-
reporters.push(new reporterConstructor());
|
|
69
|
+
reporters.push((0, _reporterV.wrapReporterAsV2)(new reporterConstructor()));
|
|
70
70
|
}
|
|
71
|
-
const someReporterPrintsToStdio = reporters.some(r =>
|
|
72
|
-
const prints = r.printsToStdio ? r.printsToStdio() : true;
|
|
73
|
-
return prints;
|
|
74
|
-
});
|
|
71
|
+
const someReporterPrintsToStdio = reporters.some(r => r.printsToStdio());
|
|
75
72
|
if (reporters.length && !someReporterPrintsToStdio) {
|
|
76
73
|
// Add a line/dot/list-mode reporter for convenience.
|
|
77
74
|
// Important to put it first, jsut in case some other reporter stalls onEnd.
|
|
@@ -81,12 +78,15 @@ async function createReporters(config, mode, descriptions) {
|
|
|
81
78
|
}
|
|
82
79
|
return reporters;
|
|
83
80
|
}
|
|
84
|
-
class ListModeReporter {
|
|
85
|
-
constructor() {
|
|
81
|
+
class ListModeReporter extends _empty.default {
|
|
82
|
+
constructor(...args) {
|
|
83
|
+
super(...args);
|
|
86
84
|
this.config = void 0;
|
|
87
85
|
}
|
|
88
|
-
|
|
86
|
+
onConfigure(config) {
|
|
89
87
|
this.config = config;
|
|
88
|
+
}
|
|
89
|
+
onBegin(suite) {
|
|
90
90
|
// eslint-disable-next-line no-console
|
|
91
91
|
console.log(`Listing tests:`);
|
|
92
92
|
const tests = suite.allTests();
|
|
@@ -94,7 +94,7 @@ class ListModeReporter {
|
|
|
94
94
|
for (const test of tests) {
|
|
95
95
|
// root, project, file, ...describes, test
|
|
96
96
|
const [, projectName,, ...titles] = test.titlePath();
|
|
97
|
-
const location = `${_path.default.relative(config.rootDir, test.location.file)}:${test.location.line}:${test.location.column}`;
|
|
97
|
+
const location = `${_path.default.relative(this.config.rootDir, test.location.file)}:${test.location.line}:${test.location.column}`;
|
|
98
98
|
const projectTitle = projectName ? `[${projectName}] › ` : '';
|
|
99
99
|
// eslint-disable-next-line no-console
|
|
100
100
|
console.log(` ${projectTitle}${location} › ${titles.join(' › ')}`);
|
|
@@ -107,5 +107,4 @@ class ListModeReporter {
|
|
|
107
107
|
// eslint-disable-next-line no-console
|
|
108
108
|
console.error('\n' + (0, _base.formatError)(this.config, error, false).message);
|
|
109
109
|
}
|
|
110
|
-
}
|
|
111
|
-
exports.ListModeReporter = ListModeReporter;
|
|
110
|
+
}
|
package/lib/runner/runner.js
CHANGED
|
@@ -13,6 +13,7 @@ var _utilsBundle = require("playwright-core/lib/utilsBundle");
|
|
|
13
13
|
var _watchMode = require("./watchMode");
|
|
14
14
|
var _uiMode = require("./uiMode");
|
|
15
15
|
var _internalReporter = require("../reporters/internalReporter");
|
|
16
|
+
var _multiplexer = require("../reporters/multiplexer");
|
|
16
17
|
/**
|
|
17
18
|
* Copyright 2019 Google Inc. All rights reserved.
|
|
18
19
|
* Modifications copyright (c) Microsoft Corporation.
|
|
@@ -62,12 +63,12 @@ class Runner {
|
|
|
62
63
|
(0, _webServerPlugin.webServerPluginsForConfig)(config).forEach(p => config.plugins.push({
|
|
63
64
|
factory: p
|
|
64
65
|
}));
|
|
65
|
-
const reporter = new _internalReporter.InternalReporter(await (0, _reporters.createReporters)(config, listOnly ? 'list' : 'run'));
|
|
66
|
+
const reporter = new _internalReporter.InternalReporter(new _multiplexer.Multiplexer(await (0, _reporters.createReporters)(config, listOnly ? 'list' : 'run')));
|
|
66
67
|
const taskRunner = listOnly ? (0, _tasks.createTaskRunnerForList)(config, reporter, 'in-process', {
|
|
67
68
|
failOnLoadErrors: true
|
|
68
69
|
}) : (0, _tasks.createTaskRunner)(config, reporter);
|
|
69
70
|
const testRun = new _tasks.TestRun(config, reporter);
|
|
70
|
-
reporter.onConfigure(config);
|
|
71
|
+
reporter.onConfigure(config.config);
|
|
71
72
|
if (!listOnly && config.ignoreSnapshots) {
|
|
72
73
|
reporter.onStdOut(_utilsBundle.colors.dim(['NOTE: running with "ignoreSnapshots" option. All of the following asserts are silently ignored:', '- expect().toMatchSnapshot()', '- expect().toHaveScreenshot()', ''].join('\n')));
|
|
73
74
|
}
|
package/lib/runner/tasks.js
CHANGED
|
@@ -106,7 +106,7 @@ function createReportBeginTask() {
|
|
|
106
106
|
rootSuite
|
|
107
107
|
}) => {
|
|
108
108
|
const montonicStartTime = (0, _utils.monotonicTime)();
|
|
109
|
-
reporter.onBegin(
|
|
109
|
+
reporter.onBegin(rootSuite);
|
|
110
110
|
return async () => {
|
|
111
111
|
config.config.metadata.totalTime = (0, _utils.monotonicTime)() - montonicStartTime;
|
|
112
112
|
};
|
|
@@ -228,7 +228,7 @@ function createPhasesTask() {
|
|
|
228
228
|
maxConcurrentTestGroups = Math.max(maxConcurrentTestGroups, testGroupsInPhase);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
testRun.config.config.
|
|
231
|
+
testRun.config.config.metadata.actualWorkers = Math.min(testRun.config.config.workers, maxConcurrentTestGroups);
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
234
|
function createWorkersTask() {
|
package/lib/runner/uiMode.js
CHANGED
|
@@ -14,6 +14,7 @@ var _tasks = require("./tasks");
|
|
|
14
14
|
var _utilsBundle = require("../utilsBundle");
|
|
15
15
|
var _utilsBundle2 = require("playwright-core/lib/utilsBundle");
|
|
16
16
|
var _list = _interopRequireDefault(require("../reporters/list"));
|
|
17
|
+
var _multiplexer = require("../reporters/multiplexer");
|
|
17
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
19
|
/**
|
|
19
20
|
* Copyright Microsoft Corporation. All rights reserved.
|
|
@@ -70,9 +71,9 @@ class UIMode {
|
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
async runGlobalSetup() {
|
|
73
|
-
const reporter = new _internalReporter.InternalReporter(
|
|
74
|
+
const reporter = new _internalReporter.InternalReporter(new _list.default());
|
|
74
75
|
const taskRunner = (0, _tasks.createTaskRunnerForWatchSetup)(this._config, reporter);
|
|
75
|
-
reporter.onConfigure(this._config);
|
|
76
|
+
reporter.onConfigure(this._config.config);
|
|
76
77
|
const testRun = new _tasks.TestRun(this._config, reporter);
|
|
77
78
|
const {
|
|
78
79
|
status,
|
|
@@ -157,8 +158,7 @@ class UIMode {
|
|
|
157
158
|
(_this$_transport$send = (_this$_transport = this._transport).sendEvent) === null || _this$_transport$send === void 0 ? void 0 : _this$_transport$send.call(_this$_transport, method, params);
|
|
158
159
|
}
|
|
159
160
|
async _listTests() {
|
|
160
|
-
const
|
|
161
|
-
const reporter = new _internalReporter.InternalReporter([listReporter]);
|
|
161
|
+
const reporter = new _internalReporter.InternalReporter(new _teleEmitter.TeleReporterEmitter(e => this._dispatchEvent(e.method, e.params), true));
|
|
162
162
|
this._config.cliListOnly = true;
|
|
163
163
|
this._config.testIdMatcher = undefined;
|
|
164
164
|
const taskRunner = (0, _tasks.createTaskRunnerForList)(this._config, reporter, 'out-of-process', {
|
|
@@ -166,7 +166,7 @@ class UIMode {
|
|
|
166
166
|
});
|
|
167
167
|
const testRun = new _tasks.TestRun(this._config, reporter);
|
|
168
168
|
(0, _compilationCache.clearCompilationCache)();
|
|
169
|
-
reporter.onConfigure(this._config);
|
|
169
|
+
reporter.onConfigure(this._config.config);
|
|
170
170
|
const status = await taskRunner.run(testRun, 0);
|
|
171
171
|
await reporter.onEnd({
|
|
172
172
|
status
|
|
@@ -183,11 +183,11 @@ class UIMode {
|
|
|
183
183
|
this._config.testIdMatcher = id => !testIdSet || testIdSet.has(id);
|
|
184
184
|
const reporters = await (0, _reporters.createReporters)(this._config, 'ui');
|
|
185
185
|
reporters.push(new _teleEmitter.TeleReporterEmitter(e => this._dispatchEvent(e.method, e.params), true));
|
|
186
|
-
const reporter = new _internalReporter.InternalReporter(reporters);
|
|
186
|
+
const reporter = new _internalReporter.InternalReporter(new _multiplexer.Multiplexer(reporters));
|
|
187
187
|
const taskRunner = (0, _tasks.createTaskRunnerForWatch)(this._config, reporter);
|
|
188
188
|
const testRun = new _tasks.TestRun(this._config, reporter);
|
|
189
189
|
(0, _compilationCache.clearCompilationCache)();
|
|
190
|
-
reporter.onConfigure(this._config);
|
|
190
|
+
reporter.onConfigure(this._config.config);
|
|
191
191
|
const stop = new _utils.ManualPromise();
|
|
192
192
|
const run = taskRunner.run(testRun, 0, stop).then(async status => {
|
|
193
193
|
await reporter.onEnd({
|
package/lib/runner/watchMode.js
CHANGED
|
@@ -98,10 +98,10 @@ async function runWatchModeLoop(config) {
|
|
|
98
98
|
for (const p of config.projects) p.project.retries = 0;
|
|
99
99
|
|
|
100
100
|
// Perform global setup.
|
|
101
|
-
const reporter = new _internalReporter.InternalReporter(
|
|
101
|
+
const reporter = new _internalReporter.InternalReporter(new _list.default());
|
|
102
102
|
const testRun = new _tasks.TestRun(config, reporter);
|
|
103
103
|
const taskRunner = (0, _tasks.createTaskRunnerForWatchSetup)(config, reporter);
|
|
104
|
-
reporter.onConfigure(config);
|
|
104
|
+
reporter.onConfigure(config.config);
|
|
105
105
|
const {
|
|
106
106
|
status,
|
|
107
107
|
cleanup: globalCleanup
|
|
@@ -273,11 +273,11 @@ async function runChangedTests(config, failedTestIdCollector, filesByProject, ti
|
|
|
273
273
|
}
|
|
274
274
|
async function runTests(config, failedTestIdCollector, options) {
|
|
275
275
|
printConfiguration(config, options === null || options === void 0 ? void 0 : options.title);
|
|
276
|
-
const reporter = new _internalReporter.InternalReporter(
|
|
276
|
+
const reporter = new _internalReporter.InternalReporter(new _list.default());
|
|
277
277
|
const taskRunner = (0, _tasks.createTaskRunnerForWatch)(config, reporter, options === null || options === void 0 ? void 0 : options.additionalFileMatcher);
|
|
278
278
|
const testRun = new _tasks.TestRun(config, reporter);
|
|
279
279
|
(0, _compilationCache.clearCompilationCache)();
|
|
280
|
-
reporter.onConfigure(config);
|
|
280
|
+
reporter.onConfigure(config.config);
|
|
281
281
|
const taskStatus = await taskRunner.run(testRun, 0);
|
|
282
282
|
let status = 'passed';
|
|
283
283
|
let hasFailedTests = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/test",
|
|
3
|
-
"version": "1.36.0-alpha-
|
|
3
|
+
"version": "1.36.0-alpha-jul-2-2023",
|
|
4
4
|
"description": "A high-level API to automate web browsers",
|
|
5
5
|
"repository": "github:Microsoft/playwright",
|
|
6
6
|
"homepage": "https://playwright.dev",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"license": "Apache-2.0",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@types/node": "*",
|
|
44
|
-
"playwright-core": "1.36.0-alpha-
|
|
44
|
+
"playwright-core": "1.36.0-alpha-jul-2-2023"
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
47
|
"fsevents": "2.3.2"
|