@zohodesk/unit-testing-framework 0.0.31-experimental → 0.0.32-experimental
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
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A modular, Jest-based unit testing framework designed to plug into existing CLI pipelines. Runs Jest **programmatically** via `@jest/core` (no shell execution), ships with sensible defaults, HTML report generation via `jest-html-reporter`, and automatic Jest globals injection.
|
|
4
4
|
|
|
5
|
+
For a command-first onboarding guide (npm commands, flags, and config options), see [UNIT_TEST_TOOL_TRYOUT.md](UNIT_TEST_TOOL_TRYOUT.md).
|
|
6
|
+
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
## Folder Structure
|
|
@@ -11,8 +11,8 @@ var _configLoader = require("../config/config-loader.js");
|
|
|
11
11
|
var _pipelineSummary = require("../utils/pipeline-summary.js");
|
|
12
12
|
var _logger = require("../utils/logger.js");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
function resolveTestFiles(
|
|
15
|
-
const files =
|
|
14
|
+
function resolveTestFiles(rawPattern, projectRoot) {
|
|
15
|
+
const files = rawPattern.split(',').map(f => f.trim()).filter(Boolean);
|
|
16
16
|
const resolved = [];
|
|
17
17
|
for (const file of files) {
|
|
18
18
|
const abs = _path.default.resolve(projectRoot, file);
|
|
@@ -50,11 +50,16 @@ async function createJestRunner(options = {}) {
|
|
|
50
50
|
|
|
51
51
|
// ── 2. Resolve test file pattern ──────────────────────────────
|
|
52
52
|
const rawPattern = testFiles || testPathPattern;
|
|
53
|
-
|
|
53
|
+
let resolvedPaths = null;
|
|
54
|
+
if (rawPattern) {
|
|
55
|
+
// Normalize: split on comma, resolve each to absolute, keep only files that exist.
|
|
56
|
+
resolvedPaths = resolveTestFiles(rawPattern, projectRoot);
|
|
57
|
+
}
|
|
54
58
|
|
|
55
59
|
// ── 3. Build argv & run Jest ──────────────────────────────────
|
|
56
60
|
const argv = (0, _runnerBase.buildArgv)(config, {
|
|
57
|
-
testMatch
|
|
61
|
+
// Pass explicit files to Jest positional args to avoid testMatch glob filtering.
|
|
62
|
+
testPathPattern: resolvedPaths,
|
|
58
63
|
watch,
|
|
59
64
|
projectRoot
|
|
60
65
|
});
|
|
@@ -7,15 +7,15 @@ exports.buildArgv = buildArgv;
|
|
|
7
7
|
exports.executeJest = executeJest;
|
|
8
8
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
9
|
function buildArgv(config, {
|
|
10
|
-
|
|
10
|
+
testPathPattern,
|
|
11
11
|
watch = false
|
|
12
12
|
}) {
|
|
13
13
|
const argv = {
|
|
14
14
|
config: JSON.stringify(config),
|
|
15
15
|
watch
|
|
16
16
|
};
|
|
17
|
-
if (
|
|
18
|
-
argv.
|
|
17
|
+
if (testPathPattern && testPathPattern.length) {
|
|
18
|
+
argv._ = (argv._ || []).concat(testPathPattern);
|
|
19
19
|
}
|
|
20
20
|
return argv;
|
|
21
21
|
}
|