Skip to content

Commit 30bafaf

Browse files
authored
fix: make gha workflow dependent on package manager (#70)
1 parent 9de2b1b commit 30bafaf

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

assets/github-actions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Install dependencies
1717
run: {{installDepsCommand}}
1818
- name: Install Playwright Browsers
19-
run: npx playwright install --with-deps
19+
run: {{installPlaywrightCommand}}
2020
- name: Run Playwright tests
2121
run: {{runTestsCommand}}
2222
- uses: actions/upload-artifact@v3

src/generator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export class Generator {
155155
if (answers.installGitHubActions) {
156156
const githubActionsScript = executeTemplate(this._readAsset('github-actions.yml'), {
157157
installDepsCommand: packageManager.ci(),
158+
installPlaywrightCommand: packageManager.npx('playwright', 'install --with-deps'),
158159
runTestsCommand: packageManager.runPlaywrightTest(),
159160
}, new Map());
160161
files.set('.github/workflows/playwright.yml', githubActionsScript);

tests/baseFixtures.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,16 @@ function spawnAsync(cmd: string, args: string[], options?: SpawnOptionsWithoutSt
5454
}
5555

5656
export const test = base.extend<TestFixtures>({
57-
packageManager: 'npm',
57+
packageManager: ['npm', { option: true }],
5858
run: async ({ packageManager }, use, testInfo) => {
5959
await use(async (parameters: string[], options: PromptOptions): Promise<RunResult> => {
6060
fs.mkdirSync(testInfo.outputDir, { recursive: true });
61-
const env = packageManager === 'yarn' ? {
62-
'npm_config_user_agent': 'yarn'
63-
} : packageManager === 'pnpm' ? {
64-
'npm_config_user_agent': 'pnpm/0.0.0'
65-
} : undefined;
6661
const result = await spawnAsync('node', [path.join(__dirname, '..'), ...parameters], {
6762
shell: true,
6863
cwd: testInfo.outputDir,
6964
env: {
7065
...process.env,
71-
...env,
66+
'npm_config_user_agent': packageManager === 'yarn' ? 'yarn' : packageManager === 'pnpm' ? 'pnpm/0.0.0' : undefined,
7267
'TEST_OPTIONS': JSON.stringify(options),
7368
}
7469
});

0 commit comments

Comments
 (0)