Skip to content

Commit 02e9e73

Browse files
authored
Feat/bypass csp (#77)
* add bypass csp flag * chore: add changeset
1 parent cda7165 commit 02e9e73

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

.changeset/honest-ads-tap.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
"@heymp/scratchpad": patch
3+
---
4+
5+
Add bypassCSP flag to run command.
6+
7+
Example:
8+
9+
```bash
10+
scratchpad run test.ts --bypassCSP
11+
```

src/browser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export async function browser(processor: Processor) {
3333
});
3434
const context = await browser.newContext({
3535
storageState: processor.opts.login ? await getSession('.scratchpad/login.json') : undefined,
36+
bypassCSP: processor.opts.bypassCSP,
3637
});
3738
const page = await context.newPage();
3839
const playwrightConfig = processor.opts.playwright;

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type Config = {
1616
url?: string;
1717
login?: boolean;
1818
rerouteDir?: string;
19+
bypassCSP?: boolean;
1920
playwright?: (page: PlaywrightConfig) => Promise<void>
2021
}
2122

src/runCommand.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export const runCommand = new Command('run')
2323
playwright: opts['playwright'],
2424
login: !!opts['login'],
2525
rerouteDir: opts['rerouteDir'],
26-
file
26+
bypassCSP: opts['bypassCSP'],
27+
file: file
2728
});
2829
browser(processor);
2930
});

0 commit comments

Comments
 (0)