@lokalise/playwright-reporters 1.3.0-beta.3 → 1.4.0-beta.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/README.md +7 -3
- package/dist/playwright.config.js +3 -3
- package/dist/playwright.config.js.map +1 -1
- package/dist/src/analytics/elastic.d.ts +4 -1
- package/dist/src/analytics/elastic.js +14 -3
- package/dist/src/analytics/elastic.js.map +1 -1
- package/dist/src/analytics/logger.js.map +1 -1
- package/dist/src/analytics/reporter.d.ts +18 -8
- package/dist/src/analytics/reporter.js +76 -16
- package/dist/src/analytics/reporter.js.map +1 -1
- package/dist/src/analytics/tests/browserUsage.test.d.ts +1 -0
- package/dist/src/analytics/tests/browserUsage.test.js +39 -0
- package/dist/src/analytics/tests/browserUsage.test.js.map +1 -0
- package/dist/src/analytics/tests/transform.test.js +77 -77
- package/dist/src/analytics/tests/transform.test.js.map +1 -1
- package/dist/src/analytics/transform.d.ts +25 -10
- package/dist/src/analytics/transform.js +45 -19
- package/dist/src/analytics/transform.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/retry/reporter.d.ts +1 -1
- package/dist/src/retry/reporter.js +30 -32
- package/dist/src/retry/reporter.js.map +1 -1
- package/package.json +20 -17
|
@@ -5,17 +5,15 @@ const lodash_1 = require("lodash");
|
|
|
5
5
|
const escapeBash = (command) => {
|
|
6
6
|
const shouldEscapeRegExp = /[^a-zA-Z0-9_/:=-]/;
|
|
7
7
|
if (shouldEscapeRegExp.test(command)) {
|
|
8
|
-
const removeDuplicateQuotes = command.replace(/^(?:'')+/g,
|
|
8
|
+
const removeDuplicateQuotes = command.replace(/^(?:'')+/g, '');
|
|
9
9
|
const removeUnescapedQuotes = removeDuplicateQuotes.replace(/\\'''/g, "\\'");
|
|
10
10
|
return removeUnescapedQuotes;
|
|
11
11
|
}
|
|
12
12
|
return command;
|
|
13
13
|
};
|
|
14
14
|
const formLocalRerunCommand = (projectList) => {
|
|
15
|
-
const baseCommand =
|
|
16
|
-
const projectArguments = projectList
|
|
17
|
-
.map((projectName) => `--project=${projectName}`)
|
|
18
|
-
.join(" ");
|
|
15
|
+
const baseCommand = 'npx playwright test';
|
|
16
|
+
const projectArguments = projectList.map((projectName) => `--project=${projectName}`).join(' ');
|
|
19
17
|
return `${baseCommand} ${projectArguments}`;
|
|
20
18
|
};
|
|
21
19
|
// eslint-disable-next-line import/no-default-export
|
|
@@ -36,7 +34,7 @@ class RetryReporter {
|
|
|
36
34
|
const testName = test.title;
|
|
37
35
|
const suiteName = nonEmptyPaths[nonEmptyPaths.length - 2];
|
|
38
36
|
const testNameWithSuite = `${suiteName} ${testName}`;
|
|
39
|
-
if ([
|
|
37
|
+
if (['failed', 'timedOut', 'interrupted'].includes(result.status) &&
|
|
40
38
|
result.retry === this.maxRetryCount) {
|
|
41
39
|
const escapedTitle = (0, lodash_1.escapeRegExp)(testNameWithSuite);
|
|
42
40
|
this.failedTestNames.push(escapedTitle);
|
|
@@ -44,7 +42,7 @@ class RetryReporter {
|
|
|
44
42
|
this.failedProjectName.push(projectName);
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
|
-
else if (result.status ===
|
|
45
|
+
else if (result.status === 'passed' && result.retry) {
|
|
48
46
|
const escapedTitle = (0, lodash_1.escapeRegExp)(testNameWithSuite);
|
|
49
47
|
this.flakyTestNames.push(escapedTitle);
|
|
50
48
|
if (projectName && !this.flakyProjectName.includes(projectName)) {
|
|
@@ -53,60 +51,60 @@ class RetryReporter {
|
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
onError(error) {
|
|
56
|
-
if (error?.message?.toLowerCase()?.includes(
|
|
54
|
+
if (error?.message?.toLowerCase()?.includes('timed out')) {
|
|
57
55
|
this.timeoutMessages.push(error.message);
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
logFlakyTests() {
|
|
61
59
|
if (this.flakyTestNames.length) {
|
|
62
|
-
console.log(
|
|
63
|
-
const flakyTestsRegex = this.flakyTestNames.join(
|
|
60
|
+
console.log('-------------------------- FLAKY TESTS --------------------------', '\n');
|
|
61
|
+
const flakyTestsRegex = this.flakyTestNames.join('|');
|
|
64
62
|
const flakyEscapedString = escapeBash(flakyTestsRegex);
|
|
65
63
|
const flakyBufferData = Buffer.from(flakyTestsRegex);
|
|
66
|
-
const flakyBase64String = flakyBufferData.toString(
|
|
67
|
-
console.log(
|
|
64
|
+
const flakyBase64String = flakyBufferData.toString('base64');
|
|
65
|
+
console.log('Use the following command to rerun the flaky tests locally:', '\n');
|
|
68
66
|
const npxCommandWithProject = formLocalRerunCommand(this.flakyProjectName);
|
|
69
|
-
console.log(`${npxCommandWithProject} -g '${flakyEscapedString}'`,
|
|
70
|
-
console.log(
|
|
71
|
-
console.log('Paste the following base64 string in the "Build with parameters" section of Jenkins to rerun the FLAKY tests',
|
|
72
|
-
console.log(flakyBase64String,
|
|
73
|
-
console.log(
|
|
74
|
-
console.log(
|
|
67
|
+
console.log(`${npxCommandWithProject} -g '${flakyEscapedString}'`, '\n');
|
|
68
|
+
console.log('---------------------------------------------------------------------------------');
|
|
69
|
+
console.log('Paste the following base64 string in the "Build with parameters" section of Jenkins to rerun the FLAKY tests', '\n');
|
|
70
|
+
console.log(flakyBase64String, '\n');
|
|
71
|
+
console.log('---------------------------------------------------------------------------------');
|
|
72
|
+
console.log('\n');
|
|
75
73
|
}
|
|
76
74
|
}
|
|
77
75
|
logFailedTests() {
|
|
78
76
|
if (this.failedTestNames.length) {
|
|
79
|
-
const failedTestsRegex = this.failedTestNames.join(
|
|
77
|
+
const failedTestsRegex = this.failedTestNames.join('|');
|
|
80
78
|
const escapedString = escapeBash(failedTestsRegex);
|
|
81
79
|
const bufferData = Buffer.from(failedTestsRegex);
|
|
82
|
-
const base64String = bufferData.toString(
|
|
83
|
-
console.log(
|
|
80
|
+
const base64String = bufferData.toString('base64');
|
|
81
|
+
console.log('-------------------------- FAILED TESTS --------------------------', '\n');
|
|
84
82
|
if (this.failedProjectName.length) {
|
|
85
|
-
console.log(
|
|
83
|
+
console.log('Use the following command to rerun the failed tests locally:', '\n');
|
|
86
84
|
const npxCommandWithProject = formLocalRerunCommand(this.failedProjectName);
|
|
87
|
-
console.log(`${npxCommandWithProject} -g '${escapedString}'`,
|
|
85
|
+
console.log(`${npxCommandWithProject} -g '${escapedString}'`, '\n');
|
|
88
86
|
}
|
|
89
|
-
console.log(
|
|
90
|
-
console.log('Paste the following base64 string in the "Build with parameters" section of Jenkins to rerun the FAILED tests',
|
|
91
|
-
console.log(base64String,
|
|
92
|
-
console.log(
|
|
87
|
+
console.log('---------------------------------------------------------------------------------');
|
|
88
|
+
console.log('Paste the following base64 string in the "Build with parameters" section of Jenkins to rerun the FAILED tests', '\n');
|
|
89
|
+
console.log(base64String, '\n');
|
|
90
|
+
console.log('---------------------------------------------------------------------------------');
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
logTimeout() {
|
|
96
|
-
console.log(
|
|
94
|
+
console.log('-------------------------- TOTAL DURATION IS LONGER THAN GLOBAL TIMEOUT --------------------------', '\n');
|
|
97
95
|
this.timeoutMessages.forEach((message) => {
|
|
98
|
-
console.log(
|
|
96
|
+
console.log('*', message);
|
|
99
97
|
});
|
|
100
|
-
console.log(
|
|
98
|
+
console.log('---------------------------------------------------------------------------------');
|
|
101
99
|
}
|
|
102
100
|
onEnd(result) {
|
|
103
101
|
if (this.isPREnv) {
|
|
104
102
|
this.logFlakyTests();
|
|
105
103
|
}
|
|
106
|
-
if (result.status ===
|
|
104
|
+
if (result.status === 'failed') {
|
|
107
105
|
this.logFailedTests();
|
|
108
106
|
}
|
|
109
|
-
if (result.status ===
|
|
107
|
+
if (result.status === 'timedout') {
|
|
110
108
|
this.logTimeout();
|
|
111
109
|
}
|
|
112
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../../../src/retry/reporter.ts"],"names":[],"mappings":";;;AAQA,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O,EAAE,CAAC;YAClB,IAAI,CAAC,aAAa,EAAE,CAAA;QACrB,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAChC,IAAI,CAAC,cAAc,EAAE,CAAA;QACtB,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YAClC,IAAI,CAAC,UAAU,EAAE,CAAA;QAClB,CAAC;IACF,CAAC;CACD;AAxID,gCAwIC;AAEM,MAAM,yBAAyB,GAAG,CACxC,OAAuD,EACtD,EAAE,CAAC,OAAO,CAAA;AAFC,QAAA,yBAAyB,6BAE1B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/playwright-reporters",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0-beta.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"lint:eslint": "eslint --cache . --ext .js,.cjs,.ts",
|
|
6
6
|
"lint:ts": "tsc --noEmit",
|
|
@@ -35,27 +35,30 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@commitlint/cli": "
|
|
39
|
-
"@commitlint/config-conventional": "
|
|
40
|
-
"@commitlint/prompt-cli": "
|
|
41
|
-
"@lokalise/eslint-config-frontend": "^4.
|
|
38
|
+
"@commitlint/cli": "19.0.3",
|
|
39
|
+
"@commitlint/config-conventional": "19.0.3",
|
|
40
|
+
"@commitlint/prompt-cli": "19.0.3",
|
|
41
|
+
"@lokalise/eslint-config-frontend": "^4.3.2",
|
|
42
|
+
"@lokalise/prettier-config": "^1.0.0",
|
|
42
43
|
"@semantic-release/changelog": "6.0.3",
|
|
43
44
|
"@semantic-release/commit-analyzer": "11.1.0",
|
|
44
45
|
"@semantic-release/git": "10.0.1",
|
|
45
|
-
"@semantic-release/github": "9.2.
|
|
46
|
-
"@semantic-release/npm": "11.0.
|
|
46
|
+
"@semantic-release/github": "9.2.6",
|
|
47
|
+
"@semantic-release/npm": "11.0.3",
|
|
47
48
|
"@semantic-release/release-notes-generator": "12.1.0",
|
|
48
|
-
"@types/lodash": "^4.14.
|
|
49
|
-
"
|
|
50
|
-
"eslint-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
49
|
+
"@types/lodash": "^4.14.202",
|
|
50
|
+
"@types/node": "^20.11.25",
|
|
51
|
+
"eslint-config-prettier": "^9.1.0",
|
|
52
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
53
|
+
"husky": "9.0.11",
|
|
54
|
+
"prettier": "^3.2.5",
|
|
55
|
+
"semantic-release": "23.0.2",
|
|
56
|
+
"typescript": "5.4.2"
|
|
55
57
|
},
|
|
56
58
|
"dependencies": {
|
|
57
|
-
"@faker-js/faker": "^8.
|
|
58
|
-
"@playwright/test": "^1.
|
|
59
|
+
"@faker-js/faker": "^8.4.1",
|
|
60
|
+
"@playwright/test": "^1.42.1",
|
|
59
61
|
"lodash": "^4.17.21"
|
|
60
|
-
}
|
|
62
|
+
},
|
|
63
|
+
"prettier": "@lokalise/prettier-config"
|
|
61
64
|
}
|