Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
"test:smoke:docs": "turbo run build --filter=docs",
"test:check-examples": "node ./scripts/smoke/check.js",
"test:vite-ci": "cd packages/astro && pnpm run test:unit && pnpm run test:integration",
"test:e2e": "cd packages/astro && pnpm playwright install firefox && pnpm run test:e2e",
"test:e2e": "pnpm run test:e2e:astro && pnpm run test:e2e:alpinejs",
"test:e2e:astro": "cd packages/astro && pnpm playwright install firefox && pnpm run test:e2e",
"test:e2e:alpinejs": "cd packages/integrations/alpinejs && pnpm run test:e2e",
"test:e2e:match": "cd packages/astro && pnpm playwright install firefox && pnpm run test:e2e:match",
"test:e2e:hosts": "turbo run test:hosted",
"typecheck:tests": "pnpm -r typecheck:tests",
Expand Down
26 changes: 26 additions & 0 deletions packages/integrations/alpinejs/playwright.config.js
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defineConfig } from '@playwright/test';

// NOTE: Sometimes, tests fail with `TypeError: process.stdout.clearLine is not a function`
// for some reason. This comes from Vite, and is conditionally called based on `isTTY`.
// We set it to false here to skip this odd behavior.
process.stdout.isTTY = false;

export default defineConfig({
testMatch: 'test/*.test.ts',
timeout: 40_000,
expect: {
timeout: 6_000,
},
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
projects: [
{
name: 'Chrome Stable',
use: {
browserName: 'chromium',
channel: 'chrome',
},
},
],
});
15 changes: 0 additions & 15 deletions packages/integrations/alpinejs/test/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { test as testBase } from '@playwright/test';
import {
Expand All @@ -9,16 +7,6 @@ import {
type DevServer,
} from '../../../astro/test/test-utils.js';

// Get all test files in directory, assign unique port for each of them so they don't conflict
const testFiles = await fs.readdir(new URL('.', import.meta.url));
const testFileToPort = new Map();
for (let i = 0; i < testFiles.length; i++) {
const file = testFiles[i];
if (file.endsWith('.test.js')) {
testFileToPort.set(file.slice(0, -8), 4000 + i);
}
}

function loadFixture(inlineConfig: AstroInlineConfig) {
if (!inlineConfig?.root) throw new Error("Must provide { root: './fixtures/...' }");

Expand All @@ -27,9 +15,6 @@ function loadFixture(inlineConfig: AstroInlineConfig) {
return baseLoadFixture({
...inlineConfig,
root: fileURLToPath(new URL(inlineConfig.root, import.meta.url)),
server: {
port: testFileToPort.get(path.basename(String(inlineConfig.root))),
},
});
}

Expand Down
Loading