pw-sanitizer 0.1.1 → 0.1.3
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 +20 -17
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +9 -17
- package/dist/config/loader.js.map +1 -1
- package/dist/config/types.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/teardown.d.ts +1 -1
- package/dist/teardown.js +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ It also lets you delete repetitive or internal steps (e.g. health-check pings, i
|
|
|
34
34
|
## Installation
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
npm install --save-dev
|
|
37
|
+
npm install --save-dev pw-sanitizer
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
Screenshot redaction inside trace files requires the optional `sharp` dependency:
|
|
@@ -51,7 +51,7 @@ npm install --save-dev sharp
|
|
|
51
51
|
|
|
52
52
|
```ts
|
|
53
53
|
// playwright-sanitizer.config.ts
|
|
54
|
-
import type { SanitizerConfig } from '
|
|
54
|
+
import type { SanitizerConfig } from 'pw-sanitizer';
|
|
55
55
|
|
|
56
56
|
const config: SanitizerConfig = {
|
|
57
57
|
redact: {
|
|
@@ -85,7 +85,7 @@ export default config;
|
|
|
85
85
|
### 2. Run the CLI
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
npx
|
|
88
|
+
npx pw-sanitizer
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
Sanitized files are written to `./sanitized-report` by default. Originals are untouched.
|
|
@@ -106,8 +106,11 @@ Config is auto-discovered in this priority order:
|
|
|
106
106
|
|
|
107
107
|
### Full config reference
|
|
108
108
|
|
|
109
|
+
> [!NOTE]
|
|
110
|
+
> TypeScript configuration files (`.ts`) are supported natively by default using `jiti`. No separate runner or transpilation step is required.
|
|
111
|
+
|
|
109
112
|
```ts
|
|
110
|
-
import type { SanitizerConfig } from '
|
|
113
|
+
import type { SanitizerConfig } from 'pw-sanitizer';
|
|
111
114
|
|
|
112
115
|
const config: SanitizerConfig = {
|
|
113
116
|
redact: {
|
|
@@ -203,7 +206,7 @@ For large teams, keep patterns and rules in dedicated files so they can be versi
|
|
|
203
206
|
|
|
204
207
|
```ts
|
|
205
208
|
// secrets/patterns.ts
|
|
206
|
-
import type { RedactPattern } from '
|
|
209
|
+
import type { RedactPattern } from 'pw-sanitizer';
|
|
207
210
|
|
|
208
211
|
const patterns: RedactPattern[] = [
|
|
209
212
|
{ id: 'auth-header', key: 'authorization', severity: 'critical' },
|
|
@@ -235,7 +238,7 @@ JSON files are also supported. Note that RegExp is not available in JSON — str
|
|
|
235
238
|
## CLI reference
|
|
236
239
|
|
|
237
240
|
```
|
|
238
|
-
Usage:
|
|
241
|
+
Usage: pw-sanitizer [options]
|
|
239
242
|
|
|
240
243
|
Options:
|
|
241
244
|
-c, --config <path> Path to config file
|
|
@@ -258,22 +261,22 @@ Options:
|
|
|
258
261
|
|
|
259
262
|
```bash
|
|
260
263
|
# Auto-discover config and run with defaults
|
|
261
|
-
npx
|
|
264
|
+
npx pw-sanitizer
|
|
262
265
|
|
|
263
266
|
# Use a specific config file
|
|
264
|
-
npx
|
|
267
|
+
npx pw-sanitizer --config ./ci/sanitizer.config.ts
|
|
265
268
|
|
|
266
269
|
# Overwrite originals (ensure files are version-controlled)
|
|
267
|
-
npx
|
|
270
|
+
npx pw-sanitizer --in-place
|
|
268
271
|
|
|
269
272
|
# Preview without writing any files
|
|
270
|
-
npx
|
|
273
|
+
npx pw-sanitizer --dry-run --log-level verbose
|
|
271
274
|
|
|
272
275
|
# Point to non-default directories
|
|
273
|
-
npx
|
|
276
|
+
npx pw-sanitizer --report ./reports --traces ./artifacts/traces --output ./sanitized
|
|
274
277
|
|
|
275
278
|
# Write a machine-readable summary for CI artifact ingestion
|
|
276
|
-
npx
|
|
279
|
+
npx pw-sanitizer --summary-output ./sanitization-summary.json
|
|
277
280
|
```
|
|
278
281
|
|
|
279
282
|
---
|
|
@@ -287,7 +290,7 @@ Register the sanitizer as a Playwright `globalTeardown` and it runs automaticall
|
|
|
287
290
|
import { defineConfig } from '@playwright/test';
|
|
288
291
|
|
|
289
292
|
export default defineConfig({
|
|
290
|
-
globalTeardown: require.resolve('
|
|
293
|
+
globalTeardown: require.resolve('pw-sanitizer/teardown'),
|
|
291
294
|
// ...rest of your config
|
|
292
295
|
});
|
|
293
296
|
```
|
|
@@ -301,10 +304,10 @@ If you prefer a single config file, add a `sanitizer` key directly to your Playw
|
|
|
301
304
|
```ts
|
|
302
305
|
// playwright.config.ts
|
|
303
306
|
import { defineConfig } from '@playwright/test';
|
|
304
|
-
import type { SanitizerConfig } from '
|
|
307
|
+
import type { SanitizerConfig } from 'pw-sanitizer';
|
|
305
308
|
|
|
306
309
|
export default defineConfig({
|
|
307
|
-
globalTeardown: require.resolve('
|
|
310
|
+
globalTeardown: require.resolve('pw-sanitizer/teardown'),
|
|
308
311
|
|
|
309
312
|
sanitizer: {
|
|
310
313
|
redact: {
|
|
@@ -322,7 +325,7 @@ export default defineConfig({
|
|
|
322
325
|
## Programmatic API
|
|
323
326
|
|
|
324
327
|
```ts
|
|
325
|
-
import { sanitize, redactReport, redactTrace } from '
|
|
328
|
+
import { sanitize, redactReport, redactTrace } from 'pw-sanitizer';
|
|
326
329
|
|
|
327
330
|
// Process all reports and traces using auto-discovered config
|
|
328
331
|
const results = await sanitize();
|
|
@@ -399,7 +402,7 @@ The `minConsecutiveOccurrences` safety guard prevents accidentally removing a st
|
|
|
399
402
|
run: npx playwright test
|
|
400
403
|
|
|
401
404
|
- name: Sanitize Playwright artifacts
|
|
402
|
-
run: npx
|
|
405
|
+
run: npx pw-sanitizer --summary-output sanitization-summary.json
|
|
403
406
|
|
|
404
407
|
- name: Upload sanitized report
|
|
405
408
|
uses: actions/upload-artifact@v4
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ const index_js_1 = require("./index.js");
|
|
|
13
13
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
14
14
|
const program = new commander_1.Command();
|
|
15
15
|
program
|
|
16
|
-
.name('
|
|
16
|
+
.name('pw-sanitizer')
|
|
17
17
|
.description('Post-process Playwright HTML reports and trace files to redact secrets and remove noisy steps')
|
|
18
18
|
.version(package_json_1.default.version)
|
|
19
19
|
.option('-c, --config <path>', 'Path to config file')
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAgGA,8CAmDC;AAjJD,yCAAoC;AAEpC,kDAAgD;AAChD,yCAAsC;AACtC,qEAAqE;AACrE,2EAA2E;AAC3E,mEAAkC;AAElC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAgGA,8CAmDC;AAjJD,yCAAoC;AAEpC,kDAAgD;AAChD,yCAAsC;AACtC,qEAAqE;AACrE,2EAA2E;AAC3E,mEAAkC;AAElC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,cAAc,CAAC;KACpB,WAAW,CACV,+FAA+F,CAChG;KACA,OAAO,CAAC,sBAAG,CAAC,OAAO,CAAC;KACpB,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;KACpD,MAAM,CACL,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,CACtB;KACA,MAAM,CACL,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,CACjB;KACA,MAAM,CAAC,qBAAqB,EAAE,kCAAkC,CAAC;KACjE,MAAM,CAAC,YAAY,EAAE,0BAA0B,CAAC;KAChD,MAAM,CACL,sBAAsB,E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QACvC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;IAC9B,CAAC;IAED,sBAAsB;IACtB,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;IAC7C,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACrB,MAAM,CAAC,SAAS,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAG9B,CAAC;IAChB,CAAC;IACD,IAAI,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;QAC1B,MAAM,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,eAAe,CAAW,CAAC;IACjE,CAAC;AACH,CAAC;AAID,gFAAgF;AAChF,8EAA8E;AAC9E,iFAAiF;AACjF,yDAAyD;AACzD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAkFlD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA6B9E"}
|
package/dist/config/loader.js
CHANGED
|
@@ -32,10 +32,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
35
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
39
|
exports.loadConfig = loadConfig;
|
|
37
40
|
const fs = __importStar(require("node:fs"));
|
|
38
41
|
const path = __importStar(require("node:path"));
|
|
42
|
+
const jiti_1 = __importDefault(require("jiti"));
|
|
39
43
|
const logger_js_1 = require("../logger.js");
|
|
40
44
|
/**
|
|
41
45
|
* Ordered list of config file names that are auto-discovered in the current
|
|
@@ -67,26 +71,13 @@ async function loadConfigFromFile(filePath) {
|
|
|
67
71
|
const content = fs.readFileSync(absolutePath, 'utf-8');
|
|
68
72
|
return JSON.parse(content);
|
|
69
73
|
}
|
|
70
|
-
// .ts or .js
|
|
74
|
+
// Use jiti to transpile and load .ts or .js config files natively
|
|
71
75
|
try {
|
|
72
|
-
const
|
|
76
|
+
const jiti = (0, jiti_1.default)(__filename);
|
|
77
|
+
const module = jiti(absolutePath);
|
|
73
78
|
return (module.default ?? module);
|
|
74
79
|
}
|
|
75
80
|
catch (err) {
|
|
76
|
-
// If .ts failed, try .js sibling
|
|
77
|
-
if (ext === '.ts') {
|
|
78
|
-
const jsSibling = absolutePath.replace(/\.ts$/, '.js');
|
|
79
|
-
if (fs.existsSync(jsSibling)) {
|
|
80
|
-
try {
|
|
81
|
-
const module = await import(jsSibling);
|
|
82
|
-
return (module.default ?? module);
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
return logger_js_1.logger.fatal(`Failed to load config from both ${absolutePath} and ${jsSibling}. ` +
|
|
86
|
-
`Ensure tsx or ts-node is available, or provide a .js config file.`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
81
|
return logger_js_1.logger.fatal(`Failed to load config from ${absolutePath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
91
82
|
}
|
|
92
83
|
}
|
|
@@ -106,7 +97,8 @@ async function loadFromPlaywrightConfig(cwd) {
|
|
|
106
97
|
const fullPath = path.resolve(cwd, name);
|
|
107
98
|
if (fs.existsSync(fullPath)) {
|
|
108
99
|
try {
|
|
109
|
-
const
|
|
100
|
+
const jiti = (0, jiti_1.default)(__filename);
|
|
101
|
+
const module = jiti(fullPath);
|
|
110
102
|
const config = module.default ?? module;
|
|
111
103
|
if (config && typeof config === 'object' && 'sanitizer' in config) {
|
|
112
104
|
return config.sanitizer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgHA,gCA6BC;AA7ID,4CAA8B;AAC9B,gDAAkC;AAClC,gDAA8B;AAE9B,4CAAsC;AAEtC;;;GAGG;AACH,MAAM,iBAAiB,GAAG;IACxB,gCAAgC;IAChC,gCAAgC;IAChC,kCAAkC;CACnC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,KAAK,UAAU,kBAAkB,CAAC,QAAgB;IAChD,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE5C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,OAAO,kBAAM,CAAC,KAAK,CAAC,0BAA0B,YAAY,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;IAErD,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,CAAC;IAChD,CAAC;IAED,kEAAkE;IAClE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAA,cAAU,EAAC,UAAU,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAA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,EAAE,CAAC;QACf,kBAAM,CAAC,OAAO,CAAC,sCAAsC,UAAU,EAAE,CAAC,CAAC;QACnE,OAAO,kBAAkB,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED,kCAAkC;IAClC,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACzC,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,kBAAM,CAAC,OAAO,CAAC,sBAAsB,QAAQ,EAAE,CAAC,CAAC;YACjD,OAAO,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,qCAAqC;IACrC,MAAM,cAAc,GAAG,MAAM,wBAAwB,CAAC,GAAG,CAAC,CAAC;IAC3D,IAAI,cAAc,EAAE,CAAC;QACnB,kBAAM,CAAC,OAAO,CAAC,oDAAoD,CAAC,CAAC;QACrE,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO,kBAAM,CAAC,KAAK,CACjB,wCAAwC;QACxC,gEAAgE,CACjE,CAAC;AACJ,CAAC"}
|
package/dist/config/types.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { loadRuleFile } from './remove/rule-loader.js';
|
|
|
10
10
|
*
|
|
11
11
|
* Typical usage — run after a Playwright test suite from your own script:
|
|
12
12
|
* ```ts
|
|
13
|
-
* import { sanitize } from '
|
|
13
|
+
* import { sanitize } from 'pw-sanitizer';
|
|
14
14
|
*
|
|
15
15
|
* await sanitize({
|
|
16
16
|
* redact: { patterns: [{ id: 'token', key: 'authorization' }] },
|
|
@@ -39,7 +39,7 @@ export declare function sanitize(configOverride?: SanitizerConfig): Promise<Proc
|
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```ts
|
|
42
|
-
* import { redactReport } from '
|
|
42
|
+
* import { redactReport } from 'pw-sanitizer';
|
|
43
43
|
*
|
|
44
44
|
* const result = await redactReport('./playwright-report/index.html', {
|
|
45
45
|
* redact: { patterns: [{ id: 'auth', key: 'authorization' }] },
|
|
@@ -61,7 +61,7 @@ export declare function redactReport(reportPath: string, config: SanitizerConfig
|
|
|
61
61
|
*
|
|
62
62
|
* @example
|
|
63
63
|
* ```ts
|
|
64
|
-
* import { redactTrace } from '
|
|
64
|
+
* import { redactTrace } from 'pw-sanitizer';
|
|
65
65
|
*
|
|
66
66
|
* const result = await redactTrace('./test-results/my-test/trace.zip', {
|
|
67
67
|
* redact: { patterns: [{ id: 'cookie', key: /^cookie$/i }] },
|
package/dist/index.js
CHANGED
|
@@ -60,7 +60,7 @@ Object.defineProperty(exports, "loadRuleFile", { enumerable: true, get: function
|
|
|
60
60
|
*
|
|
61
61
|
* Typical usage — run after a Playwright test suite from your own script:
|
|
62
62
|
* ```ts
|
|
63
|
-
* import { sanitize } from '
|
|
63
|
+
* import { sanitize } from 'pw-sanitizer';
|
|
64
64
|
*
|
|
65
65
|
* await sanitize({
|
|
66
66
|
* redact: { patterns: [{ id: 'token', key: 'authorization' }] },
|
|
@@ -136,7 +136,7 @@ async function sanitize(configOverride) {
|
|
|
136
136
|
*
|
|
137
137
|
* @example
|
|
138
138
|
* ```ts
|
|
139
|
-
* import { redactReport } from '
|
|
139
|
+
* import { redactReport } from 'pw-sanitizer';
|
|
140
140
|
*
|
|
141
141
|
* const result = await redactReport('./playwright-report/index.html', {
|
|
142
142
|
* redact: { patterns: [{ id: 'auth', key: 'authorization' }] },
|
|
@@ -168,7 +168,7 @@ async function redactReport(reportPath, config) {
|
|
|
168
168
|
*
|
|
169
169
|
* @example
|
|
170
170
|
* ```ts
|
|
171
|
-
* import { redactTrace } from '
|
|
171
|
+
* import { redactTrace } from 'pw-sanitizer';
|
|
172
172
|
*
|
|
173
173
|
* const result = await redactTrace('./test-results/my-test/trace.zip', {
|
|
174
174
|
* redact: { patterns: [{ id: 'cookie', key: /^cookie$/i }] },
|
package/dist/teardown.d.ts
CHANGED
package/dist/teardown.js
CHANGED
|
@@ -17,7 +17,7 @@ const logger_js_1 = require("./logger.js");
|
|
|
17
17
|
* import { defineConfig } from '@playwright/test';
|
|
18
18
|
*
|
|
19
19
|
* export default defineConfig({
|
|
20
|
-
* globalTeardown: require.resolve('
|
|
20
|
+
* globalTeardown: require.resolve('pw-sanitizer/teardown'),
|
|
21
21
|
* });
|
|
22
22
|
* ```
|
|
23
23
|
*
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pw-sanitizer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Post-process Playwright HTML reports and trace files to redact secrets and remove noisy steps",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"
|
|
8
|
+
"pw-sanitizer": "dist/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"chalk": "^5.3.0",
|
|
48
48
|
"commander": "^12.1.0",
|
|
49
49
|
"glob": "^11.0.0",
|
|
50
|
-
"jszip": "^3.10.1"
|
|
50
|
+
"jszip": "^3.10.1",
|
|
51
|
+
"jiti": "^1.21.6"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@types/node": "^20.14.0",
|