playwright-smart-logger 0.0.1
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/LICENSE +21 -0
- package/README.md +172 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/smart-log.d.ts +96 -0
- package/dist/smart-log.d.ts.map +1 -0
- package/dist/smart-log.js +488 -0
- package/dist/smart-log.js.map +1 -0
- package/package.json +95 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Playwright Smart Logger Contributors
|
|
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,172 @@
|
|
|
1
|
+
# Playwright Smart Logger
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/js/playwright-smart-logger)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://github.com/hoangtaiki/playwright-smart-logger/actions/workflows/ci.yml)
|
|
8
|
+
[](https://codecov.io/gh/hoangtaiki/playwright-smart-logger)
|
|
9
|
+
[](https://www.npmjs.com/package/playwright-smart-logger)
|
|
10
|
+
|
|
11
|
+
**Smart logging for Playwright — buffers output, flushes only when needed**
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
Smart Logger provides a `smartLog` fixture with the full console API. Logs are buffered during test execution and only displayed when tests fail, retry, or meet conditions you configure via `flushOn`. Passing tests produce zero log noise.
|
|
16
|
+
|
|
17
|
+
## The Problem
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
PASS Test 1 [15 lines of console.log spam]
|
|
21
|
+
PASS Test 2 [23 lines of console.log spam]
|
|
22
|
+
PASS Test 3 [18 lines of console.log spam]
|
|
23
|
+
FAIL Test 4 [31 lines buried in noise]
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## The Solution
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
PASS Test 1
|
|
30
|
+
PASS Test 2
|
|
31
|
+
PASS Test 3
|
|
32
|
+
FAIL Test 4 [Clean, formatted logs with timestamps and colors]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
### 1. Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install playwright-smart-logger
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Replace your import and add `smartLog` to your test
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { test, expect } from 'playwright-smart-logger';
|
|
47
|
+
|
|
48
|
+
test('user login', async ({ page, smartLog }) => {
|
|
49
|
+
smartLog.info('Navigating to login page');
|
|
50
|
+
await page.goto('https://app.com/login');
|
|
51
|
+
|
|
52
|
+
smartLog.log('Filling credentials');
|
|
53
|
+
await page.fill('#email', 'user@test.com');
|
|
54
|
+
await page.fill('#password', 'password');
|
|
55
|
+
await page.click('#submit');
|
|
56
|
+
|
|
57
|
+
// PASS: zero output
|
|
58
|
+
// FAIL: all logs displayed with colors + timestamps
|
|
59
|
+
await expect(page.locator('.dashboard')).toBeVisible();
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 3. (Optional) Configure in `playwright.config.ts`
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { defineConfig } from '@playwright/test';
|
|
67
|
+
import type { SmartLogOptions } from 'playwright-smart-logger';
|
|
68
|
+
|
|
69
|
+
export default defineConfig({
|
|
70
|
+
use: {
|
|
71
|
+
smartLog: {
|
|
72
|
+
flushOn: ['fail', 'retry'], // when to show logs (default)
|
|
73
|
+
maxBufferSize: 1000, // max buffered entries (default)
|
|
74
|
+
capturePageConsole: false, // capture browser console (default)
|
|
75
|
+
} as SmartLogOptions,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Use Anywhere — Page Objects, Helpers, Utilities
|
|
81
|
+
|
|
82
|
+
Import `smartLog` and use it directly. No need to pass the fixture through parameters:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { smartLog } from 'playwright-smart-logger';
|
|
86
|
+
|
|
87
|
+
class LoginPage {
|
|
88
|
+
constructor(private page: Page) {}
|
|
89
|
+
|
|
90
|
+
async login(username: string, password: string) {
|
|
91
|
+
smartLog.info('Logging in as', username);
|
|
92
|
+
await this.page.fill('#username', username);
|
|
93
|
+
await this.page.fill('#password', password);
|
|
94
|
+
await this.page.click('#submit');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
It's a proxy that delegates to the current test's logger. Each test still gets full isolation.
|
|
100
|
+
|
|
101
|
+
> **Note:** Your test must destructure `smartLog` to activate the logger:
|
|
102
|
+
>
|
|
103
|
+
> ```typescript
|
|
104
|
+
> test('login', async ({ page, smartLog }) => {
|
|
105
|
+
> // ^^^^^^^^ required
|
|
106
|
+
> const loginPage = new LoginPage(page);
|
|
107
|
+
> await loginPage.login('user', 'pass');
|
|
108
|
+
> });
|
|
109
|
+
> ```
|
|
110
|
+
|
|
111
|
+
A `getSmartLog()` function is also available if you prefer explicit function calls.
|
|
112
|
+
|
|
113
|
+
## API
|
|
114
|
+
|
|
115
|
+
The `smartLog` fixture mirrors the `console` API:
|
|
116
|
+
|
|
117
|
+
| Method | Description |
|
|
118
|
+
| --------------------------------------- | ----------------------- |
|
|
119
|
+
| `log`, `debug`, `info`, `warn`, `error` | Log at different levels |
|
|
120
|
+
| `group` / `groupEnd` | Indented log groups |
|
|
121
|
+
| `table(data, columns?)` | Structured data display |
|
|
122
|
+
| `dir(obj)` | Object inspection |
|
|
123
|
+
| `time` / `timeLog` / `timeEnd` | Performance timing |
|
|
124
|
+
| `assert(condition, ...args)` | Log only on failure |
|
|
125
|
+
| `count` / `countReset` | Counters |
|
|
126
|
+
| `trace` | Stack trace |
|
|
127
|
+
| `clear` / `getBuffer` / `flush` | Buffer control |
|
|
128
|
+
|
|
129
|
+
## Logging Inside Custom Fixtures
|
|
130
|
+
|
|
131
|
+
When extending the base test with custom fixtures, you **must** declare `smartLog` as a dependency so Playwright initializes the logger before your fixture runs:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { test as base, smartLog } from 'playwright-smart-logger';
|
|
135
|
+
|
|
136
|
+
const test = base.extend({
|
|
137
|
+
autoTest: [
|
|
138
|
+
async ({ page, smartLog: _smartLog }, use, testInfo) => {
|
|
139
|
+
// ^^^^^^^^^^^^^^^^ required — ensures the logger is initialized
|
|
140
|
+
|
|
141
|
+
// Global proxy works because smartLog fixture is active
|
|
142
|
+
smartLog.info('Setting up auto fixture');
|
|
143
|
+
|
|
144
|
+
// Or use the fixture directly
|
|
145
|
+
_smartLog.info('Also works');
|
|
146
|
+
|
|
147
|
+
await use();
|
|
148
|
+
},
|
|
149
|
+
{ auto: true },
|
|
150
|
+
],
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Without `smartLog` in the destructured dependencies, the global `smartLog` proxy will throw because the logger may not be initialized yet. See [Examples](Example.md#logging-inside-custom-fixtures) for more details.
|
|
155
|
+
|
|
156
|
+
## Documentation
|
|
157
|
+
|
|
158
|
+
- **[Examples & API Details](Example.md)** — Usage patterns, configuration, real-world scenarios
|
|
159
|
+
- **[Migration Guide](MIGRATION.md)** — Adopting Smart Logger in existing projects
|
|
160
|
+
- **[Contributing](CONTRIBUTING.md)** — Development guidelines
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
|
|
164
|
+
MIT © [Harry Tran](https://github.com/hoangtaiki)
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
<div align="center">
|
|
169
|
+
|
|
170
|
+
**[GitHub](https://github.com/hoangtaiki/playwright-smart-logger) · [NPM](https://www.npmjs.com/package/playwright-smart-logger)**
|
|
171
|
+
|
|
172
|
+
</div>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { test, expect, getSmartLog, smartLog } from './smart-log';
|
|
2
|
+
export type { SmartLogOptions, SmartLog, LogLevel, LogEntry, FlushOn, } from './smart-log';
|
|
3
|
+
export type { TestInfo, Page, Browser, BrowserContext } from '@playwright/test';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClE,YAAY,EACV,eAAe,EACf,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,GACR,MAAM,aAAa,CAAC;AAGrB,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.smartLog = exports.getSmartLog = exports.expect = exports.test = void 0;
|
|
4
|
+
// Export the main test fixture and types
|
|
5
|
+
var smart_log_1 = require("./smart-log");
|
|
6
|
+
Object.defineProperty(exports, "test", { enumerable: true, get: function () { return smart_log_1.test; } });
|
|
7
|
+
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return smart_log_1.expect; } });
|
|
8
|
+
Object.defineProperty(exports, "getSmartLog", { enumerable: true, get: function () { return smart_log_1.getSmartLog; } });
|
|
9
|
+
Object.defineProperty(exports, "smartLog", { enumerable: true, get: function () { return smart_log_1.smartLog; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,yCAAkE;AAAzD,iGAAA,IAAI,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,qGAAA,QAAQ,OAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
declare module '@playwright/test' {
|
|
2
|
+
interface PlaywrightTestOptions {
|
|
3
|
+
smartLog?: SmartLogOptions;
|
|
4
|
+
}
|
|
5
|
+
interface PlaywrightWorkerOptions {
|
|
6
|
+
smartLog?: SmartLogOptions;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export type FlushOn = 'fail' | 'pass' | 'skip' | 'fixme' | 'retry' | 'timeout';
|
|
10
|
+
export interface SmartLogOptions {
|
|
11
|
+
/** When to flush logs (default: ['fail', 'retry']) */
|
|
12
|
+
flushOn?: FlushOn[];
|
|
13
|
+
/** Maximum number of log entries to keep in buffer (default: 1000) */
|
|
14
|
+
maxBufferSize?: number;
|
|
15
|
+
/** Capture browser console logs via page.on('console') (default: false) */
|
|
16
|
+
capturePageConsole?: boolean;
|
|
17
|
+
/** Attach log output as a file in the test report (default: false) */
|
|
18
|
+
attachToReport?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type LogLevel = 'log' | 'debug' | 'info' | 'warn' | 'error';
|
|
21
|
+
export interface LogEntry {
|
|
22
|
+
level: LogLevel;
|
|
23
|
+
args: any[];
|
|
24
|
+
timestamp: number;
|
|
25
|
+
source: 'test' | 'browser';
|
|
26
|
+
groupLevel: number;
|
|
27
|
+
}
|
|
28
|
+
export interface SmartLog {
|
|
29
|
+
/** General purpose logging */
|
|
30
|
+
log(...args: any[]): void;
|
|
31
|
+
/** Debug level logging */
|
|
32
|
+
debug(...args: any[]): void;
|
|
33
|
+
/** Info level logging */
|
|
34
|
+
info(...args: any[]): void;
|
|
35
|
+
/** Warning level logging */
|
|
36
|
+
warn(...args: any[]): void;
|
|
37
|
+
/** Error level logging */
|
|
38
|
+
error(...args: any[]): void;
|
|
39
|
+
/** Start a new group (increases indentation) */
|
|
40
|
+
group(...args: any[]): void;
|
|
41
|
+
/** End the current group (decreases indentation) */
|
|
42
|
+
groupEnd(): void;
|
|
43
|
+
/** Log structured data as a table */
|
|
44
|
+
table(data: any, columns?: string[]): void;
|
|
45
|
+
/** Log an object with formatting */
|
|
46
|
+
dir(obj: any): void;
|
|
47
|
+
/** Start a timer */
|
|
48
|
+
time(label?: string): void;
|
|
49
|
+
/** Stop a timer and log the elapsed time */
|
|
50
|
+
timeEnd(label?: string): void;
|
|
51
|
+
/** Log the current value of a timer without stopping it */
|
|
52
|
+
timeLog(label?: string, ...args: any[]): void;
|
|
53
|
+
/** Log an error if the assertion is false */
|
|
54
|
+
assert(condition?: boolean, ...args: any[]): void;
|
|
55
|
+
/** Increment and log a counter */
|
|
56
|
+
count(label?: string): void;
|
|
57
|
+
/** Reset a counter */
|
|
58
|
+
countReset(label?: string): void;
|
|
59
|
+
/** Log a stack trace */
|
|
60
|
+
trace(...args: any[]): void;
|
|
61
|
+
/** Clear the log buffer and reset group depth */
|
|
62
|
+
clear(): void;
|
|
63
|
+
/** Get current buffer contents */
|
|
64
|
+
getBuffer(): LogEntry[];
|
|
65
|
+
/** Manually flush logs to console and report */
|
|
66
|
+
flush(): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get the SmartLog instance for the currently running test.
|
|
70
|
+
*
|
|
71
|
+
* @throws {Error} If called outside of a test using the smartLog fixture.
|
|
72
|
+
*/
|
|
73
|
+
export declare function getSmartLog(): SmartLog;
|
|
74
|
+
/**
|
|
75
|
+
* Global SmartLog proxy — access the current test's logger directly from anywhere.
|
|
76
|
+
* No function call needed, just import and use.
|
|
77
|
+
*
|
|
78
|
+
* @throws {Error} If accessed outside of a test using the smartLog fixture.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { smartLog } from 'playwright-smart-logger';
|
|
83
|
+
*
|
|
84
|
+
* class LoginPage {
|
|
85
|
+
* async login(username: string, password: string) {
|
|
86
|
+
* smartLog.info('Logging in as', username);
|
|
87
|
+
* }
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export declare const smartLog: SmartLog;
|
|
92
|
+
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
|
|
93
|
+
smartLog: SmartLog;
|
|
94
|
+
}, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
|
|
95
|
+
export { expect } from '@playwright/test';
|
|
96
|
+
//# sourceMappingURL=smart-log.d.ts.map
|
|
@@ -0,0 +1 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tC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,EAAE,QASrB,CAAC;AAEH,eAAO,MAAM,IAAI;cAA2B,QAAQ;wGAoDlD,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.expect = exports.test = exports.smartLog = void 0;
|
|
7
|
+
exports.getSmartLog = getSmartLog;
|
|
8
|
+
const test_1 = require("@playwright/test");
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
/**
|
|
11
|
+
* Safely stringify a value, handling circular references.
|
|
12
|
+
*/
|
|
13
|
+
function safeStringify(obj, indent = 2) {
|
|
14
|
+
const seen = new WeakSet();
|
|
15
|
+
try {
|
|
16
|
+
return JSON.stringify(obj, (_key, value) => {
|
|
17
|
+
if (typeof value === 'object' && value !== null) {
|
|
18
|
+
if (seen.has(value)) {
|
|
19
|
+
return '[Circular]';
|
|
20
|
+
}
|
|
21
|
+
seen.add(value);
|
|
22
|
+
}
|
|
23
|
+
if (typeof value === 'bigint') {
|
|
24
|
+
return value.toString();
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
}, indent);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return String(obj);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Format a single argument for display.
|
|
35
|
+
*/
|
|
36
|
+
function formatArg(arg) {
|
|
37
|
+
if (arg === undefined)
|
|
38
|
+
return 'undefined';
|
|
39
|
+
if (arg === null)
|
|
40
|
+
return 'null';
|
|
41
|
+
if (typeof arg === 'string')
|
|
42
|
+
return arg;
|
|
43
|
+
if (typeof arg === 'symbol')
|
|
44
|
+
return arg.toString();
|
|
45
|
+
if (arg instanceof Error)
|
|
46
|
+
return `${arg.name}: ${arg.message}`;
|
|
47
|
+
if (typeof arg === 'object')
|
|
48
|
+
return safeStringify(arg);
|
|
49
|
+
return String(arg);
|
|
50
|
+
}
|
|
51
|
+
class SmartLogger {
|
|
52
|
+
constructor(testInfo, page, options) {
|
|
53
|
+
this.testInfo = testInfo;
|
|
54
|
+
this.page = page;
|
|
55
|
+
this.options = options;
|
|
56
|
+
this.buffer = [];
|
|
57
|
+
this.timers = new Map();
|
|
58
|
+
this.counters = new Map();
|
|
59
|
+
this.groupDepth = 0;
|
|
60
|
+
this.setupBrowserConsoleCapture();
|
|
61
|
+
}
|
|
62
|
+
setupBrowserConsoleCapture() {
|
|
63
|
+
if (!this.options.capturePageConsole || !this.page) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.pageConsoleListener = msg => {
|
|
67
|
+
try {
|
|
68
|
+
const level = this.mapBrowserLogLevel(msg.type());
|
|
69
|
+
const args = msg.args().map((arg) => {
|
|
70
|
+
try {
|
|
71
|
+
return arg.toString();
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return '[object]';
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
this.addLogEntry(level, args, 'browser');
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// Silently ignore browser console capture errors
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
this.page.on('console', this.pageConsoleListener);
|
|
84
|
+
}
|
|
85
|
+
mapBrowserLogLevel(type) {
|
|
86
|
+
switch (type) {
|
|
87
|
+
case 'log':
|
|
88
|
+
return 'log';
|
|
89
|
+
case 'debug':
|
|
90
|
+
return 'debug';
|
|
91
|
+
case 'info':
|
|
92
|
+
return 'info';
|
|
93
|
+
case 'warning':
|
|
94
|
+
return 'warn';
|
|
95
|
+
case 'error':
|
|
96
|
+
return 'error';
|
|
97
|
+
default:
|
|
98
|
+
return 'log';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
addLogEntry(level, args, source = 'test') {
|
|
102
|
+
const entry = {
|
|
103
|
+
level,
|
|
104
|
+
args: [...args],
|
|
105
|
+
timestamp: Date.now(),
|
|
106
|
+
source,
|
|
107
|
+
groupLevel: this.groupDepth,
|
|
108
|
+
};
|
|
109
|
+
this.buffer.push(entry);
|
|
110
|
+
// Trim buffer if it exceeds maxBufferSize
|
|
111
|
+
if (this.buffer.length > this.options.maxBufferSize) {
|
|
112
|
+
this.buffer = this.buffer.slice(-this.options.maxBufferSize);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// --- Core logging methods ---
|
|
116
|
+
log(...args) {
|
|
117
|
+
this.addLogEntry('log', args);
|
|
118
|
+
}
|
|
119
|
+
debug(...args) {
|
|
120
|
+
this.addLogEntry('debug', args);
|
|
121
|
+
}
|
|
122
|
+
info(...args) {
|
|
123
|
+
this.addLogEntry('info', args);
|
|
124
|
+
}
|
|
125
|
+
warn(...args) {
|
|
126
|
+
this.addLogEntry('warn', args);
|
|
127
|
+
}
|
|
128
|
+
error(...args) {
|
|
129
|
+
this.addLogEntry('error', args);
|
|
130
|
+
}
|
|
131
|
+
// --- Grouping ---
|
|
132
|
+
group(...args) {
|
|
133
|
+
this.addLogEntry('log', args.length > 0 ? args : ['']);
|
|
134
|
+
this.groupDepth++;
|
|
135
|
+
}
|
|
136
|
+
groupEnd() {
|
|
137
|
+
if (this.groupDepth > 0) {
|
|
138
|
+
this.groupDepth--;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// --- Structured data ---
|
|
142
|
+
table(data, columns) {
|
|
143
|
+
const entry = {
|
|
144
|
+
level: 'log',
|
|
145
|
+
args: columns ? [data, { __tableColumns: columns }] : [data],
|
|
146
|
+
timestamp: Date.now(),
|
|
147
|
+
source: 'test',
|
|
148
|
+
groupLevel: this.groupDepth,
|
|
149
|
+
};
|
|
150
|
+
// Mark this entry as a table for formatting
|
|
151
|
+
entry.__isTable = true;
|
|
152
|
+
this.buffer.push(entry);
|
|
153
|
+
if (this.buffer.length > this.options.maxBufferSize) {
|
|
154
|
+
this.buffer = this.buffer.slice(-this.options.maxBufferSize);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
dir(obj) {
|
|
158
|
+
const entry = {
|
|
159
|
+
level: 'log',
|
|
160
|
+
args: [obj],
|
|
161
|
+
timestamp: Date.now(),
|
|
162
|
+
source: 'test',
|
|
163
|
+
groupLevel: this.groupDepth,
|
|
164
|
+
};
|
|
165
|
+
entry.__isDir = true;
|
|
166
|
+
this.buffer.push(entry);
|
|
167
|
+
if (this.buffer.length > this.options.maxBufferSize) {
|
|
168
|
+
this.buffer = this.buffer.slice(-this.options.maxBufferSize);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// --- Timing ---
|
|
172
|
+
time(label = 'default') {
|
|
173
|
+
if (this.timers.has(label)) {
|
|
174
|
+
this.addLogEntry('warn', [`Timer "${label}" already exists`]);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
this.timers.set(label, Date.now());
|
|
178
|
+
}
|
|
179
|
+
timeEnd(label = 'default') {
|
|
180
|
+
const startTime = this.timers.get(label);
|
|
181
|
+
if (startTime === undefined) {
|
|
182
|
+
this.addLogEntry('warn', [`Timer "${label}" does not exist`]);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const duration = Date.now() - startTime;
|
|
186
|
+
this.timers.delete(label);
|
|
187
|
+
this.addLogEntry('log', [`${label}: ${duration}ms`]);
|
|
188
|
+
}
|
|
189
|
+
timeLog(label = 'default', ...args) {
|
|
190
|
+
const startTime = this.timers.get(label);
|
|
191
|
+
if (startTime === undefined) {
|
|
192
|
+
this.addLogEntry('warn', [`Timer "${label}" does not exist`]);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const elapsed = Date.now() - startTime;
|
|
196
|
+
this.addLogEntry('log', [`${label}: ${elapsed}ms`, ...args]);
|
|
197
|
+
}
|
|
198
|
+
// --- Assertion ---
|
|
199
|
+
assert(condition, ...args) {
|
|
200
|
+
if (!condition) {
|
|
201
|
+
if (args.length > 0) {
|
|
202
|
+
this.addLogEntry('error', ['Assertion failed:', ...args]);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
this.addLogEntry('error', ['Assertion failed']);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// --- Counting ---
|
|
210
|
+
count(label = 'default') {
|
|
211
|
+
const current = this.counters.get(label) ?? 0;
|
|
212
|
+
const next = current + 1;
|
|
213
|
+
this.counters.set(label, next);
|
|
214
|
+
this.addLogEntry('log', [`${label}: ${next}`]);
|
|
215
|
+
}
|
|
216
|
+
countReset(label = 'default') {
|
|
217
|
+
if (!this.counters.has(label)) {
|
|
218
|
+
this.addLogEntry('warn', [`Count for "${label}" does not exist`]);
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
this.counters.delete(label);
|
|
222
|
+
}
|
|
223
|
+
// --- Trace ---
|
|
224
|
+
trace(...args) {
|
|
225
|
+
const stack = new Error().stack || '';
|
|
226
|
+
// Remove the first two lines (Error + this trace() call)
|
|
227
|
+
const cleanStack = stack.split('\n').slice(2).join('\n');
|
|
228
|
+
this.addLogEntry('log', ['Trace:', ...args, '\n' + cleanStack]);
|
|
229
|
+
}
|
|
230
|
+
// --- Clear ---
|
|
231
|
+
clear() {
|
|
232
|
+
this.buffer = [];
|
|
233
|
+
this.groupDepth = 0;
|
|
234
|
+
}
|
|
235
|
+
// --- Buffer access ---
|
|
236
|
+
getBuffer() {
|
|
237
|
+
return [...this.buffer];
|
|
238
|
+
}
|
|
239
|
+
// --- Flush ---
|
|
240
|
+
async flush() {
|
|
241
|
+
if (this.buffer.length === 0) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const output = this.formatBufferForOutput();
|
|
245
|
+
// Print to console with colors
|
|
246
|
+
process.stdout.write('\n' + chalk_1.default.cyan('=== Smart Logger Output ===') + '\n');
|
|
247
|
+
process.stdout.write(output + '\n');
|
|
248
|
+
process.stdout.write(chalk_1.default.cyan('=== End Smart Logger Output ===') + '\n\n');
|
|
249
|
+
// Attach log output to the test report
|
|
250
|
+
if (this.options.attachToReport) {
|
|
251
|
+
const attachment = this.formatBufferForAttachment();
|
|
252
|
+
await this.testInfo.attach('smart-log', {
|
|
253
|
+
body: Buffer.from(attachment, 'utf-8'),
|
|
254
|
+
contentType: 'text/plain',
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
this.clear();
|
|
258
|
+
}
|
|
259
|
+
// --- Formatting ---
|
|
260
|
+
formatBufferForOutput() {
|
|
261
|
+
return this.buffer
|
|
262
|
+
.map(entry => {
|
|
263
|
+
const timestamp = new Date(entry.timestamp).toISOString().slice(11, 23);
|
|
264
|
+
const sourcePrefix = entry.source === 'browser' ? '[BROWSER] ' : '';
|
|
265
|
+
const levelColor = this.getLevelColor(entry.level);
|
|
266
|
+
const indent = ' '.repeat(entry.groupLevel);
|
|
267
|
+
let content;
|
|
268
|
+
if (entry.__isTable) {
|
|
269
|
+
content = this.formatTableData(entry.args[0], entry.args[1]?.__tableColumns);
|
|
270
|
+
}
|
|
271
|
+
else if (entry.__isDir) {
|
|
272
|
+
content = safeStringify(entry.args[0]);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
content = entry.args.map(formatArg).join(' ');
|
|
276
|
+
}
|
|
277
|
+
return `${chalk_1.default.gray(timestamp)} ${levelColor(`[${entry.level.toUpperCase()}]`)} ${indent}${sourcePrefix}${content}`;
|
|
278
|
+
})
|
|
279
|
+
.join('\n');
|
|
280
|
+
}
|
|
281
|
+
formatBufferForAttachment() {
|
|
282
|
+
const header = `Smart Logger Output - ${this.testInfo.title}\n${'='.repeat(50)}\n\n`;
|
|
283
|
+
const content = this.buffer
|
|
284
|
+
.map(entry => {
|
|
285
|
+
const timestamp = new Date(entry.timestamp).toISOString().slice(11, 23);
|
|
286
|
+
const sourcePrefix = entry.source === 'browser' ? '[BROWSER] ' : '';
|
|
287
|
+
const indent = ' '.repeat(entry.groupLevel);
|
|
288
|
+
let text;
|
|
289
|
+
if (entry.__isTable) {
|
|
290
|
+
text = this.formatTableData(entry.args[0], entry.args[1]?.__tableColumns);
|
|
291
|
+
}
|
|
292
|
+
else if (entry.__isDir) {
|
|
293
|
+
text = safeStringify(entry.args[0]);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
text = entry.args.map(formatArg).join(' ');
|
|
297
|
+
}
|
|
298
|
+
return `${timestamp} [${entry.level.toUpperCase()}] ${indent}${sourcePrefix}${text}`;
|
|
299
|
+
})
|
|
300
|
+
.join('\n');
|
|
301
|
+
return header + content + '\n\n' + '='.repeat(50);
|
|
302
|
+
}
|
|
303
|
+
formatTableData(data, columns) {
|
|
304
|
+
if (data === null || data === undefined) {
|
|
305
|
+
return '(empty table)';
|
|
306
|
+
}
|
|
307
|
+
if (!Array.isArray(data)) {
|
|
308
|
+
// Single object: format as key-value pairs
|
|
309
|
+
if (typeof data === 'object') {
|
|
310
|
+
try {
|
|
311
|
+
const keys = Object.keys(data);
|
|
312
|
+
if (keys.length === 0)
|
|
313
|
+
return '(empty table)';
|
|
314
|
+
const rows = keys.map(key => `${key} | ${String(data[key])}`);
|
|
315
|
+
return ['Key | Value', '--- | ---', ...rows].join('\n');
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
return safeStringify(data);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return String(data);
|
|
322
|
+
}
|
|
323
|
+
if (data.length === 0) {
|
|
324
|
+
return '(empty table)';
|
|
325
|
+
}
|
|
326
|
+
try {
|
|
327
|
+
const headers = columns || Object.keys(data[0] || {});
|
|
328
|
+
if (headers.length === 0)
|
|
329
|
+
return safeStringify(data);
|
|
330
|
+
const headerRow = headers.join(' | ');
|
|
331
|
+
const separator = headers.map(() => '---').join(' | ');
|
|
332
|
+
const rows = data.map(item => headers.map(header => String(item?.[header] ?? '')).join(' | '));
|
|
333
|
+
return [headerRow, separator, ...rows].join('\n');
|
|
334
|
+
}
|
|
335
|
+
catch {
|
|
336
|
+
return safeStringify(data);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
getLevelColor(level) {
|
|
340
|
+
switch (level) {
|
|
341
|
+
case 'error':
|
|
342
|
+
return chalk_1.default.red;
|
|
343
|
+
case 'warn':
|
|
344
|
+
return chalk_1.default.yellow;
|
|
345
|
+
case 'info':
|
|
346
|
+
return chalk_1.default.blue;
|
|
347
|
+
case 'debug':
|
|
348
|
+
return chalk_1.default.magenta;
|
|
349
|
+
case 'log':
|
|
350
|
+
return chalk_1.default.white;
|
|
351
|
+
default:
|
|
352
|
+
return chalk_1.default.white;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
// --- Cleanup ---
|
|
356
|
+
async cleanup() {
|
|
357
|
+
if (this.pageConsoleListener && this.page) {
|
|
358
|
+
try {
|
|
359
|
+
this.page.off('console', this.pageConsoleListener);
|
|
360
|
+
}
|
|
361
|
+
catch {
|
|
362
|
+
// Ignore cleanup errors
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
this.timers.clear();
|
|
366
|
+
this.counters.clear();
|
|
367
|
+
}
|
|
368
|
+
// --- Flush decision ---
|
|
369
|
+
shouldFlush(testInfo) {
|
|
370
|
+
const status = testInfo.status;
|
|
371
|
+
const retry = testInfo.retry;
|
|
372
|
+
// Always flush on retries if 'retry' is in flushOn array
|
|
373
|
+
if (retry > 0 && this.options.flushOn.includes('retry')) {
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
// Map test status to FlushOn values
|
|
377
|
+
const statusMap = {
|
|
378
|
+
passed: 'pass',
|
|
379
|
+
failed: 'fail',
|
|
380
|
+
skipped: 'skip',
|
|
381
|
+
timedOut: 'timeout',
|
|
382
|
+
expected: 'fixme', // For tests marked with test.fail()
|
|
383
|
+
};
|
|
384
|
+
if (typeof status === 'string' && status in statusMap) {
|
|
385
|
+
const flushType = statusMap[status];
|
|
386
|
+
return this.options.flushOn.includes(flushType);
|
|
387
|
+
}
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
const defaultOptions = {
|
|
392
|
+
flushOn: ['fail', 'retry'],
|
|
393
|
+
maxBufferSize: 1000,
|
|
394
|
+
capturePageConsole: false,
|
|
395
|
+
attachToReport: false,
|
|
396
|
+
};
|
|
397
|
+
// --- Global accessor ---
|
|
398
|
+
let currentFixture = null;
|
|
399
|
+
function assertFixtureActive() {
|
|
400
|
+
if (!currentFixture) {
|
|
401
|
+
throw new Error('smartLog was accessed outside of a test that uses the smartLog fixture. ' +
|
|
402
|
+
'Make sure your test imports { test } from "playwright-smart-logger" and uses the smartLog fixture.');
|
|
403
|
+
}
|
|
404
|
+
return currentFixture;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Get the SmartLog instance for the currently running test.
|
|
408
|
+
*
|
|
409
|
+
* @throws {Error} If called outside of a test using the smartLog fixture.
|
|
410
|
+
*/
|
|
411
|
+
function getSmartLog() {
|
|
412
|
+
return assertFixtureActive();
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Global SmartLog proxy — access the current test's logger directly from anywhere.
|
|
416
|
+
* No function call needed, just import and use.
|
|
417
|
+
*
|
|
418
|
+
* @throws {Error} If accessed outside of a test using the smartLog fixture.
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```ts
|
|
422
|
+
* import { smartLog } from 'playwright-smart-logger';
|
|
423
|
+
*
|
|
424
|
+
* class LoginPage {
|
|
425
|
+
* async login(username: string, password: string) {
|
|
426
|
+
* smartLog.info('Logging in as', username);
|
|
427
|
+
* }
|
|
428
|
+
* }
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
exports.smartLog = new Proxy({}, {
|
|
432
|
+
get(_, prop) {
|
|
433
|
+
const fixture = assertFixtureActive();
|
|
434
|
+
const value = fixture[prop];
|
|
435
|
+
if (typeof value === 'function') {
|
|
436
|
+
return value.bind(fixture);
|
|
437
|
+
}
|
|
438
|
+
return value;
|
|
439
|
+
},
|
|
440
|
+
});
|
|
441
|
+
exports.test = test_1.test.extend({
|
|
442
|
+
smartLog: async ({ page }, use, testInfo) => {
|
|
443
|
+
// Get options from test.use() or use defaults
|
|
444
|
+
const userOptions = testInfo.project.use.smartLog || {};
|
|
445
|
+
const options = {
|
|
446
|
+
...defaultOptions,
|
|
447
|
+
...userOptions,
|
|
448
|
+
};
|
|
449
|
+
const logger = new SmartLogger(testInfo, page, options);
|
|
450
|
+
const fixture = {
|
|
451
|
+
log: (...args) => logger.log(...args),
|
|
452
|
+
debug: (...args) => logger.debug(...args),
|
|
453
|
+
info: (...args) => logger.info(...args),
|
|
454
|
+
warn: (...args) => logger.warn(...args),
|
|
455
|
+
error: (...args) => logger.error(...args),
|
|
456
|
+
group: (...args) => logger.group(...args),
|
|
457
|
+
groupEnd: () => logger.groupEnd(),
|
|
458
|
+
table: (data, columns) => logger.table(data, columns),
|
|
459
|
+
dir: obj => logger.dir(obj),
|
|
460
|
+
time: label => logger.time(label),
|
|
461
|
+
timeEnd: label => logger.timeEnd(label),
|
|
462
|
+
timeLog: (label, ...args) => logger.timeLog(label, ...args),
|
|
463
|
+
assert: (condition, ...args) => logger.assert(condition, ...args),
|
|
464
|
+
count: label => logger.count(label),
|
|
465
|
+
countReset: label => logger.countReset(label),
|
|
466
|
+
trace: (...args) => logger.trace(...args),
|
|
467
|
+
clear: () => logger.clear(),
|
|
468
|
+
getBuffer: () => logger.getBuffer(),
|
|
469
|
+
flush: () => logger.flush(),
|
|
470
|
+
};
|
|
471
|
+
// Set global accessor for this test's logger
|
|
472
|
+
currentFixture = fixture;
|
|
473
|
+
await use(fixture);
|
|
474
|
+
// After test completion, decide whether to flush
|
|
475
|
+
try {
|
|
476
|
+
if (logger.shouldFlush(testInfo)) {
|
|
477
|
+
await logger.flush();
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
finally {
|
|
481
|
+
currentFixture = null;
|
|
482
|
+
await logger.cleanup();
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
});
|
|
486
|
+
var test_2 = require("@playwright/test");
|
|
487
|
+
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return test_2.expect; } });
|
|
488
|
+
//# sourceMappingURL=smart-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smart-log.js","sourceRoot":"","sources":["../src/smart-log.ts"],"names":[],"mappings":";;;;;;AA+iBA,kCAEC;AAhjBD,2CAAgD;AAChD,kDAA0B;AA8E1B;;GAEG;AACH,SAAS,aAAa,CAAC,GAAQ,EAAE,SAAiB,CAAC;IACjD,MAAM,IAAI,GAAG,IAAI,OAAO,EAAE,CAAC;IAC3B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CACnB,GAAG,EACH,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACd,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;gBAChD,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;oBACpB,OAAO,YAAY,CAAC;gBACtB,CAAC;gBACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAClB,CAAC;YACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC1B,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,EACD,MAAM,CACP,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,SAAS,CAAC,GAAQ;IACzB,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,WAAW,CAAC;IAC1C,IAAI,G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,EAAE,CAAC;YACvB,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,cAAc,GAAG,IAAI,CAAC;YACtB,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,yCAA0C;AAAjC,8FAAA,MAAM,OAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "playwright-smart-logger",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Smart logging fixture for Playwright tests that buffers console output and flushes only on test failures, with advanced features like console groups, timing, and browser console capture",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"playwright",
|
|
7
|
+
"testing",
|
|
8
|
+
"logging",
|
|
9
|
+
"qa",
|
|
10
|
+
"automation",
|
|
11
|
+
"console",
|
|
12
|
+
"buffer",
|
|
13
|
+
"fixture",
|
|
14
|
+
"typescript",
|
|
15
|
+
"test-automation",
|
|
16
|
+
"e2e-testing",
|
|
17
|
+
"debugging",
|
|
18
|
+
"smart-logging",
|
|
19
|
+
"test-framework",
|
|
20
|
+
"playwright-fixture"
|
|
21
|
+
],
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"README.md",
|
|
28
|
+
"LICENSE"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"build:watch": "tsc --watch",
|
|
33
|
+
"test": "playwright test",
|
|
34
|
+
"test:headed": "playwright test --headed",
|
|
35
|
+
"test:ui": "playwright test --ui",
|
|
36
|
+
"test:debug": "playwright test --debug",
|
|
37
|
+
"test:example": "playwright test tests/example.spec.ts",
|
|
38
|
+
"test:fixture": "playwright test tests/smart-log.spec.ts",
|
|
39
|
+
"test:coverage": "playwright test --reporter=html",
|
|
40
|
+
"clean": "rm -rf dist test-results playwright-report",
|
|
41
|
+
"prepare": "husky && npm run build",
|
|
42
|
+
"prepublishOnly": "npm run clean && npm run build && npm run test",
|
|
43
|
+
"lint": "eslint src tests",
|
|
44
|
+
"lint:fix": "eslint src tests --fix",
|
|
45
|
+
"format": "prettier --write .",
|
|
46
|
+
"format:check": "prettier --check .",
|
|
47
|
+
"typecheck": "tsc --noEmit",
|
|
48
|
+
"coverage": "nyc playwright test",
|
|
49
|
+
"version:patch": "npm version patch",
|
|
50
|
+
"version:minor": "npm version minor",
|
|
51
|
+
"version:major": "npm version major",
|
|
52
|
+
"release": "semantic-release",
|
|
53
|
+
"dev": "tsc --watch & playwright test --ui"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@playwright/test": "^1.41.0",
|
|
57
|
+
"chalk": "^5.3.0"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=20.0.0"
|
|
61
|
+
},
|
|
62
|
+
"repository": {
|
|
63
|
+
"type": "git",
|
|
64
|
+
"url": "https://github.com/hoangtaiki/playwright-smart-logger.git"
|
|
65
|
+
},
|
|
66
|
+
"bugs": {
|
|
67
|
+
"url": "https://github.com/hoangtaiki/playwright-smart-logger/issues"
|
|
68
|
+
},
|
|
69
|
+
"homepage": "https://github.com/hoangtaiki/playwright-smart-logger#readme",
|
|
70
|
+
"author": "Harry Tran <duchoang.vp@gmail.com>",
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
},
|
|
74
|
+
"lint-staged": {
|
|
75
|
+
"*.{ts,js,css,md}": "prettier --write",
|
|
76
|
+
"*.{ts,js}": "eslint --cache --fix"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@commitlint/cli": "^19.8.1",
|
|
80
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
81
|
+
"@eslint/js": "^9.39.2",
|
|
82
|
+
"@semantic-release/changelog": "^6.0.0",
|
|
83
|
+
"@semantic-release/git": "^10.0.0",
|
|
84
|
+
"@types/node": "^20.19.33",
|
|
85
|
+
"eslint": "^9.39.2",
|
|
86
|
+
"eslint-config-prettier": "^10.1.8",
|
|
87
|
+
"husky": "^9.1.7",
|
|
88
|
+
"lint-staged": "^15.5.2",
|
|
89
|
+
"nyc": "^15.1.0",
|
|
90
|
+
"prettier": "^3.2.5",
|
|
91
|
+
"semantic-release": "^25.0.3",
|
|
92
|
+
"typescript": "^5.9.3",
|
|
93
|
+
"typescript-eslint": "^8.55.0"
|
|
94
|
+
}
|
|
95
|
+
}
|