@zohodesk/unit-testing-framework 0.0.27-experimental → 0.0.29-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
@@ -1,6 +1,6 @@
1
1
  # @zohodesk/unit-testing-framework
2
2
 
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, a console reporter, an interactive HTML reporter, and automatic Jest globals injection.
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
5
  ---
6
6
 
@@ -17,18 +17,10 @@ unit-testing-framework/
17
17
  │ │ └── runner-base.js # buildArgv() & executeJest() via @jest/core
18
18
  │ ├── config/
19
19
  │ │ └── default-config.js # getDefaultConfig() – framework defaults
20
- │ ├── reporters/
21
- │ │ ├── default-reporter.js # Console reporter (pass/fail/skip summary)
22
- │ │ ├── html-reporter.js # Self-contained HTML report generator
23
- │ │ ├── html-template.js # HTML markup generation functions
24
- │ │ ├── reporter-utils.js # Shared utils (timer, escapeHtml, stripAnsi)
25
- │ │ └── templates/
26
- │ │ ├── report-script.js # Client-side JS (filters, collapsible suites)
27
- │ │ └── report.css # Dark-themed report stylesheet
28
20
  │ ├── environment/
29
21
  │ │ └── globals-inject.js # Injects jest into globalThis (setup file)
30
22
  │ └── utils/
31
- │ └── logger.js # Colored console logger singleton
23
+ │ └── logger.js # Colored console logger utility
32
24
  ├── build/ # Transpiled output (published to npm)
33
25
  ├── examples/
34
26
  │ └── consumer-cli.js # Example CLI integration
@@ -107,18 +99,18 @@ The framework provides a complete Jest config via `getDefaultConfig(projectRoot)
107
99
 
108
100
  Two reporters are enabled by default:
109
101
 
110
- 1. **Console reporter** (`DefaultReporter`) prints a formatted pass/fail/skip summary with elapsed time to the terminal.
111
- 2. **HTML reporter** (`HtmlReporter`) — generates a self-contained, interactive HTML report.
102
+ 1. **`default`** Jest's built-in console reporter, prints pass/fail/skip summary to the terminal.
103
+ 2. **`jest-html-reporter`** — generates an HTML test report using the [`jest-html-reporter`](https://www.npmjs.com/package/jest-html-reporter) package.
112
104
 
113
- #### HTML Reporter Options
105
+ #### HTML Reporter Configuration
114
106
 
115
- | Option | Default | Description |
107
+ | Option | Value | Description |
116
108
  |---|---|---|
117
- | `outputDir` | `<rootDir>/test-slices/unit-test/unit_reports` | Directory for the HTML file |
118
- | `fileName` | `report.html` | Output filename |
119
- | `title` | `Unit Test Report` | Page title |
120
-
121
- The HTML report supports dark theme, status filters (All / Passed / Failed / Skipped), collapsible suites, and auto-expands suites with failures.
109
+ | `outputPath` | `<rootDir>/test-slices/unit-test/unit_reports/report.html` | Path for the generated report |
110
+ | `pageTitle` | `Unit Test Report` | Page title |
111
+ | `includeFailureMsg` | `true` | Show failure messages in the report |
112
+ | `includeSuiteFailure` | `true` | Show suite-level failures |
113
+ | `theme` | `darkTheme` | Dark-themed report |
122
114
 
123
115
  ### Globals Injection
124
116
 
@@ -150,7 +142,7 @@ if (command === 'unit-test') {
150
142
 
151
143
  ## Build
152
144
 
153
- Source is written in ESM and transpiled to CommonJS via Babel (targets Node 18). Template files under `src/reporters/templates/` are excluded from transpilation and inlined at runtime.
145
+ Source is written in ESM and transpiled to CommonJS via Babel.
154
146
 
155
147
  ```bash
156
148
  npm run build # Transpile src/ → build/
@@ -10,7 +10,7 @@ async function createJestRunner(options = {}) {
10
10
  const {
11
11
  projectRoot = process.cwd(),
12
12
  testPathPattern,
13
- watch = false
13
+ watch = false // Re-runs tests automatically when source files change
14
14
  } = options;
15
15
 
16
16
  // ── 1. Build framework-controlled config ───────────────────
@@ -4,25 +4,27 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Logger = void 0;
7
- class LoggerImpl {
8
- constructor() {
9
- this.SUCCESS_TYPE = 'success';
10
- this.FAILURE_TYPE = 'failure';
11
- this.INFO_TYPE = 'info';
12
- this.colors = {
13
- 'success': ['\x1b[36m', '\x1b[0m'],
14
- 'failure': ['\x1b[31m', '\x1b[0m'],
15
- 'info': ['\x1b[33m', '\x1b[0m']
16
- };
17
- this.consoleLogger = console;
18
- }
19
- error(err) {
20
- this.consoleLogger.error(err);
21
- }
22
- info() {}
7
+ const COLORS = {
8
+ success: '\x1b[36m',
9
+ failure: '\x1b[31m',
10
+ info: '\x1b[33m',
11
+ reset: '\x1b[0m'
12
+ };
13
+
14
+ // eslint-disable-next-line no-console
15
+ const consoleLogger = console;
16
+ const Logger = exports.Logger = {
23
17
  log(type, message) {
24
- const color = this.colors[type];
25
- this.consoleLogger.log(`${color[0]}${message}${color[1]}\n`);
18
+ const color = COLORS[type] || COLORS.reset;
19
+ consoleLogger.log(`${color}${message}${COLORS.reset}`);
20
+ },
21
+ error(message) {
22
+ consoleLogger.error(`${COLORS.failure}${message}${COLORS.reset}`);
23
+ },
24
+ info(message) {
25
+ consoleLogger.log(`${COLORS.info}${message}${COLORS.reset}`);
26
+ },
27
+ success(message) {
28
+ consoleLogger.log(`${COLORS.success}${message}${COLORS.reset}`);
26
29
  }
27
- }
28
- const Logger = exports.Logger = new LoggerImpl();
30
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/unit-testing-framework",
3
- "version": "0.0.27-experimental",
3
+ "version": "0.0.29-experimental",
4
4
  "description": "A modular Jest-based unit testing framework",
5
5
  "main": "./build/index.js",
6
6
  "exports": {
@@ -11,7 +11,6 @@
11
11
  ],
12
12
  "scripts": {
13
13
  "test": "node --experimental-vm-modules node_modules/.bin/jest",
14
- "lint": "eslint src/ index.js",
15
14
  "build": "babel src -d build/src --copy-files && babel index.js --out-file build/index.js",
16
15
  "prepublishOnly": "npm run build",
17
16
  "clean": "rm -rf build && npm run build"
@@ -26,7 +25,7 @@
26
25
  "@jest/types": "30.2.0",
27
26
  "babel-jest": "30.2.0",
28
27
  "jest-environment-jsdom": "30.2.0",
29
- "jest-html-reporter": "^4.3.0"
28
+ "jest-html-reporter": "4.3.0"
30
29
  },
31
30
  "devDependencies": {
32
31
  "@babel/cli": "7.28.6",