@lokalise/playwright-reporters 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -15,30 +15,43 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.defineTranslationReporterConfig = exports.TranslationReporter = exports.definePermissionsReporterConfig = exports.PermissionsReporter = exports.defineStepDurationReporterConfig = exports.StepDurationReporter = exports.defineTimelineReporterConfig = exports.TimelineReporter = exports.defineRetryReporterConfig = exports.RetryReporter = exports.defineAnalyticsReporterConfig = exports.AnalyticsReporter = void 0;
36
+ exports.defineTranslationReporterConfig = exports.TranslationReporter = exports.definePermissionsReporterConfig = exports.PermissionsReporter = exports.defineStepDurationReporterConfig = exports.StepDurationReporter = exports.defineTimelineReporterConfig = exports.TimelineReporter = exports.defineRetryReporterConfig = exports.RetryReporter = exports.defineDatadogReporterConfig = exports.DatadogReporter = exports.defineAnalyticsReporterConfig = exports.AnalyticsReporter = void 0;
27
37
  const reporter_1 = __importStar(require("./analytics/reporter"));
28
38
  exports.AnalyticsReporter = reporter_1.default;
29
39
  Object.defineProperty(exports, "defineAnalyticsReporterConfig", { enumerable: true, get: function () { return reporter_1.defineAnalyticsReporterConfig; } });
30
- const reporter_2 = __importStar(require("./permissions/reporter"));
31
- exports.PermissionsReporter = reporter_2.default;
32
- Object.defineProperty(exports, "definePermissionsReporterConfig", { enumerable: true, get: function () { return reporter_2.definePermissionsReporterConfig; } });
33
- const reporter_3 = __importStar(require("./retry/reporter"));
34
- exports.RetryReporter = reporter_3.default;
35
- Object.defineProperty(exports, "defineRetryReporterConfig", { enumerable: true, get: function () { return reporter_3.defineRetryReporterConfig; } });
36
- const reporter_4 = __importStar(require("./stepDuration/reporter"));
37
- exports.StepDurationReporter = reporter_4.default;
38
- Object.defineProperty(exports, "defineStepDurationReporterConfig", { enumerable: true, get: function () { return reporter_4.defineStepDurationReporterConfig; } });
39
- const reporter_5 = __importStar(require("./timeline/reporter"));
40
- exports.TimelineReporter = reporter_5.default;
41
- Object.defineProperty(exports, "defineTimelineReporterConfig", { enumerable: true, get: function () { return reporter_5.defineTimelineReporterConfig; } });
42
- const reporter_6 = __importStar(require("./translation/reporter"));
43
- exports.TranslationReporter = reporter_6.default;
44
- Object.defineProperty(exports, "defineTranslationReporterConfig", { enumerable: true, get: function () { return reporter_6.defineTranslationReporterConfig; } });
40
+ const reporter_2 = __importStar(require("./datadog/reporter"));
41
+ exports.DatadogReporter = reporter_2.default;
42
+ Object.defineProperty(exports, "defineDatadogReporterConfig", { enumerable: true, get: function () { return reporter_2.defineDatadogReporterConfig; } });
43
+ const reporter_3 = __importStar(require("./permissions/reporter"));
44
+ exports.PermissionsReporter = reporter_3.default;
45
+ Object.defineProperty(exports, "definePermissionsReporterConfig", { enumerable: true, get: function () { return reporter_3.definePermissionsReporterConfig; } });
46
+ const reporter_4 = __importStar(require("./retry/reporter"));
47
+ exports.RetryReporter = reporter_4.default;
48
+ Object.defineProperty(exports, "defineRetryReporterConfig", { enumerable: true, get: function () { return reporter_4.defineRetryReporterConfig; } });
49
+ const reporter_5 = __importStar(require("./stepDuration/reporter"));
50
+ exports.StepDurationReporter = reporter_5.default;
51
+ Object.defineProperty(exports, "defineStepDurationReporterConfig", { enumerable: true, get: function () { return reporter_5.defineStepDurationReporterConfig; } });
52
+ const reporter_6 = __importStar(require("./timeline/reporter"));
53
+ exports.TimelineReporter = reporter_6.default;
54
+ Object.defineProperty(exports, "defineTimelineReporterConfig", { enumerable: true, get: function () { return reporter_6.defineTimelineReporterConfig; } });
55
+ const reporter_7 = __importStar(require("./translation/reporter"));
56
+ exports.TranslationReporter = reporter_7.default;
57
+ Object.defineProperty(exports, "defineTranslationReporterConfig", { enumerable: true, get: function () { return reporter_7.defineTranslationReporterConfig; } });
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Elastic = void 0;
4
4
  const test_1 = require("@playwright/test");
