monocart-reporter 1.7.4 → 1.7.5
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 +8 -11
- package/lib/index.js +4 -1
- package/lib/runtime/monocart-coverage.js +13 -13
- package/lib/runtime/monocart-reporter.js +1 -1
- package/lib/runtime/monocart-vendor.js +1 -1
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
- [Get, Set, and Remove Global Data](#get-set-and-remove-global-data)
|
|
44
44
|
- [Send and Receive Messages between Processes](#send-and-receive-messages-between-processes)
|
|
45
45
|
* [Merge Shard Reports](#merge-shard-reports)
|
|
46
|
-
* [onEnd
|
|
46
|
+
* [onEnd Hook](#onend-hook)
|
|
47
47
|
- [Send Email](#send-email)
|
|
48
48
|
- [Testrail Integration](#testrail-integration)
|
|
49
49
|
- [Jira + Zephyr Scale Integration](#jira--zephyr-scale-integration)
|
|
@@ -636,7 +636,7 @@ Preview [Audit HTML Report](https://cenfun.github.io/monocart-reporter/audit-78a
|
|
|
636
636
|
There are two APIs for coverage report:
|
|
637
637
|
- `attachCoverageReport(data, testInfo, options)`
|
|
638
638
|
Attach a coverage report to a test. Arguments:
|
|
639
|
-
- `data` There are two supported data inputs
|
|
639
|
+
- `data` There are two supported data inputs: [Istanbul](#istanbul) (Object) or [V8](#v8) (Array)
|
|
640
640
|
- `testInfo` see [TestInfo](https://playwright.dev/docs/api/class-testinfo)
|
|
641
641
|
- `options` (Object) see [Coverage Options](#coverage-options)
|
|
642
642
|
- `addCoverageReport(data, testInfo)` Add coverage to global coverage report from a test. see [Global Coverage Report](#global-coverage-report)
|
|
@@ -734,14 +734,14 @@ const report = await attachCoverageReport(coverageList, test.info(), {
|
|
|
734
734
|
| | Istanbul | V8 | V8 to Istanbul |
|
|
735
735
|
| :--------------| :------ | :------ | :---------------------- |
|
|
736
736
|
| Input data format | Istanbul (Object) | V8 (Array) | V8 (Array) |
|
|
737
|
-
|
|
|
738
|
-
|
|
|
739
|
-
| Indicators | Covered Lines, Branches, Statements and Functions, Execution Counts | Covered Bytes, Lines (after formatted) Execution Counts | Covered Lines, Branches, Statements and Functions, Execution Counts |
|
|
737
|
+
| Output | [Istanbul HTML report](https://cenfun.github.io/monocart-reporter/coverage-77aa6f37601a97417803/index.html) | [V8 HTML report](https://cenfun.github.io/monocart-reporter/coverage/index.html) | [Istanbul HTML report](https://cenfun.github.io/monocart-reporter/coverage-01eebe0ebc796534d759-1/index.html) |
|
|
738
|
+
| Indicators | Covered Lines, Branches, Statements and Functions, Execution Counts | Covered Bytes, Lines❔, Execution Counts | Covered Lines, Branches❔, Statements and Functions, Execution Counts |
|
|
740
739
|
| Source code without [instrumentation](https://github.com/istanbuljs/babel-plugin-istanbul) | ❌ | ✅ | ✅ |
|
|
741
|
-
| CSS coverage | ❌ | ✅ |
|
|
740
|
+
| CSS coverage | ❌ | ✅ | ✅ |
|
|
742
741
|
| Minified code | N/A | ✅ | ❌ |
|
|
743
742
|
| Code formatting | N/A | ✅ | ❌ |
|
|
744
743
|
|
|
744
|
+
❔ - Partial or conditional support
|
|
745
745
|
### Global Coverage Report
|
|
746
746
|
The global coverage report will not be attached to any test case, but will merge all coverages into one global report after all the tests are finished.
|
|
747
747
|
- The global coverage options see [Coverage Options](#coverage-options)
|
|
@@ -881,8 +881,7 @@ test('finally, attach HAR', async () => {
|
|
|
881
881
|
await attachNetworkReport(harPath, test.info());
|
|
882
882
|
});
|
|
883
883
|
```
|
|
884
|
-
Preview [Network HTML Report](https://cenfun.github.io/monocart-reporter/network-
|
|
885
|
-
|
|
884
|
+
Preview [Network HTML Report](https://cenfun.github.io/monocart-reporter/network-da7f5b4cceb1e6280782/index.html)
|
|
886
885
|
|
|
887
886
|
## Global State Management
|
|
888
887
|
When tests are executed in [isolation](https://playwright.dev/docs/browser-contexts) mode, the reporter and each test may run in a different process, they cannot share data with each other. we can start a local WebSocket server to serve the global data, and read/write the global data with `useState` API from a test.
|
|
@@ -968,9 +967,7 @@ module.exports = {
|
|
|
968
967
|
if (test) {
|
|
969
968
|
// current test
|
|
970
969
|
}
|
|
971
|
-
|
|
972
970
|
console.log('receive message on server', message);
|
|
973
|
-
|
|
974
971
|
return {
|
|
975
972
|
data: 'my response data'
|
|
976
973
|
};
|
|
@@ -980,7 +977,7 @@ module.exports = {
|
|
|
980
977
|
]
|
|
981
978
|
};
|
|
982
979
|
```
|
|
983
|
-
|
|
980
|
+
see example: [Allow specified test cases to run in sequence mode with lock/unlock state](https://github.com/cenfun/monocart-reporter-test/tree/main/tests/global-state)
|
|
984
981
|
|
|
985
982
|
## Merge Shard Reports
|
|
986
983
|
There will be multiple reports to be generated if Playwright test executes in sharding mode. for example:
|
package/lib/index.js
CHANGED
|
@@ -96,8 +96,11 @@ class Reporter {
|
|
|
96
96
|
|
|
97
97
|
// ==========================================================================
|
|
98
98
|
|
|
99
|
+
// Whether this reporter uses stdio for reporting.
|
|
100
|
+
// When it does not, Playwright Test could add some output to enhance user experience.
|
|
101
|
+
// If your reporter does not print to the terminal, it is strongly recommended to return false.
|
|
99
102
|
printsToStdio() {
|
|
100
|
-
return
|
|
103
|
+
return true;
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
// root suite in the reporter.onBegin(config, suite) method.
|