playwright-ws-trace 1.0.0 → 1.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/LICENSE +11 -0
- package/README.md +34 -2
- package/package.json +1 -1
- package/scripts/postinstall.js +17 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/playwright-ws-trace)
|
|
6
6
|
|
|
7
|
-
Microsoft rejected our [PR #38427](https://github.com/microsoft/playwright/pull/38427)
|
|
7
|
+
This package implements the long-requested feature from [Issue #10996](https://github.com/microsoft/playwright/issues/10996) (👍 49+ upvotes since 2021). Microsoft rejected our [PR #38427](https://github.com/microsoft/playwright/pull/38427), so we made it ourselves. 💪
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
@@ -22,10 +22,30 @@ npm install playwright-ws-trace
|
|
|
22
22
|
yarn add playwright-ws-trace
|
|
23
23
|
# or
|
|
24
24
|
pnpm add playwright-ws-trace
|
|
25
|
+
# or
|
|
26
|
+
bun add playwright-ws-trace
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
The package automatically patches your Playwright installation on install. That's it!
|
|
28
30
|
|
|
31
|
+
### Bun Users
|
|
32
|
+
|
|
33
|
+
Bun doesn't run postinstall scripts by default for security. Add `playwright-ws-trace` to `trustedDependencies` in your `package.json`:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"trustedDependencies": [
|
|
38
|
+
"playwright-ws-trace"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then reinstall:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
bun install
|
|
47
|
+
```
|
|
48
|
+
|
|
29
49
|
## Usage
|
|
30
50
|
|
|
31
51
|
### 1. Enable tracing in your tests
|
|
@@ -116,7 +136,19 @@ node node_modules/playwright-ws-trace/scripts/postinstall.js --force
|
|
|
116
136
|
|
|
117
137
|
## Troubleshooting
|
|
118
138
|
|
|
119
|
-
### Patches not applying
|
|
139
|
+
### Bun: Patches not applying
|
|
140
|
+
|
|
141
|
+
Bun doesn't run postinstall scripts by default. Add to `package.json`:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"trustedDependencies": ["playwright-ws-trace"]
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Then run `bun install` again.
|
|
150
|
+
|
|
151
|
+
### npm/yarn/pnpm: Patches not applying
|
|
120
152
|
|
|
121
153
|
Run the postinstall script with `--force`:
|
|
122
154
|
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -37,6 +37,23 @@ function findPlaywrightCore() {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
// Bun monorepo: packages are hoisted to node_modules/.bun/
|
|
41
|
+
const bunDir = path.join(process.cwd(), 'node_modules', '.bun');
|
|
42
|
+
if (fs.existsSync(bunDir)) {
|
|
43
|
+
try {
|
|
44
|
+
const entries = fs.readdirSync(bunDir);
|
|
45
|
+
const pwCoreDir = entries.find(e => e.startsWith('playwright-core@'));
|
|
46
|
+
if (pwCoreDir) {
|
|
47
|
+
const bunPath = path.join(bunDir, pwCoreDir, 'node_modules', 'playwright-core');
|
|
48
|
+
if (fs.existsSync(bunPath)) {
|
|
49
|
+
return bunPath;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
} catch {
|
|
53
|
+
// ignore errors reading .bun directory
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
40
57
|
try {
|
|
41
58
|
const resolved = require.resolve('playwright-core/package.json', { paths: [process.cwd()] });
|
|
42
59
|
return path.dirname(resolved);
|