@genesislcap/uvu-playwright-builder 15.66.0 → 15.68.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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Builder wrapping:
4
4
  * [uvu](https://github.com/lukeed/uvu) and [playwright-test](https://www.npmjs.com/package/playwright-test) for unit test execution
5
5
  * [Playwright](https://playwright.dev/) for E2E tests
6
- * [c8](https://www.npmjs.com/package/c8) and [nyc](https://www.npmjs.com/package/nyc) for test coverage
6
+ * [c8](https://www.npmjs.com/package/c8) and [istanbul](https://istanbul.js.org/) reporters for test coverage
7
7
 
8
8
 
9
9
  ## Installation
@@ -0,0 +1,2 @@
1
+ export declare const reportIstanbulCoverage: (cwd: string) => void;
2
+ //# sourceMappingURL=coverage-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-report.d.ts","sourceRoot":"","sources":["../src/coverage-report.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,sBAAsB,GAAI,KAAK,MAAM,SAkBjD,CAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reportIstanbulCoverage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const istanbul_lib_coverage_1 = require("istanbul-lib-coverage");
8
+ const istanbul_lib_report_1 = require("istanbul-lib-report");
9
+ const istanbul_reports_1 = require("istanbul-reports");
10
+ const test_exclude_1 = tslib_1.__importDefault(require("test-exclude"));
11
+ const ISTANBUL_OUTPUT_DIR = '.nyc_output';
12
+ const REPORT_DIR = 'coverage';
13
+ // Stands in for `nyc report`: playwright-test --cov writes istanbul JSON, which c8 can't read
14
+ const reportIstanbulCoverage = (cwd) => {
15
+ const outputDir = (0, node_path_1.join)(cwd, ISTANBUL_OUTPUT_DIR);
16
+ if (!(0, node_fs_1.existsSync)(outputDir)) {
17
+ return;
18
+ }
19
+ const coverageMap = (0, istanbul_lib_coverage_1.createCoverageMap)({});
20
+ (0, node_fs_1.readdirSync)(outputDir)
21
+ .filter((file) => file.endsWith('.json'))
22
+ .forEach((file) => coverageMap.merge(JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(outputDir, file), 'utf8'))));
23
+ const exclude = new test_exclude_1.default({ cwd });
24
+ coverageMap.filter((file) => exclude.shouldInstrument(file));
25
+ const context = (0, istanbul_lib_report_1.createContext)({ dir: (0, node_path_1.join)(cwd, REPORT_DIR), coverageMap });
26
+ const reportOptions = { projectRoot: cwd, maxCols: process.stdout.columns || 100 };
27
+ (0, istanbul_reports_1.create)('text', reportOptions).execute(context);
28
+ (0, istanbul_reports_1.create)('lcov', reportOptions).execute(context);
29
+ };
30
+ exports.reportIstanbulCoverage = reportIstanbulCoverage;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;yBAGrC,KAAK,YAAY;AAAvC,wBA8EE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;yBAIrC,KAAK,YAAY;AAAvC,wBA4EE"}
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const node_path_1 = require("node:path");
5
5
  const build_kit_1 = require("@genesislcap/build-kit");
6
+ const coverage_report_1 = require("./coverage-report");
6
7
  exports.default = (ctx) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
7
8
  var _a;
8
9
  const { dirs: { cwd }, cli: { isTest, options }, pkg, } = ctx;
@@ -40,9 +41,7 @@ exports.default = (ctx) => tslib_1.__awaiter(void 0, void 0, void 0, function* (
40
41
  const command = `${playwrightTest} "${matchParam}" --runner uvu ${debugParam} ${watchParam} ${covParam}`;
41
42
  (0, build_kit_1.run)(cwd, command);
42
43
  if (coverage) {
43
- const nyc = yield (0, build_kit_1.resolveBin)('nyc');
44
- const nycCommand = `${nyc} report --reporter=text --reporter=lcov`;
45
- (0, build_kit_1.run)(cwd, nycCommand);
44
+ (0, coverage_report_1.reportIstanbulCoverage)(cwd);
46
45
  }
47
46
  }
48
47
  else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/uvu-playwright-builder",
3
3
  "description": "UVU/Playwright builder",
4
- "version": "15.66.0",
4
+ "version": "15.68.0",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -16,17 +16,23 @@
16
16
  "lint:fix": "genx lint -l ox --fix"
17
17
  },
18
18
  "dependencies": {
19
- "@genesislcap/build-kit": "15.66.0",
20
- "@genesislcap/foundation-testing": "15.66.0",
19
+ "@genesislcap/build-kit": "15.68.0",
20
+ "@genesislcap/foundation-testing": "15.68.0",
21
21
  "c8": "^7.11.0",
22
- "nyc": "^15.1.0",
22
+ "istanbul-lib-coverage": "^3.2.2",
23
+ "istanbul-lib-report": "^3.0.1",
24
+ "istanbul-reports": "^3.2.0",
23
25
  "playwright-test": "^14.1.12",
26
+ "test-exclude": "^6.0.0",
24
27
  "tsx": "^4.7.0",
25
28
  "uvu": "0.5.6",
26
29
  "watchlist": "^0.3.1",
27
30
  "yoctocolors": "^2.1.1"
28
31
  },
29
32
  "devDependencies": {
33
+ "@types/istanbul-lib-coverage": "^2.0.6",
34
+ "@types/istanbul-lib-report": "^3.0.3",
35
+ "@types/istanbul-reports": "^3.0.4",
30
36
  "copyfiles": "^2.4.1"
31
37
  },
32
38
  "repository": {