test-progress-tracker 2.0.6 → 2.0.8
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 +6 -23
- package/cjs/_virtual/_rolldown/runtime.js +23 -0
- package/cjs/append.d.ts +6 -2
- package/cjs/append.js +30 -38
- package/cjs/append.js.map +1 -1
- package/cjs/compress.js +6 -6
- package/cjs/compress.js.map +1 -1
- package/cjs/constants.js +7 -5
- package/cjs/constants.js.map +1 -1
- package/cjs/index.d.ts +6 -5
- package/cjs/index.js +9 -18
- package/cjs/init.d.ts +6 -2
- package/cjs/init.js +16 -16
- package/cjs/init.js.map +1 -1
- package/cjs/interface.d.ts +32 -29
- package/cjs/load.d.ts +6 -2
- package/cjs/load.js +37 -49
- package/cjs/load.js.map +1 -1
- package/cjs/minify.js +87 -71
- package/cjs/minify.js.map +1 -1
- package/cjs/monitor.d.ts +26 -23
- package/cjs/monitor.js +42 -42
- package/cjs/monitor.js.map +1 -1
- package/cjs/store.js +12 -9
- package/cjs/store.js.map +1 -1
- package/package.json +46 -57
- package/ts/append.ts +19 -19
- package/ts/compress.ts +3 -3
- package/ts/init.ts +6 -6
- package/ts/interface.ts +24 -24
- package/ts/load.ts +28 -29
- package/ts/minify.ts +84 -73
- package/ts/monitor.ts +58 -46
- package/ts/store.ts +7 -7
- package/ts/testResultsExamples.ts +90 -90
- package/cjs/compress.d.ts +0 -3
- package/cjs/constants.d.ts +0 -2
- package/cjs/index.js.map +0 -1
- package/cjs/interface.js +0 -3
- package/cjs/interface.js.map +0 -1
- package/cjs/minify.d.ts +0 -41
- package/cjs/store.d.ts +0 -3
- package/ts/append.spec.ts +0 -36
- package/ts/init.spec.ts +0 -30
- package/ts/load.spec.ts +0 -9
- package/ts/minify.spec.ts +0 -44
- package/ts/monitor.spec.ts +0 -171
package/README.md
CHANGED
|
@@ -3,39 +3,22 @@
|
|
|
3
3
|
[![NPM version][npm-image]][npm-url]
|
|
4
4
|
[![NPM downloads][downloads-image]][downloads-url]
|
|
5
5
|
|
|
6
|
-
[![
|
|
7
|
-
[![Travis CI][travis-image]][travis-url]
|
|
6
|
+
[![GitHub Actions][github-action-image]][github-action-url]
|
|
8
7
|
[![Codecov][codecov-image]][codecov-url]
|
|
9
|
-
[![Coveralls Status][coveralls-image]][coveralls-url]
|
|
10
8
|
[![Codacy Badge][codacy-image]][codacy-url]
|
|
11
9
|
|
|
12
|
-
[![Greenkeeper badge][green-keeper-image]][green-keeper-url]
|
|
13
|
-
[![semantic-release][semantic-release-image]][semantic-release-url]
|
|
14
|
-
|
|
15
|
-
[![Visual Studio Code][vscode-image]][vscode-url]
|
|
16
|
-
[![Wallaby.js][wallaby-image]][wallaby-url]
|
|
17
10
|
|
|
18
11
|
Test Progress Tracker.
|
|
19
12
|
|
|
20
|
-
[circleci-image]: https://circleci.com/gh/unional/test-progress-tracker/tree/master.svg?style=shield
|
|
21
|
-
[circleci-url]: https://circleci.com/gh/unional/test-progress-tracker/tree/master
|
|
22
13
|
[codacy-image]: https://api.codacy.com/project/badge/Grade/b2b1880f3ecd4f2caaeb169a3121e6e9
|
|
23
|
-
[codacy-url]: https://www.codacy.com/app/homawong/test-progress-tracker?utm_source=github.com&utm_medium=referral&utm_content=
|
|
24
|
-
[codecov-image]: https://codecov.io/gh/
|
|
25
|
-
[codecov-url]: https://codecov.io/gh/
|
|
26
|
-
[coveralls-image]: https://coveralls.io/repos/github/unional/test-progress-tracker/badge.svg
|
|
27
|
-
[coveralls-url]: https://coveralls.io/github/unional/test-progress-tracker
|
|
14
|
+
[codacy-url]: https://www.codacy.com/app/homawong/test-progress-tracker?utm_source=github.com&utm_medium=referral&utm_content=cyberuni/test-progress-tracker&utm_campaign=Badge_Grade
|
|
15
|
+
[codecov-image]: https://codecov.io/gh/cyberuni/test-progress-tracker/branch/main/graph/badge.svg
|
|
16
|
+
[codecov-url]: https://codecov.io/gh/cyberuni/test-progress-tracker
|
|
28
17
|
[downloads-image]: https://img.shields.io/npm/dm/test-progress-tracker.svg?style=flat
|
|
29
18
|
[downloads-url]: https://npmjs.org/package/test-progress-tracker
|
|
30
|
-
[
|
|
31
|
-
[
|
|
19
|
+
[github-action-image]: https://github.com/cyberuni/test-progress-tracker/workflows/release/badge.svg
|
|
20
|
+
[github-action-url]: https://github.com/cyberuni/test-progress-tracker/actions?query=workflow%3Arelease
|
|
32
21
|
[npm-image]: https://img.shields.io/npm/v/test-progress-tracker.svg?style=flat
|
|
33
22
|
[npm-url]: https://npmjs.org/package/test-progress-tracker
|
|
34
|
-
[semantic-release-image]:https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
|
35
|
-
[semantic-release-url]:https://github.com/semantic-release/semantic-release
|
|
36
|
-
[travis-image]: https://img.shields.io/travis/unional/test-progress-tracker/master.svg?style=flat
|
|
37
|
-
[travis-url]: https://travis-ci.org/unional/test-progress-tracker?branch=master
|
|
38
23
|
[vscode-image]: https://img.shields.io/badge/vscode-ready-green.svg
|
|
39
24
|
[vscode-url]: https://code.visualstudio.com/
|
|
40
|
-
[wallaby-image]: https://img.shields.io/badge/wallaby.js-configured-green.svg
|
|
41
|
-
[wallaby-url]: https://wallabyjs.com
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.__toESM = __toESM;
|
package/cjs/append.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { FSContext, TestResults } from
|
|
2
|
-
|
|
1
|
+
import { FSContext, TestResults } from "./interface.js";
|
|
2
|
+
//#region ts/append.d.ts
|
|
3
|
+
declare function append(context: Partial<FSContext<'appendFile'>> | undefined, results: TestResults): Promise<void>;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { append };
|
|
6
|
+
//# sourceMappingURL=append.d.ts.map
|
package/cjs/append.js
CHANGED
|
@@ -1,41 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const filepath = path_1.default.join(c.rootDir, constants_1.PROGRESS_FOLDER, constants_1.TEST_RESULT_FILENAME);
|
|
30
|
-
const minified = (0, minify_1.minify)(results);
|
|
31
|
-
const compressed = (0, compress_1.compress)(minified);
|
|
32
|
-
// istanbul ignore next
|
|
33
|
-
if (c.fs.appendFile !== appendFile) {
|
|
34
|
-
appendFile = c.fs.appendFile;
|
|
35
|
-
promisifiedAppendFile = (0, util_1.promisify)(appendFile);
|
|
36
|
-
}
|
|
37
|
-
yield promisifiedAppendFile(filepath, compressed + '\n');
|
|
38
|
-
});
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_compress = require("./compress.js");
|
|
3
|
+
const require_constants = require("./constants.js");
|
|
4
|
+
const require_minify = require("./minify.js");
|
|
5
|
+
const require_store = require("./store.js");
|
|
6
|
+
let node_fs = require("node:fs");
|
|
7
|
+
node_fs = require_runtime.__toESM(node_fs);
|
|
8
|
+
let node_path = require("node:path");
|
|
9
|
+
node_path = require_runtime.__toESM(node_path);
|
|
10
|
+
let unpartial = require("unpartial");
|
|
11
|
+
let node_util = require("node:util");
|
|
12
|
+
//#region ts/append.ts
|
|
13
|
+
let appendFile = node_fs.default.appendFile;
|
|
14
|
+
let promisifiedAppendFile = (0, node_util.promisify)(node_fs.default.appendFile);
|
|
15
|
+
async function append(context, results) {
|
|
16
|
+
const c = (0, unpartial.unpartial)({
|
|
17
|
+
fs: node_fs.default,
|
|
18
|
+
rootDir: require_store.store.value.rootDir
|
|
19
|
+
}, context);
|
|
20
|
+
const filepath = node_path.default.join(c.rootDir, require_constants.PROGRESS_FOLDER, require_constants.TEST_RESULT_FILENAME);
|
|
21
|
+
const minified = require_minify.minify(results);
|
|
22
|
+
const compressed = require_compress.compress(minified);
|
|
23
|
+
// istanbul ignore next
|
|
24
|
+
if (c.fs.appendFile !== appendFile) {
|
|
25
|
+
appendFile = c.fs.appendFile;
|
|
26
|
+
promisifiedAppendFile = (0, node_util.promisify)(appendFile);
|
|
27
|
+
}
|
|
28
|
+
await promisifiedAppendFile(filepath, compressed + "\n");
|
|
39
29
|
}
|
|
30
|
+
//#endregion
|
|
40
31
|
exports.append = append;
|
|
32
|
+
|
|
41
33
|
//# sourceMappingURL=append.js.map
|
package/cjs/append.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"append.js","
|
|
1
|
+
{"version":3,"file":"append.js","names":["fs","promisify","store","path","PROGRESS_FOLDER","TEST_RESULT_FILENAME","minify","compress"],"sources":["../ts/append.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { unpartial } from 'unpartial'\nimport { promisify } from 'node:util'\nimport { compress } from './compress'\nimport { PROGRESS_FOLDER, TEST_RESULT_FILENAME } from './constants'\nimport type { FSContext, TestResults } from './interface'\nimport { minify } from './minify'\nimport { store } from './store'\n\nlet appendFile = fs.appendFile\nlet promisifiedAppendFile = promisify(fs.appendFile)\n\nexport async function append(context: Partial<FSContext<'appendFile'>> | undefined, results: TestResults) {\n\tconst c = unpartial<FSContext<'appendFile'>>({ fs, rootDir: store.value.rootDir }, context)\n\n\tconst filepath = path.join(c.rootDir, PROGRESS_FOLDER, TEST_RESULT_FILENAME)\n\tconst minified = minify(results)\n\tconst compressed = compress(minified)\n\n\t// istanbul ignore next\n\tif (c.fs.appendFile !== appendFile) {\n\t\tappendFile = c.fs.appendFile\n\t\tpromisifiedAppendFile = promisify(appendFile)\n\t}\n\n\tawait promisifiedAppendFile(filepath, compressed + '\\n')\n}\n"],"mappings":";;;;;;;;;;;;AAUA,IAAI,aAAaA,QAAAA,QAAG;AACpB,IAAI,yBAAA,GAAwBC,UAAAA,UAAAA,CAAUD,QAAAA,QAAG,UAAU;AAEnD,eAAsB,OAAO,SAAuD,SAAsB;CACzG,MAAM,KAAA,GAAI,UAAA,UAAA,CAAmC;EAAE,IAAA,QAAA;EAAI,SAASE,cAAAA,MAAM,MAAM;CAAQ,GAAG,OAAO;CAE1F,MAAM,WAAWC,UAAAA,QAAK,KAAK,EAAE,SAASC,kBAAAA,iBAAiBC,kBAAAA,oBAAoB;CAC3E,MAAM,WAAWC,eAAAA,OAAO,OAAO;CAC/B,MAAM,aAAaC,iBAAAA,SAAS,QAAQ;;CAGpC,IAAI,EAAE,GAAG,eAAe,YAAY;EACnC,aAAa,EAAE,GAAG;EAClB,yBAAA,GAAwBN,UAAAA,UAAAA,CAAU,UAAU;CAC7C;CAEA,MAAM,sBAAsB,UAAU,aAAa,IAAI;AACxD"}
|
package/cjs/compress.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decompress = exports.compress = void 0;
|
|
1
|
+
//#region ts/compress.ts
|
|
4
2
|
function compress(obj) {
|
|
5
|
-
|
|
3
|
+
return JSON.stringify(obj);
|
|
6
4
|
}
|
|
7
|
-
exports.compress = compress;
|
|
8
5
|
function decompress(str) {
|
|
9
|
-
|
|
6
|
+
return JSON.parse(str);
|
|
10
7
|
}
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.compress = compress;
|
|
11
10
|
exports.decompress = decompress;
|
|
11
|
+
|
|
12
12
|
//# sourceMappingURL=compress.js.map
|
package/cjs/compress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress.js","
|
|
1
|
+
{"version":3,"file":"compress.js","names":[],"sources":["../ts/compress.ts"],"sourcesContent":["import type { MinifiedTestResult } from './minify'\n\nexport function compress(obj: MinifiedTestResult) {\n\treturn JSON.stringify(obj)\n}\n\nexport function decompress(str: string): MinifiedTestResult {\n\treturn JSON.parse(str) as MinifiedTestResult\n}\n"],"mappings":";AAEA,SAAgB,SAAS,KAAyB;CACjD,OAAO,KAAK,UAAU,GAAG;AAC1B;AAEA,SAAgB,WAAW,KAAiC;CAC3D,OAAO,KAAK,MAAM,GAAG;AACtB"}
|
package/cjs/constants.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.
|
|
1
|
+
//#region ts/constants.ts
|
|
2
|
+
const PROGRESS_FOLDER = ".progress";
|
|
3
|
+
const TEST_RESULT_FILENAME = "test.results";
|
|
4
|
+
//#endregion
|
|
5
|
+
exports.PROGRESS_FOLDER = PROGRESS_FOLDER;
|
|
6
|
+
exports.TEST_RESULT_FILENAME = TEST_RESULT_FILENAME;
|
|
7
|
+
|
|
6
8
|
//# sourceMappingURL=constants.js.map
|
package/cjs/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../ts/constants.ts"],"sourcesContent":["export const PROGRESS_FOLDER = '.progress'\nexport const TEST_RESULT_FILENAME = 'test.results'\n"],"mappings":";AAAA,MAAa,kBAAkB;AAC/B,MAAa,uBAAuB"}
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { CoverageSummary, FSContext, FileCoverageTotal, TestResults } from "./interface.js";
|
|
2
|
+
import { append } from "./append.js";
|
|
3
|
+
import { init } from "./init.js";
|
|
4
|
+
import { load } from "./load.js";
|
|
5
|
+
import { AwaitWriteFinishOptions, GetLastLineContext, MonitorContext, MonitorSubscription, monitor } from "./monitor.js";
|
|
6
|
+
export { AwaitWriteFinishOptions, CoverageSummary, FSContext, FileCoverageTotal, GetLastLineContext, MonitorContext, MonitorSubscription, TestResults, append, init, load, monitor };
|
package/cjs/index.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./append"), exports);
|
|
14
|
-
__exportStar(require("./init"), exports);
|
|
15
|
-
__exportStar(require("./interface"), exports);
|
|
16
|
-
__exportStar(require("./load"), exports);
|
|
17
|
-
__exportStar(require("./monitor"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_append = require("./append.js");
|
|
3
|
+
const require_init = require("./init.js");
|
|
4
|
+
const require_load = require("./load.js");
|
|
5
|
+
const require_monitor = require("./monitor.js");
|
|
6
|
+
exports.append = require_append.append;
|
|
7
|
+
exports.init = require_init.init;
|
|
8
|
+
exports.load = require_load.load;
|
|
9
|
+
exports.monitor = require_monitor.monitor;
|
package/cjs/init.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
//#region ts/init.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Initialize environment.
|
|
3
4
|
* @param options optional options. Mostly for testing purpose.
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
declare function init(options?: {
|
|
7
|
+
rootDir: string;
|
|
7
8
|
}): void;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { init };
|
|
11
|
+
//# sourceMappingURL=init.d.ts.map
|
package/cjs/init.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const constants_1 = require("./constants");
|
|
10
|
-
const store_1 = require("./store");
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_constants = require("./constants.js");
|
|
3
|
+
const require_store = require("./store.js");
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
node_path = require_runtime.__toESM(node_path);
|
|
6
|
+
let mkdirp = require("mkdirp");
|
|
7
|
+
mkdirp = require_runtime.__toESM(mkdirp);
|
|
8
|
+
//#region ts/init.ts
|
|
11
9
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function init(options = { rootDir:
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
* Initialize environment.
|
|
11
|
+
* @param options optional options. Mostly for testing purpose.
|
|
12
|
+
*/
|
|
13
|
+
function init(options = { rootDir: "." }) {
|
|
14
|
+
mkdirp.default.sync(node_path.default.join(options.rootDir, require_constants.PROGRESS_FOLDER));
|
|
15
|
+
require_store.store.value.rootDir = options.rootDir;
|
|
18
16
|
}
|
|
17
|
+
//#endregion
|
|
19
18
|
exports.init = init;
|
|
19
|
+
|
|
20
20
|
//# sourceMappingURL=init.js.map
|
package/cjs/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","
|
|
1
|
+
{"version":3,"file":"init.js","names":["path","PROGRESS_FOLDER"],"sources":["../ts/init.ts"],"sourcesContent":["import mkdirp from 'mkdirp'\nimport path from 'node:path'\nimport { PROGRESS_FOLDER } from './constants'\nimport { store } from './store'\n\n/**\n * Initialize environment.\n * @param options optional options. Mostly for testing purpose.\n */\nexport function init(options = { rootDir: '.' }) {\n\tmkdirp.sync(path.join(options.rootDir, PROGRESS_FOLDER))\n\tstore.value.rootDir = options.rootDir\n}\n"],"mappings":";;;;;;;;;;;;AASA,SAAgB,KAAK,UAAU,EAAE,SAAS,IAAI,GAAG;CAChD,OAAA,QAAO,KAAKA,UAAAA,QAAK,KAAK,QAAQ,SAASC,kBAAAA,eAAe,CAAC;CACvD,cAAA,MAAM,MAAM,UAAU,QAAQ;AAC/B"}
|
package/cjs/interface.d.ts
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
//#region ts/interface.d.ts
|
|
3
|
+
interface FSContext<FSKeys extends keyof typeof fs> {
|
|
4
|
+
fs: Pick<typeof fs, FSKeys>;
|
|
5
|
+
/**
|
|
6
|
+
* Root directory (of the project).
|
|
7
|
+
*/
|
|
8
|
+
rootDir: string;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
interface TestResults {
|
|
11
|
+
startTime: number;
|
|
12
|
+
duration: number;
|
|
13
|
+
numFailedTests: number;
|
|
14
|
+
numFailedTestSuites: number;
|
|
15
|
+
numPassedTests: number;
|
|
16
|
+
numPassedTestSuites: number;
|
|
17
|
+
numTotalTests: number;
|
|
18
|
+
numTotalTestSuites: number;
|
|
19
|
+
filtered?: boolean;
|
|
20
|
+
coverage?: CoverageSummary;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
interface FileCoverageTotal {
|
|
23
|
+
total: number;
|
|
24
|
+
covered: number;
|
|
25
|
+
skipped: number;
|
|
26
|
+
pct?: number;
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
interface CoverageSummary {
|
|
29
|
+
lines: FileCoverageTotal;
|
|
30
|
+
statements: FileCoverageTotal;
|
|
31
|
+
branches: FileCoverageTotal;
|
|
32
|
+
functions: FileCoverageTotal;
|
|
33
33
|
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { CoverageSummary, FSContext, FileCoverageTotal, TestResults };
|
|
36
|
+
//# sourceMappingURL=interface.d.ts.map
|
package/cjs/load.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { FSContext, TestResults } from
|
|
2
|
-
|
|
1
|
+
import { FSContext, TestResults } from "./interface.js";
|
|
2
|
+
//#region ts/load.d.ts
|
|
3
|
+
declare function load(context?: Partial<FSContext<'readFile'>>): Promise<TestResults[]>;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { load };
|
|
6
|
+
//# sourceMappingURL=load.d.ts.map
|
package/cjs/load.js
CHANGED
|
@@ -1,52 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const content = yield promisifiedReadFile(filepath, 'utf-8');
|
|
37
|
-
const entries = content.split('\n');
|
|
38
|
-
return entries.reduce((r, e) => {
|
|
39
|
-
if (!e)
|
|
40
|
-
return r;
|
|
41
|
-
const minified = (0, compress_1.decompress)(e);
|
|
42
|
-
r.push((0, minify_1.unminify)(minified));
|
|
43
|
-
return r;
|
|
44
|
-
}, []);
|
|
45
|
-
}
|
|
46
|
-
catch (_a) {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
});
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_compress = require("./compress.js");
|
|
3
|
+
const require_constants = require("./constants.js");
|
|
4
|
+
const require_minify = require("./minify.js");
|
|
5
|
+
const require_store = require("./store.js");
|
|
6
|
+
let node_fs = require("node:fs");
|
|
7
|
+
node_fs = require_runtime.__toESM(node_fs);
|
|
8
|
+
let node_path = require("node:path");
|
|
9
|
+
node_path = require_runtime.__toESM(node_path);
|
|
10
|
+
let unpartial = require("unpartial");
|
|
11
|
+
let node_util = require("node:util");
|
|
12
|
+
//#region ts/load.ts
|
|
13
|
+
let readFile = node_fs.default.readFile;
|
|
14
|
+
let promisifiedReadFile = (0, node_util.promisify)(node_fs.default.readFile);
|
|
15
|
+
async function load(context) {
|
|
16
|
+
const c = (0, unpartial.unpartial)({
|
|
17
|
+
fs: node_fs.default,
|
|
18
|
+
rootDir: require_store.store.value.rootDir
|
|
19
|
+
}, context);
|
|
20
|
+
const filepath = node_path.default.join(c.rootDir, require_constants.PROGRESS_FOLDER, require_constants.TEST_RESULT_FILENAME);
|
|
21
|
+
// istanbul ignore next
|
|
22
|
+
if (c.fs.readFile !== readFile) {
|
|
23
|
+
readFile = c.fs.readFile;
|
|
24
|
+
promisifiedReadFile = (0, node_util.promisify)(readFile);
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
return (await promisifiedReadFile(filepath, "utf-8")).split("\n").reduce((r, e) => {
|
|
28
|
+
if (!e) return r;
|
|
29
|
+
const minified = require_compress.decompress(e);
|
|
30
|
+
r.push(require_minify.unminify(minified));
|
|
31
|
+
return r;
|
|
32
|
+
}, []);
|
|
33
|
+
} catch {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
50
36
|
}
|
|
37
|
+
//#endregion
|
|
51
38
|
exports.load = load;
|
|
39
|
+
|
|
52
40
|
//# sourceMappingURL=load.js.map
|
package/cjs/load.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.js","
|
|
1
|
+
{"version":3,"file":"load.js","names":["fs","promisify","store","path","PROGRESS_FOLDER","TEST_RESULT_FILENAME","decompress","unminify"],"sources":["../ts/load.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\nimport { unpartial } from 'unpartial'\nimport { promisify } from 'node:util'\nimport { decompress } from './compress'\nimport { PROGRESS_FOLDER, TEST_RESULT_FILENAME } from './constants'\nimport type { FSContext, TestResults } from './interface'\nimport { unminify } from './minify'\nimport { store } from './store'\n\nlet readFile = fs.readFile\nlet promisifiedReadFile = promisify(fs.readFile)\n\nexport async function load(context?: Partial<FSContext<'readFile'>>) {\n\tconst c = unpartial<FSContext<'readFile'>>({ fs, rootDir: store.value.rootDir }, context)\n\n\tconst filepath = path.join(c.rootDir, PROGRESS_FOLDER, TEST_RESULT_FILENAME)\n\n\t// istanbul ignore next\n\tif (c.fs.readFile !== readFile) {\n\t\treadFile = c.fs.readFile\n\t\tpromisifiedReadFile = promisify(readFile)\n\t}\n\n\ttry {\n\t\tconst content = await promisifiedReadFile(filepath, 'utf-8')\n\t\tconst entries = content.split('\\n')\n\t\treturn entries.reduce<TestResults[]>((r, e) => {\n\t\t\tif (!e) return r\n\t\t\tconst minified = decompress(e)\n\t\t\tr.push(unminify(minified))\n\t\t\treturn r\n\t\t}, [])\n\t} catch {\n\t\treturn []\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAUA,IAAI,WAAWA,QAAAA,QAAG;AAClB,IAAI,uBAAA,GAAsBC,UAAAA,UAAAA,CAAUD,QAAAA,QAAG,QAAQ;AAE/C,eAAsB,KAAK,SAA0C;CACpE,MAAM,KAAA,GAAI,UAAA,UAAA,CAAiC;EAAE,IAAA,QAAA;EAAI,SAASE,cAAAA,MAAM,MAAM;CAAQ,GAAG,OAAO;CAExF,MAAM,WAAWC,UAAAA,QAAK,KAAK,EAAE,SAASC,kBAAAA,iBAAiBC,kBAAAA,oBAAoB;;CAG3E,IAAI,EAAE,GAAG,aAAa,UAAU;EAC/B,WAAW,EAAE,GAAG;EAChB,uBAAA,GAAsBJ,UAAAA,UAAAA,CAAU,QAAQ;CACzC;CAEA,IAAI;EAGH,QADgB,MADM,oBAAoB,UAAU,OAAO,EAAA,CACnC,MAAM,IACjB,CAAC,CAAC,QAAuB,GAAG,MAAM;GAC9C,IAAI,CAAC,GAAG,OAAO;GACf,MAAM,WAAWK,iBAAAA,WAAW,CAAC;GAC7B,EAAE,KAAKC,eAAAA,SAAS,QAAQ,CAAC;GACzB,OAAO;EACR,GAAG,CAAC,CAAC;CACN,QAAQ;EACP,OAAO,CAAC;CACT;AACD"}
|