cucumber-dressing 0.1.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/CHANGELOG.md +91 -0
- package/LICENSE +21 -0
- package/README.md +421 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +154 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +13 -0
- package/dist/parser.d.ts +39 -0
- package/dist/parser.js +140 -0
- package/dist/reporter.d.ts +74 -0
- package/dist/reporter.js +235 -0
- package/dist/statistics.d.ts +96 -0
- package/dist/statistics.js +256 -0
- package/dist/template-generator.d.ts +101 -0
- package/dist/template-generator.js +528 -0
- package/dist/templates/scripts.js.template.d.ts +3 -0
- package/dist/templates/scripts.js.template.js +297 -0
- package/dist/templates/styles.css.template.d.ts +3 -0
- package/dist/templates/styles.css.template.js +621 -0
- package/dist/types.d.ts +207 -0
- package/dist/types.js +5 -0
- package/dist/utils.d.ts +112 -0
- package/dist/utils.js +250 -0
- package/package.json +92 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-02-12
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial release of DRESSING
|
|
13
|
+
- Core report generation from Cucumber JSON files
|
|
14
|
+
- Three built-in themes: Modern, Classic, and Dark
|
|
15
|
+
- Interactive HTML reports with expandable features and scenarios
|
|
16
|
+
- Advanced search and filtering capabilities
|
|
17
|
+
- Status-based filtering (Passed, Failed, Skipped)
|
|
18
|
+
- Interactive charts using Chart.js for status distribution and pass rate visualization
|
|
19
|
+
- Comprehensive statistics display with pass rate calculations
|
|
20
|
+
- Support for Gherkin tags with visual tag display
|
|
21
|
+
- Duration tracking for features, scenarios, and steps
|
|
22
|
+
- Screenshot support (inline and linked)
|
|
23
|
+
- Data table rendering with proper formatting
|
|
24
|
+
- Doc string support
|
|
25
|
+
- Error message display for failed steps
|
|
26
|
+
- Metadata support (browser, platform, device, app)
|
|
27
|
+
- Custom data sections for execution info
|
|
28
|
+
- Custom color customization for branding (10+ presets in COLOR_GUIDE.md)
|
|
29
|
+
- CLI interface with comprehensive options (20+ flags)
|
|
30
|
+
- Programmatic API for Node.js integration
|
|
31
|
+
- TypeScript support with full type definitions and JSDoc comments
|
|
32
|
+
- Keyboard shortcuts for navigation
|
|
33
|
+
- Auto-expand failed tests for quick debugging
|
|
34
|
+
- Responsive design for mobile and tablet
|
|
35
|
+
- Print-friendly styles
|
|
36
|
+
- Screenshot management (inline or external)
|
|
37
|
+
- Multiple JSON file consolidation
|
|
38
|
+
- Extensive configuration options
|
|
39
|
+
- Dynamic version reading from package.json
|
|
40
|
+
- Comprehensive documentation (README, QUICKSTART, COMMANDS, COLOR_GUIDE, CONTRIBUTING)
|
|
41
|
+
- Four working examples (basic, metadata, dark theme, charts)
|
|
42
|
+
- GitHub issue templates (bug report, feature request)
|
|
43
|
+
- Pull request template with DRESSING-specific checklist
|
|
44
|
+
- CODEOWNERS file for repository access control
|
|
45
|
+
- Conventional Commits guidelines in documentation
|
|
46
|
+
- Version management workflow with npm lifecycle scripts
|
|
47
|
+
- MIT License
|
|
48
|
+
- Modern UI with clean, contemporary design and smooth animations
|
|
49
|
+
- Fast processing of large test suites
|
|
50
|
+
- Keyboard shortcuts and ARIA labels for accessibility
|
|
51
|
+
- Extensive theming and configuration options
|
|
52
|
+
- Works with any framework outputting Cucumber JSON
|
|
53
|
+
- CI/CD ready - Easy integration with GitHub Actions, Jenkins, etc.
|
|
54
|
+
- TypeScript-first design with comprehensive type definitions
|
|
55
|
+
- Well-documented API with JSDoc for all public functions
|
|
56
|
+
- ESLint and Prettier configuration
|
|
57
|
+
- Jest testing framework setup with ES module support (22 tests)
|
|
58
|
+
- Contributing guidelines with fork→PR workflow
|
|
59
|
+
- Cross-platform support with cross-env for Windows compatibility
|
|
60
|
+
- ES modules (NodeNext) with proper .js extensions
|
|
61
|
+
- Type-safe code with comprehensive TypeScript annotations
|
|
62
|
+
- Optimized package size (excludes test files, source maps, example.ts)
|
|
63
|
+
- Clean code architecture with functions under 100 lines
|
|
64
|
+
- Reduced cyclomatic complexity (under 15)
|
|
65
|
+
- Refactored template methods into focused, maintainable functions
|
|
66
|
+
- `disableLog` option to suppress console output
|
|
67
|
+
- Helper functions for better code organization
|
|
68
|
+
- Semantic versioning support with automated git tagging
|
|
69
|
+
|
|
70
|
+
## [Unreleased]
|
|
71
|
+
|
|
72
|
+
### Planned Features
|
|
73
|
+
|
|
74
|
+
- Additional themes
|
|
75
|
+
- Real-time report updates
|
|
76
|
+
- Test run comparison
|
|
77
|
+
- PDF export
|
|
78
|
+
- Integration with test management tools
|
|
79
|
+
- Trend analysis
|
|
80
|
+
- Screenshot comparison
|
|
81
|
+
- API test enhancements
|
|
82
|
+
- Custom plugins system
|
|
83
|
+
- Report templates
|
|
84
|
+
- Internationalization (i18n)
|
|
85
|
+
- Performance metrics
|
|
86
|
+
- Test flakiness detection
|
|
87
|
+
- Historical data tracking
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
For more details on each release, see the [GitHub Releases](https://github.com/jedau/cucumber-dressing/releases) page.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jed Gonzales
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
# DRESSING 📊
|
|
2
|
+
|
|
3
|
+
**D**etailed **R**eport of **E**xecuted **S**cenarios, **S**teps and **IN**sights for **G**herkin
|
|
4
|
+
|
|
5
|
+
A comprehensive, modern test automation reporter specifically designed for Gherkin-based test results. DRESSING transforms your Cucumber JSON output into beautiful, interactive HTML reports with advanced filtering, search capabilities, and insightful visualizations.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/cucumber-dressing)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://www.typescriptlang.org/)
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- 🎨 **Modern, Beautiful UI** - Three built-in themes (Modern, Classic, Dark)
|
|
14
|
+
- 📊 **Interactive Charts** - Visual representation of test results with Chart.js
|
|
15
|
+
- 🔍 **Advanced Filtering** - Search by feature names, scenarios, tags, or status
|
|
16
|
+
- 📱 **Responsive Design** - Works perfectly on desktop, tablet, and mobile
|
|
17
|
+
- 🖼️ **Screenshot Support** - Inline or linked screenshots from failed tests
|
|
18
|
+
- 🏷️ **Tag Support** - Full support for Gherkin tags
|
|
19
|
+
- ⏱️ **Duration Tracking** - Display execution times for features, scenarios, and steps
|
|
20
|
+
- 📋 **Data Tables** - Beautiful rendering of Gherkin data tables
|
|
21
|
+
- 🎯 **Failed Test Focus** - Automatically expands failed tests for quick debugging
|
|
22
|
+
- ⚡ **Fast & Lightweight** - Efficient processing of large test suites
|
|
23
|
+
- 🔧 **Highly Customizable** - Extensive configuration options
|
|
24
|
+
- 📦 **Zero Config** - Works out of the box with sensible defaults
|
|
25
|
+
- 🎹 **Keyboard Shortcuts** - Quick navigation and control
|
|
26
|
+
- 🌐 **Multi-Browser Support** - Metadata support for cross-browser testing
|
|
27
|
+
- 📝 **Custom Metadata** - Add your own custom data to reports
|
|
28
|
+
|
|
29
|
+
## 📦 Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install cucumber-dressing --save-dev
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or with yarn:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
yarn add cucumber-dressing --dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 🚀 Quick Start
|
|
42
|
+
|
|
43
|
+
### CLI Usage
|
|
44
|
+
|
|
45
|
+
Generate a report from a single JSON file:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx dressing generate -i cucumber-report.json -o report.html
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Generate a report from a directory:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx dressing generate -d ./test-results -o report.html --open
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Programmatic Usage
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
const dressing = require('cucumber-dressing')
|
|
61
|
+
|
|
62
|
+
await dressing.generate({
|
|
63
|
+
jsonDir: './test-results',
|
|
64
|
+
output: './report.html',
|
|
65
|
+
reportTitle: 'My Test Report',
|
|
66
|
+
theme: 'modern',
|
|
67
|
+
openReportInBrowser: true,
|
|
68
|
+
})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### With TypeScript
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { generate } from 'dressing'
|
|
75
|
+
|
|
76
|
+
await generate({
|
|
77
|
+
jsonDir: './test-results',
|
|
78
|
+
output: './report.html',
|
|
79
|
+
reportTitle: 'My Test Report',
|
|
80
|
+
theme: 'modern',
|
|
81
|
+
metadata: {
|
|
82
|
+
browser: {
|
|
83
|
+
name: 'chrome',
|
|
84
|
+
version: '120',
|
|
85
|
+
},
|
|
86
|
+
platform: {
|
|
87
|
+
name: 'windows',
|
|
88
|
+
version: '11',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 📖 Documentation
|
|
95
|
+
|
|
96
|
+
### CLI Options
|
|
97
|
+
|
|
98
|
+
| Option | Alias | Description | Default |
|
|
99
|
+
| -------------------------- | ----- | ---------------------------------- | ----------------------- |
|
|
100
|
+
| `--input <path>` | `-i` | Input JSON file path | - |
|
|
101
|
+
| `--dir <path>` | `-d` | Input directory with JSON files | - |
|
|
102
|
+
| `--output <path>` | `-o` | Output HTML file path | `test-report.html` |
|
|
103
|
+
| `--title <title>` | `-t` | Report title | `DRESSING Test Report` |
|
|
104
|
+
| `--name <name>` | `-n` | Report name | `Test Execution Report` |
|
|
105
|
+
| `--theme <theme>` | - | Theme: modern, classic, dark | `modern` |
|
|
106
|
+
| `--brand <brand>` | - | Brand title | `DRESSING` |
|
|
107
|
+
| `--no-duration` | - | Hide duration information | - |
|
|
108
|
+
| `--duration-in-ms` | - | Durations in milliseconds | - |
|
|
109
|
+
| `--open` | - | Open report in browser | `false` |
|
|
110
|
+
| `--no-inline-screenshots` | - | Use relative paths for screenshots | - |
|
|
111
|
+
| `--screenshots-dir <path>` | - | Screenshots directory | - |
|
|
112
|
+
| `--column-layout <number>` | - | Column layout (1 or 2) | `2` |
|
|
113
|
+
| `--scenario-timestamp` | - | Display scenario timestamps | `false` |
|
|
114
|
+
| `--disable-log` | - | Disable console logging | `false` |
|
|
115
|
+
| `--metadata <json>` | - | Metadata as JSON string | - |
|
|
116
|
+
| `--custom-data <json>` | - | Custom data as JSON string | - |
|
|
117
|
+
| `--colors <json>` | - | Custom colors as JSON string | - |
|
|
118
|
+
|
|
119
|
+
### Programmatic API
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
interface ReportOptions {
|
|
123
|
+
jsonDir?: string // Directory with JSON files
|
|
124
|
+
jsonFile?: string // Single JSON file
|
|
125
|
+
output: string // Output HTML path (required)
|
|
126
|
+
reportTitle?: string // Report page title
|
|
127
|
+
reportName?: string // Report heading name
|
|
128
|
+
theme?: 'modern' | 'classic' | 'dark' // UI theme
|
|
129
|
+
brandTitle?: string // Brand/project name
|
|
130
|
+
displayDuration?: boolean // Show durations (default: true)
|
|
131
|
+
durationInMS?: boolean // Durations in ms (default: false)
|
|
132
|
+
openReportInBrowser?: boolean // Auto-open in browser
|
|
133
|
+
screenshotsDirectory?: string // Screenshots location
|
|
134
|
+
noInlineScreenshots?: boolean // Use links instead of inline
|
|
135
|
+
columnLayout?: 1 | 2 // Layout columns
|
|
136
|
+
scenarioTimestamp?: boolean // Show timestamps
|
|
137
|
+
disableLog?: boolean // Suppress console output
|
|
138
|
+
customStyle?: string // Custom CSS file path
|
|
139
|
+
|
|
140
|
+
colors?: {
|
|
141
|
+
// Custom color scheme
|
|
142
|
+
primary?: string
|
|
143
|
+
success?: string
|
|
144
|
+
danger?: string
|
|
145
|
+
warning?: string
|
|
146
|
+
info?: string
|
|
147
|
+
muted?: string
|
|
148
|
+
background?: string
|
|
149
|
+
backgroundSecondary?: string
|
|
150
|
+
border?: string
|
|
151
|
+
text?: string
|
|
152
|
+
textSecondary?: string
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
metadata?: {
|
|
156
|
+
// Test metadata
|
|
157
|
+
browser?: { name: string; version: string }
|
|
158
|
+
device?: string
|
|
159
|
+
platform?: { name: string; version: string }
|
|
160
|
+
app?: { name: string; version: string }
|
|
161
|
+
[key: string]: any
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
customData?: {
|
|
165
|
+
// Custom data section
|
|
166
|
+
title?: string
|
|
167
|
+
data: Array<{ label: string; value: string }>
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## 🎨 Themes & Customization
|
|
173
|
+
|
|
174
|
+
DRESSING comes with three beautiful themes:
|
|
175
|
+
|
|
176
|
+
### Modern (Default)
|
|
177
|
+
|
|
178
|
+
A clean, contemporary design with smooth animations and a professional look.
|
|
179
|
+
|
|
180
|
+
### Classic
|
|
181
|
+
|
|
182
|
+
A traditional, familiar layout inspired by popular test reporters.
|
|
183
|
+
|
|
184
|
+
### Dark
|
|
185
|
+
|
|
186
|
+
Easy on the eyes with a dark color scheme, perfect for late-night debugging sessions.
|
|
187
|
+
|
|
188
|
+
### Custom Colors
|
|
189
|
+
|
|
190
|
+
Customize report colors to match your brand or preference:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Custom purple theme
|
|
194
|
+
dressing generate -i report.json -o report.html \
|
|
195
|
+
--colors '{"primary":"#9333ea","success":"#22c55e","danger":"#dc2626"}'
|
|
196
|
+
|
|
197
|
+
# Ocean blue theme
|
|
198
|
+
dressing generate -i report.json -o report.html \
|
|
199
|
+
--colors '{"primary":"#0ea5e9","success":"#10b981","danger":"#f43f5e"}'
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Programmatic usage:**
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
import { generate } from 'dressing'
|
|
206
|
+
|
|
207
|
+
await generate({
|
|
208
|
+
jsonFile: 'cucumber.json',
|
|
209
|
+
output: 'report.html',
|
|
210
|
+
colors: {
|
|
211
|
+
primary: '#9333ea', // Header & accent color
|
|
212
|
+
success: '#22c55e', // Pass/success color
|
|
213
|
+
danger: '#dc2626', // Fail/error color
|
|
214
|
+
warning: '#eab308', // Skip/warning color
|
|
215
|
+
info: '#3b82f6', // Info/pending color
|
|
216
|
+
},
|
|
217
|
+
})
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**📖 See [COLOR_GUIDE.md](COLOR_GUIDE.md) for:**
|
|
221
|
+
|
|
222
|
+
- 10+ color presets (Purple, Ocean, Forest, Ember, etc.)
|
|
223
|
+
- Corporate branding examples (GitHub, GitLab, Slack)
|
|
224
|
+
- Accessibility guidelines
|
|
225
|
+
- Environment-specific color schemes
|
|
226
|
+
- Advanced customization tips
|
|
227
|
+
|
|
228
|
+
## 🎯 Advanced Features
|
|
229
|
+
|
|
230
|
+
### Metadata Support
|
|
231
|
+
|
|
232
|
+
Add environment and execution metadata to your reports:
|
|
233
|
+
|
|
234
|
+
```javascript
|
|
235
|
+
await dressing.generate({
|
|
236
|
+
jsonDir: './results',
|
|
237
|
+
output: './report.html',
|
|
238
|
+
metadata: {
|
|
239
|
+
browser: {
|
|
240
|
+
name: 'chrome',
|
|
241
|
+
version: '120.0.6099.109',
|
|
242
|
+
},
|
|
243
|
+
platform: {
|
|
244
|
+
name: 'windows',
|
|
245
|
+
version: '11',
|
|
246
|
+
},
|
|
247
|
+
device: 'Desktop - 1920x1080',
|
|
248
|
+
app: {
|
|
249
|
+
name: 'MyApp',
|
|
250
|
+
version: '2.1.0',
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
})
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Custom Data
|
|
257
|
+
|
|
258
|
+
Add custom information sections:
|
|
259
|
+
|
|
260
|
+
```javascript
|
|
261
|
+
await dressing.generate({
|
|
262
|
+
jsonDir: './results',
|
|
263
|
+
output: './report.html',
|
|
264
|
+
customData: {
|
|
265
|
+
title: 'Execution Info',
|
|
266
|
+
data: [
|
|
267
|
+
{ label: 'Sprint', value: 'Sprint 5' },
|
|
268
|
+
{ label: 'Build', value: 'v2.1.0-rc.3' },
|
|
269
|
+
{ label: 'Environment', value: 'Staging' },
|
|
270
|
+
{ label: 'Executor', value: 'Jenkins CI' },
|
|
271
|
+
{ label: 'Branch', value: 'feature/new-checkout' },
|
|
272
|
+
],
|
|
273
|
+
},
|
|
274
|
+
})
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Screenshot Support
|
|
278
|
+
|
|
279
|
+
DRESSING automatically detects and displays screenshots embedded in your Cucumber JSON:
|
|
280
|
+
|
|
281
|
+
```javascript
|
|
282
|
+
// In your step definitions
|
|
283
|
+
const screenshot = await browser.takeScreenshot()
|
|
284
|
+
this.attach(screenshot, 'image/png')
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Screenshots can be:
|
|
288
|
+
|
|
289
|
+
- **Inline**: Embedded in the HTML (default)
|
|
290
|
+
- **Linked**: Referenced as external files (`noInlineScreenshots: true`)
|
|
291
|
+
|
|
292
|
+
## ⌨️ Keyboard Shortcuts
|
|
293
|
+
|
|
294
|
+
- **Ctrl/Cmd + F**: Focus search box
|
|
295
|
+
- **Ctrl/Cmd + E**: Expand all features and scenarios
|
|
296
|
+
- **Ctrl/Cmd + C**: Collapse all features and scenarios
|
|
297
|
+
- **Escape**: Clear search (when focused)
|
|
298
|
+
|
|
299
|
+
## 🔍 Filtering & Search
|
|
300
|
+
|
|
301
|
+
DRESSING provides powerful filtering capabilities:
|
|
302
|
+
|
|
303
|
+
- **Text Search**: Search across feature names, scenario names, and tags
|
|
304
|
+
- **Status Filter**: Filter by Passed, Failed, Skipped status
|
|
305
|
+
- **Tag Filter**: Click on tags to filter scenarios
|
|
306
|
+
- **Auto-expand Failed**: Failed tests are automatically expanded
|
|
307
|
+
|
|
308
|
+
## 📊 Statistics & Charts
|
|
309
|
+
|
|
310
|
+
Automatically generated statistics include:
|
|
311
|
+
|
|
312
|
+
- Total features, scenarios, and steps
|
|
313
|
+
- Pass/fail/skip counts
|
|
314
|
+
- Execution duration
|
|
315
|
+
- Pass rate percentage
|
|
316
|
+
- Visual charts (pie and doughnut)
|
|
317
|
+
|
|
318
|
+
## 🔗 Integration
|
|
319
|
+
|
|
320
|
+
### Cucumber.js
|
|
321
|
+
|
|
322
|
+
```javascript
|
|
323
|
+
// cucumber.js
|
|
324
|
+
module.exports = {
|
|
325
|
+
default: {
|
|
326
|
+
format: ['json:cucumber-report.json'],
|
|
327
|
+
},
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// After test execution
|
|
331
|
+
const dressing = require('dressing')
|
|
332
|
+
await dressing.generate({
|
|
333
|
+
jsonFile: 'cucumber-report.json',
|
|
334
|
+
output: 'test-report.html',
|
|
335
|
+
})
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### CI/CD Integration
|
|
339
|
+
|
|
340
|
+
#### GitHub Actions
|
|
341
|
+
|
|
342
|
+
```yaml
|
|
343
|
+
- name: Generate Test Report
|
|
344
|
+
run: npx dressing generate -d ./test-results -o ./report.html
|
|
345
|
+
|
|
346
|
+
- name: Upload Report
|
|
347
|
+
uses: actions/upload-artifact@v3
|
|
348
|
+
with:
|
|
349
|
+
name: test-report
|
|
350
|
+
path: report.html
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
#### Jenkins
|
|
354
|
+
|
|
355
|
+
```groovy
|
|
356
|
+
stage('Generate Report') {
|
|
357
|
+
steps {
|
|
358
|
+
sh 'npx dressing generate -d ./test-results -o ./report.html'
|
|
359
|
+
publishHTML([
|
|
360
|
+
reportDir: '.',
|
|
361
|
+
reportFiles: 'report.html',
|
|
362
|
+
reportName: 'DRESSING Report'
|
|
363
|
+
])
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
## 🤝 Contributing
|
|
369
|
+
|
|
370
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
371
|
+
|
|
372
|
+
1. Fork the repository
|
|
373
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
374
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
375
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
376
|
+
5. Open a Pull Request
|
|
377
|
+
|
|
378
|
+
## 📝 License
|
|
379
|
+
|
|
380
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
381
|
+
|
|
382
|
+
## 🙏 Acknowledgments
|
|
383
|
+
|
|
384
|
+
We stand on the shoulders of giants, and this project wouldn't be possible without the incredible work of the open-source community. DRESSING is our contribution to push the testing ecosystem forward.
|
|
385
|
+
|
|
386
|
+
**Inspired by these excellent reporters:**
|
|
387
|
+
|
|
388
|
+
- [cucumber-html-reporter](https://github.com/gkushang/cucumber-html-reporter)
|
|
389
|
+
- [multiple-cucumber-html-reporter](https://github.com/wswebcreation/multiple-cucumber-html-reporter)
|
|
390
|
+
- [allure-report](https://github.com/allure-framework/allure2)
|
|
391
|
+
|
|
392
|
+
**Built with wonderful packages:**
|
|
393
|
+
|
|
394
|
+
- [Chart.js](https://www.chartjs.org/) - Beautiful, responsive charts
|
|
395
|
+
- [Handlebars](https://handlebarsjs.com/) - Powerful templating engine
|
|
396
|
+
- [Commander](https://github.com/tj/commander.js) - Complete CLI solution
|
|
397
|
+
- [TypeScript](https://www.typescriptlang.org/) - Type-safe development
|
|
398
|
+
- And many more amazing open-source tools
|
|
399
|
+
|
|
400
|
+
Thank you to all maintainers and contributors who make the JavaScript ecosystem thrive!
|
|
401
|
+
|
|
402
|
+
## 📧 Support
|
|
403
|
+
|
|
404
|
+
- 📫 Issues: [GitHub Issues](https://github.com/jedau/dressing/issues)
|
|
405
|
+
- 💬 Discussions: [GitHub Discussions](https://github.com/jedau/dressing/discussions)
|
|
406
|
+
- 📖 Documentation: [Full Docs](https://github.com/jedau/dressing#readme)
|
|
407
|
+
|
|
408
|
+
## 🗺️ Roadmap
|
|
409
|
+
|
|
410
|
+
- [ ] Additional themes
|
|
411
|
+
- [ ] Real-time report updates
|
|
412
|
+
- [ ] Comparison between test runs
|
|
413
|
+
- [ ] Export to PDF
|
|
414
|
+
- [ ] Integration with test management tools
|
|
415
|
+
- [ ] Trend analysis over multiple runs
|
|
416
|
+
- [ ] Screenshot comparison for visual tests
|
|
417
|
+
- [ ] API test support enhancements
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
**Made with ❤️ for the testing community**
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* DRESSING CLI - Command Line Interface
|
|
4
|
+
*/
|
|
5
|
+
import { Command } from 'commander';
|
|
6
|
+
import { readFileSync } from 'fs';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
import { generate } from './reporter.js';
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = path.dirname(__filename);
|
|
12
|
+
const packageJson = JSON.parse(readFileSync(path.join(__dirname, '../package.json'), 'utf-8'));
|
|
13
|
+
/**
|
|
14
|
+
* Parse JSON options with error handling
|
|
15
|
+
* @template T - Expected return type
|
|
16
|
+
* @param value - JSON string to parse
|
|
17
|
+
* @param optionName - Name of the option (for error messages)
|
|
18
|
+
* @returns Parsed object of type T, or undefined if value is undefined
|
|
19
|
+
* @throws Exits process with error code 1 if JSON is invalid
|
|
20
|
+
*/
|
|
21
|
+
function parseJsonOption(value, optionName) {
|
|
22
|
+
if (!value) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(value);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
console.error(`Error: Invalid ${optionName} JSON`);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
return undefined; // TypeScript satisfaction - never reached
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build report options from CLI options
|
|
36
|
+
* @param options - CLI options parsed from command line arguments
|
|
37
|
+
* @returns ReportOptions object ready for report generation
|
|
38
|
+
*/
|
|
39
|
+
function buildReportOptions(options) {
|
|
40
|
+
const metadata = parseJsonOption(options.metadata, 'metadata');
|
|
41
|
+
const customData = parseJsonOption(options.customData, 'custom data');
|
|
42
|
+
const colors = parseJsonOption(options.colors, 'colors');
|
|
43
|
+
return {
|
|
44
|
+
jsonFile: options.input ? path.resolve(options.input) : undefined,
|
|
45
|
+
jsonDir: options.dir ? path.resolve(options.dir) : undefined,
|
|
46
|
+
output: path.resolve(options.output),
|
|
47
|
+
reportTitle: options.title,
|
|
48
|
+
reportName: options.name,
|
|
49
|
+
theme: options.theme,
|
|
50
|
+
colors,
|
|
51
|
+
brandTitle: options.brand,
|
|
52
|
+
displayDuration: options.duration !== false,
|
|
53
|
+
durationInMS: options.durationInMs ?? false,
|
|
54
|
+
openReportInBrowser: options.open ?? false,
|
|
55
|
+
noInlineScreenshots: options.inlineScreenshots === false,
|
|
56
|
+
screenshotsDirectory: options.screenshotsDir,
|
|
57
|
+
columnLayout: parseInt(options.columnLayout),
|
|
58
|
+
scenarioTimestamp: options.scenarioTimestamp ?? false,
|
|
59
|
+
disableLog: options.disableLog ?? false,
|
|
60
|
+
metadata,
|
|
61
|
+
customData,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const program = new Command();
|
|
65
|
+
program
|
|
66
|
+
.name('dressing')
|
|
67
|
+
.description('DRESSING - Detailed Report of Executed Scenarios, Steps and INsights for Gherkin')
|
|
68
|
+
.version(packageJson.version);
|
|
69
|
+
program
|
|
70
|
+
.command('generate')
|
|
71
|
+
.description('Generate HTML report from Cucumber JSON files')
|
|
72
|
+
.option('-i, --input <path>', 'Input JSON file path')
|
|
73
|
+
.option('-d, --dir <path>', 'Input directory containing JSON files')
|
|
74
|
+
.option('-o, --output <path>', 'Output HTML file path (required)', 'test-report.html')
|
|
75
|
+
.option('-t, --title <title>', 'Report title', 'DRESSING Test Report')
|
|
76
|
+
.option('-n, --name <name>', 'Report name', 'Test Execution Report')
|
|
77
|
+
.option('--theme <theme>', 'Report theme (modern, classic, dark)', 'modern')
|
|
78
|
+
.option('--brand <brand>', 'Brand title', 'DRESSING')
|
|
79
|
+
.option('--no-duration', 'Hide duration information')
|
|
80
|
+
.option('--duration-in-ms', 'Durations are in milliseconds instead of nanoseconds')
|
|
81
|
+
.option('--open', 'Open report in browser after generation')
|
|
82
|
+
.option('--no-inline-screenshots', 'Use relative paths for screenshots instead of inline')
|
|
83
|
+
.option('--screenshots-dir <path>', 'Screenshots directory path')
|
|
84
|
+
.option('--column-layout <number>', 'Column layout (1 or 2)', '2')
|
|
85
|
+
.option('--scenario-timestamp', 'Display scenario timestamps')
|
|
86
|
+
.option('--disable-log', 'Disable console logging')
|
|
87
|
+
.option('--metadata <json>', 'Metadata as JSON string')
|
|
88
|
+
.option('--custom-data <json>', 'Custom data as JSON string')
|
|
89
|
+
.option('--colors <json>', 'Custom colors as JSON string (e.g. {"primary":"#ff0000","success":"#00ff00"})')
|
|
90
|
+
.action(async (options) => {
|
|
91
|
+
try {
|
|
92
|
+
// Validate required options
|
|
93
|
+
if (!options.input && !options.dir) {
|
|
94
|
+
console.error('Error: Either --input or --dir must be specified');
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
// Build report options
|
|
98
|
+
const reportOptions = buildReportOptions(options);
|
|
99
|
+
// Generate report
|
|
100
|
+
await generate(reportOptions);
|
|
101
|
+
process.exit(0);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
console.error('Error generating report:', error);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
program
|
|
109
|
+
.command('example')
|
|
110
|
+
.description('Show example usage')
|
|
111
|
+
.action(() => {
|
|
112
|
+
console.log(`
|
|
113
|
+
DRESSING - Example Usage
|
|
114
|
+
|
|
115
|
+
1. Generate report from a single JSON file:
|
|
116
|
+
$ dressing generate -i cucumber-report.json -o report.html
|
|
117
|
+
|
|
118
|
+
2. Generate report from a directory of JSON files:
|
|
119
|
+
$ dressing generate -d ./test-results -o report.html
|
|
120
|
+
|
|
121
|
+
3. Generate report with custom theme and open in browser:
|
|
122
|
+
$ dressing generate -d ./results -o report.html --theme dark --open
|
|
123
|
+
|
|
124
|
+
4. Generate report with metadata:
|
|
125
|
+
$ dressing generate -i results.json -o report.html \\
|
|
126
|
+
--metadata '{"browser":{"name":"chrome","version":"120"},"platform":{"name":"windows","version":"11"}}'
|
|
127
|
+
|
|
128
|
+
5. Generate report with custom data:
|
|
129
|
+
$ dressing generate -d ./results -o report.html \\
|
|
130
|
+
--custom-data '{"title":"Sprint 5","data":[{"label":"Environment","value":"Production"},{"label":"Build","value":"v2.1.0"}]}'
|
|
131
|
+
|
|
132
|
+
6. Generate report with custom colors:
|
|
133
|
+
$ dressing generate -i results.json -o report.html \\
|
|
134
|
+
--colors '{"primary":"#9333ea","success":"#22c55e","danger":"#dc2626","warning":"#eab308"}'
|
|
135
|
+
|
|
136
|
+
7. Full example with all options:
|
|
137
|
+
$ dressing generate \\
|
|
138
|
+
-d ./test-results \\
|
|
139
|
+
-o ./reports/test-report.html \\
|
|
140
|
+
--title "My Test Report" \\
|
|
141
|
+
--name "Sprint 5 - Regression Tests" \\
|
|
142
|
+
--theme modern \\
|
|
143
|
+
--colors '{"primary":"#0066cc"}' \\
|
|
144
|
+
--brand "MyApp Tests" \\
|
|
145
|
+
--duration-in-ms \\
|
|
146
|
+
--scenario-timestamp \\
|
|
147
|
+
--open
|
|
148
|
+
|
|
149
|
+
For more information, visit: https://github.com/jedau/dressing
|
|
150
|
+
See COLOR_GUIDE.md for color presets and customization tips.
|
|
151
|
+
`);
|
|
152
|
+
});
|
|
153
|
+
program.parse(process.argv);
|
|
154
|
+
//# sourceMappingURL=cli.js.map
|