5
5
  class Elastic {
6
+ options;
7
+ request;
6
8
  constructor(options) {
7
9
  this.options = options;
8
10
  }
@@ -4,6 +4,10 @@ exports.definePermissionsReporterConfig = void 0;
4
4
  const elastic_1 = require("./elastic");
5
5
  // eslint-disable-next-line import/no-default-export
6
6
  class PermissionsReporter {
7
+ options;
8
+ elastic;
9
+ debugLogging;
10
+ failedTestData;
7
11
  constructor(options) {
8
12
  this.elastic = new elastic_1.Elastic(options);
9
13
  this.options = options;
@@ -18,6 +18,13 @@ const formLocalRerunCommand = (projectList) => {
18
18
  };
19
19
  // eslint-disable-next-line import/no-default-export
20
20
  class RetryReporter {
21
+ failedTestNames;
22
+ flakyTestNames;
23
+ timeoutMessages;
24
+ failedProjectName;
25
+ flakyProjectName;
26
+ maxRetryCount;
27
+ isPREnv;
21
28
  constructor(options) {
22
29
  this.maxRetryCount = options.maxRetryCount;
23
30
  this.isPREnv = options.isPREnv;
@@ -6,6 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.defineStepDurationReporterConfig = void 0;
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  class StepDurationReporter {
9
+ stepStorage;
10
+ ignoredSteps;
11
+ options;
9
12
  constructor(options) {
10
13
  this.options = options;
11
14
  this.stepStorage = {};
@@ -21,6 +21,8 @@ const isStepWithinHook = (step) => {
21
21
  return isStepWithinHook(step?.parent);
22
22
  };
23
23
  class TimelineReporter {
24
+ testData;
25
+ options;
24
26
  constructor(options) {
25
27
  this.options = { writeToFile: true, ...options };
26
28
  this.testData = {
@@ -4,6 +4,8 @@ exports.Elastic = void 0;
4
4
  const node_http2_1 = require("node:http2");
5
5
  const test_1 = require("@playwright/test");
6
6
  class Elastic {
7
+ options;
8
+ request;
7
9
  constructor(options) {
8
10
  this.options = options;
9
11
  }
@@ -11,6 +11,9 @@ var ShopifySteps;
11
11
  })(ShopifySteps || (exports.ShopifySteps = ShopifySteps = {}));
12
12
  // eslint-disable-next-line import/no-default-export
13
13
  class TranslationReporter {
14
+ elastic;
15
+ options;
16
+ listOfTests;
14
17
  constructor(options) {
15
18
  this.options = options;
16
19
  this.listOfTests = { data: {} };
@@ -75,6 +78,9 @@ class TranslationReporter {
75
78
  if (!testProjectName?.toLowerCase().includes('shopify')) {
76
79
  return;
77
80
  }
81
+ if (['skipped', 'interrupted'].includes(result.status)) {
82
+ return;
83
+ }
78
84
  const testId = `${test.id}-${result.retry ?? 0}`;
79
85
  // No need to calculate totalImportDuration here; it's already accumulated
80
86
  this.listOfTests.data[testId] = {
@@ -15,17 +15,29 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ /* eslint-disable max-statements */
26
37
  const test_1 = __importStar(require("@playwright/test"));
27
38
  const reporter_1 = __importStar(require("../reporter"));
28
39
  test_1.default.describe('TranslationReporter Unit Tests', () => {
40
+ test_1.default.describe.configure({ mode: 'parallel' });
29
41
  let reporter;
30
42
  test_1.default.beforeEach(async () => {
31
43
  reporter = new reporter_1.default({
@@ -37,7 +49,6 @@ test_1.default.describe('TranslationReporter Unit Tests', () => {
37
49
  });
38
50
  });
39
51
  test_1.default.describe('onStepEnd', () => {
40
- // eslint-disable-next-line max-statements
41
52
  (0, test_1.default)('should correctly accumulate data for importing step', () => {
42
53
  const testCase = {
43
54
  id: 'test-id',
@@ -95,7 +106,7 @@ test_1.default.describe('TranslationReporter Unit Tests', () => {
95
106
  timestamp_: 0,
96
107
  });
97
108
  });
98
- (0, test_1.default)('should not accumulate data for non-Shopify tests', () => {
109
+ (0, test_1.default)('should not accumulate data for non-Shopify project, with valid Shopify steps', () => {
99
110
  const testCase = {
100
111
  id: 'test-id',
101
112
  title: 'Non-Shopify Test',
@@ -107,8 +118,8 @@ test_1.default.describe('TranslationReporter Unit Tests', () => {
107
118
  retry: 0,
108
119
  };
109
120
  const testStep = {
110
- title: 'Some Step',
111
- duration: 400,
121
+ title: reporter_1.ShopifySteps.importing,
122
+ duration: 50,
112
123
  };
113
124
  reporter.onStepEnd(testCase, testResult, testStep);
114
125
  const testId = `${testCase.id}-${testResult.retry ?? 0}`;
@@ -158,5 +169,43 @@ test_1.default.describe('TranslationReporter Unit Tests', () => {
158
169
  const resultData = reporter.listOfTests.data[testId];
159
170
  (0, test_1.expect)(resultData).toBeUndefined();
160
171
  });
172
+ (0, test_1.default)('should skip test result accumulation for skipped tests', async () => {
173
+ const testCase = {
174
+ id: 'test-id',
175
+ title: 'Shopify Test',
176
+ parent: {
177
+ project: () => ({ name: 'shopify' }),
178
+ },
179
+ };
180
+ const testResult = {
181
+ retry: 0,
182
+ status: 'skipped',
183
+ startTime: new Date(),
184
+ duration: 600,
185
+ };
186
+ await reporter.onTestEnd(testCase, testResult);
187
+ const testId = `${testCase.id}-${testResult.retry ?? 0}`;
188
+ const resultData = reporter.listOfTests.data[testId];
189
+ (0, test_1.expect)(resultData).toBeUndefined();
190
+ });
191
+ (0, test_1.default)('should skip test result accumulation for interrupted tests', async () => {
192
+ const testCase = {
193
+ id: 'test-id',
194
+ title: 'Shopify Test',
195
+ parent: {
196
+ project: () => ({ name: 'shopify' }),
197
+ },
198
+ };
199
+ const testResult = {
200
+ retry: 0,
201
+ status: 'interrupted',
202
+ startTime: new Date(),
203
+ duration: 600,
204
+ };
205
+ await reporter.onTestEnd(testCase, testResult);
206
+ const testId = `${testCase.id}-${testResult.retry ?? 0}`;
207
+ const resultData = reporter.listOfTests.data[testId];
208
+ (0, test_1.expect)(resultData).toBeUndefined();
209
+ });
161
210
  });
162
211
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/playwright-reporters",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "scripts": {
5
5
  "lint:eslint": "eslint --cache . --ext .js,.cjs,.ts",
6
6
  "lint:ts": "tsc --noEmit",
@@ -49,37 +49,44 @@
49
49
  "./translation": {
50
50
  "import": "./dist/translation/reporter.js",
51
51
  "require": "./dist/translation/reporter.js"
52
+ },
53
+ "./datadog": {
54
+ "import": "./dist/datadog/reporter.js",
55
+ "require": "./dist/datadog/reporter.js"
52
56
  }
53
57
  },
54
58
  "publishConfig": {
55
59
  "access": "public"
56
60
  },
57
61
  "devDependencies": {
58
- "@commitlint/cli": "19.4.0",
59
- "@commitlint/config-conventional": "19.2.2",
60
- "@commitlint/prompt-cli": "19.4.0",
62
+ "@commitlint/cli": "20.3.1",
63
+ "@commitlint/config-conventional": "20.3.1",
64
+ "@commitlint/prompt-cli": "20.3.1",
65
+ "@playwright/test": "^1.50.0",
61
66
  "@lokalise/eslint-config-frontend": "^4.6.1",
62
67
  "@lokalise/prettier-config": "^1.0.1",
63
68
  "@semantic-release/changelog": "6.0.3",
64
- "@semantic-release/commit-analyzer": "13.0.0",
69
+ "@semantic-release/commit-analyzer": "13.0.1",
65
70
  "@semantic-release/git": "10.0.1",
66
- "@semantic-release/github": "10.1.6",
67
- "@semantic-release/npm": "12.0.1",
68
- "@semantic-release/release-notes-generator": "14.0.1",
69
- "@types/lodash": "^4.17.7",
70
- "@types/node": "^22.3.0",
71
- "eslint-config-prettier": "^9.1.0",
72
- "eslint-plugin-prettier": "^5.2.1",
73
- "husky": "9.1.4",
74
- "prettier": "^3.3.3",
75
- "semantic-release": "24.0.0",
76
- "typescript": "5.5.4"
71
+ "@semantic-release/github": "12.0.2",
72
+ "@semantic-release/npm": "13.1.3",
73
+ "@semantic-release/release-notes-generator": "14.1.0",
74
+ "@types/lodash": "^4.17.23",
75
+ "@types/node": "^25.0.10",
76
+ "eslint-config-prettier": "^10.1.8",
77
+ "eslint-plugin-prettier": "^5.5.5",
78
+ "husky": "9.1.7",
79
+ "prettier": "^3.8.1",
80
+ "semantic-release": "25.0.2",
81
+ "typescript": "5.9.3"
77
82
  },
78
83
  "dependencies": {
79
- "@faker-js/faker": "^8.4.1",
80
- "@playwright/test": "^1.46.0",
84
+ "@faker-js/faker": "^10.2.0",
81
85
  "fastest-levenshtein": "^1.0.16",
82
- "lodash": "^4.17.21"
86
+ "lodash": "^4.17.23"
87
+ },
88
+ "peerDependencies": {
89
+ "@playwright/test": ">=1.40.0"
83
90
  },
84
91
  "overrides": {
85
92
  "conventional-changelog-conventionalcommits": ">= 8.0.0"