@lvce-editor/test-with-playwright 7.2.0 → 7.3.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.
Files changed (2) hide show
  1. package/dist/main.js +16 -10
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -4,33 +4,39 @@ import { pathToFileURL, fileURLToPath } from 'node:url';
4
4
  const HandleResult = 'HandleResult';
5
5
  const HandleFinalResult = 'HandleFinalResult';
6
6
 
7
+ const formatDuration = duration => {
8
+ const roundedDuration = Math.round(duration);
9
+ return `${roundedDuration}ms`;
10
+ };
11
+
7
12
  const getFinalResultMessage = (passed, skipped, failed, duration) => {
8
13
  if (passed === 0 && skipped === 0 && failed === 0) {
9
14
  return `no tests found`;
10
15
  }
16
+ const formattedDuration = formatDuration(duration);
11
17
  if (passed === 0 && skipped === 0 && failed === 1) {
12
- return `${failed} test failed in ${duration}ms`;
18
+ return `${failed} test failed in ${formattedDuration}`;
13
19
  }
14
20
  if (passed === 0 && skipped === 1 && failed === 0) {
15
- return `${skipped} test skipped in ${duration}ms`;
21
+ return `${skipped} test skipped in ${formattedDuration}`;
16
22
  }
17
23
  if (passed === 0 && skipped === 1 && failed === 1) {
18
- return `${skipped} test skipped, ${failed} test failed in ${duration}ms`;
24
+ return `${skipped} test skipped, ${failed} test failed in ${formattedDuration}`;
19
25
  }
20
26
  if (passed === 1 && skipped === 0 && failed === 0) {
21
- return `${passed} test passed in ${duration}ms`;
27
+ return `${passed} test passed in ${formattedDuration}`;
22
28
  }
23
29
  if (passed === 1 && skipped === 0 && failed === 1) {
24
- return `${passed} test passed, ${failed} test failed in ${duration}ms`;
30
+ return `${passed} test passed, ${failed} test failed in ${formattedDuration}`;
25
31
  }
26
32
  if (passed === 1 && skipped === 1 && failed === 0) {
27
- return `${passed} test passed, ${skipped} test skipped in ${duration}ms`;
33
+ return `${passed} test passed, ${skipped} test skipped in ${formattedDuration}`;
28
34
  }
29
35
  if (passed === 1 && skipped === 1 && failed === 1) {
30
- return `${passed} test passed, ${skipped} test skipped, ${failed} test failed in ${duration}ms`;
36
+ return `${passed} test passed, ${skipped} test skipped, ${failed} test failed in ${formattedDuration}`;
31
37
  }
32
38
  if (passed > 1 && skipped === 0 && failed === 0) {
33
- return `${passed} tests passed in ${duration}ms`;
39
+ return `${passed} tests passed in ${formattedDuration}`;
34
40
  }
35
41
  return `${passed} tests passed, ${skipped} tests skipped, ${failed} tests failed in ${duration}ms`;
36
42
  };
@@ -69,8 +75,8 @@ const handleResultPassed = result => {
69
75
  end
70
76
  } = result;
71
77
  const duration = getDuration(start, end);
72
- const roundedDuration = Math.round(duration);
73
- console.info(`${Pass$1} ${name} in ${roundedDuration}ms`);
78
+ const formattedDuration = formatDuration(duration);
79
+ console.info(`${Pass$1} ${name} in ${formattedDuration}`);
74
80
  };
75
81
  const handleResultSkipped = result => {
76
82
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-with-playwright",
3
- "version": "7.2.0",
3
+ "version": "7.3.0",
4
4
  "description": "CLI tool for running Playwright tests",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,7 +12,7 @@
12
12
  "main": "dist/main.js",
13
13
  "bin": "bin/test-with-playwright.js",
14
14
  "dependencies": {
15
- "@lvce-editor/test-with-playwright-worker": "7.2.0",
15
+ "@lvce-editor/test-with-playwright-worker": "7.3.0",
16
16
  "@lvce-editor/test-worker": "^6.3.0"
17
17
  },
18
18
  "engines": {