Skip to content

Commit

Permalink
Revert debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Jan 9, 2023
1 parent 60c0a01 commit c0ab31b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 29 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ jobs:
needs: build
strategy:
matrix:
OS: [windows-latest]
OS: [ubuntu-latest, windows-latest]
NODE_VERSION: [16, 18]
include:
- os: macos-latest
NODE_VERSION: 16
fail-fast: false
env:
NODE_VERSION: ${{ matrix.NODE_VERSION }}
Expand Down Expand Up @@ -143,7 +146,6 @@ jobs:
run: pnpm run test

e2e:
if: false
name: "Test (E2E): ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})"
runs-on: ${{ matrix.os }}
timeout-minutes: 25
Expand Down Expand Up @@ -178,7 +180,6 @@ jobs:
run: pnpm run test:e2e

smoke:
if: false
name: "Test (Smoke): ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})"
runs-on: ${{ matrix.os }}
timeout-minutes: 25
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"format:ci": "pnpm run format:imports && pnpm run format:code",
"format:code": "prettier -w . --cache --plugin-search-dir=.",
"format:imports": "organize-imports-cli ./packages/*/tsconfig.json ./packages/*/*/tsconfig.json",
"test": "turbo run test --output-logs=new-only --concurrency=1 --filter=\"@astrojs/prefetch\"",
"test": "turbo run test --output-logs=new-only --concurrency=1 --filter=astro --filter=create-astro --filter=\"@astrojs/*\"",
"test:match": "cd packages/astro && pnpm run test:match",
"test:smoke": "turbo run build --filter=\"@example/*\" --filter=\"docs\" --output-logs=new-only --concurrency=1",
"test:check-examples": "node ./scripts/smoke/check.js",
Expand Down
18 changes: 8 additions & 10 deletions packages/integrations/prefetch/test/basic-prefetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ test.describe('Basic prefetch', () => {
test.describe('prefetches rel="prefetch" links', () => {
test('skips /admin', async ({ page, astro }) => {
const requests = [];
const requestHandler = (request) => requests.push(request.url());

page.on('request', requestHandler);
page.on('request', (request) => requests.push(request.url()));

await page.goto(astro.resolveUrl('/'), { waitUntil: 'networkidle' });
await page.goto(astro.resolveUrl('/'));

await page.waitForLoadState('networkidle');

expect(requests.includes(astro.resolveUrl('/about')), '/about was prefetched').toBeTruthy();
expect(
Expand All @@ -34,8 +35,6 @@ test.describe('Basic prefetch', () => {
requests.filter((r) => r === astro.resolveUrl('/')).length === 1,
'/ was skipped by prefetch and only queried once'
).toBeTruthy();

page.off('request', requestHandler);
});
});
});
Expand All @@ -56,11 +55,12 @@ test.describe('Basic prefetch', () => {
test.describe('prefetches rel="prefetch" links', () => {
test('skips /admin', async ({ page, astro }) => {
const requests = [];
const requestHandler = (request) => requests.push(request.url());

page.on('request', requestHandler);
page.on('request', (request) => requests.push(request.url()));

await page.goto(astro.resolveUrl('/'), { waitUntil: 'networkidle' });
await page.goto(astro.resolveUrl('/'));

await page.waitForLoadState('networkidle');

expect(requests.includes(astro.resolveUrl('/about')), '/about was prefetched').toBeTruthy();
expect(
Expand All @@ -72,8 +72,6 @@ test.describe('Basic prefetch', () => {
requests.filter((r) => r === astro.resolveUrl('/')).length === 1,
'/ was skipped by prefetch and only queried once'
).toBeTruthy();

page.off('request', requestHandler);
});
});
});
Expand Down
18 changes: 8 additions & 10 deletions packages/integrations/prefetch/test/custom-selectors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ test.describe('Custom prefetch selectors', () => {
test.describe('prefetches links by custom selector', () => {
test('only prefetches /contact', async ({ page, astro }) => {
const requests = [];
const requestHandler = (request) => requests.push(request.url());

page.on('request', requestHandler);
page.on('request', (request) => requests.push(request.url()));

await page.goto(astro.resolveUrl('/'), { waitUntil: 'networkidle' });
await page.goto(astro.resolveUrl('/'));

await page.waitForLoadState('networkidle');

expect(requests.includes(astro.resolveUrl('/about')), '/about was skipped').toBeFalsy();
expect(
Expand All @@ -42,8 +43,6 @@ test.describe('Custom prefetch selectors', () => {
requests.filter((r) => r === astro.resolveUrl('/')).length === 1,
'/ was skipped by prefetch and only queried once'
).toBeTruthy();

page.off('request', requestHandler);
});
});
});
Expand All @@ -64,11 +63,12 @@ test.describe('Custom prefetch selectors', () => {
test.describe('prefetches links by custom selector', () => {
test('only prefetches /contact', async ({ page, astro }) => {
const requests = [];
const requestHandler = (request) => requests.push(request.url());

page.on('request', requestHandler);
page.on('request', (request) => requests.push(request.url()));

await page.goto(astro.resolveUrl('/'), { waitUntil: 'networkidle' });
await page.goto(astro.resolveUrl('/'));

await page.waitForLoadState('networkidle');

expect(requests.includes(astro.resolveUrl('/about')), '/about was skipped').toBeFalsy();
expect(
Expand All @@ -80,8 +80,6 @@ test.describe('Custom prefetch selectors', () => {
requests.filter((r) => r === astro.resolveUrl('/')).length === 1,
'/ was skipped by prefetch and only queried once'
).toBeTruthy();

page.off('request', requestHandler);
});
});
});
Expand Down
9 changes: 4 additions & 5 deletions packages/integrations/prefetch/test/style-prefetch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,17 @@ test.describe('Style prefetch', () => {
test.describe('prefetches rel="prefetch" links', () => {
test('style fetching', async ({ page, astro }) => {
const requests = [];
const requestHandler = (request) => requests.push(request.url());

page.on('request', requestHandler);
page.on('request', (request) => requests.push(request.url()));

await page.goto(astro.resolveUrl('/'), { waitUntil: 'networkidle' });
await page.goto(astro.resolveUrl('/'));

await page.waitForLoadState('networkidle');

await expect(requests.filter((req) => req.includes('/style1'))).toBeTruthy();
await expect(requests.filter((req) => req.includes('/style2'))).toBeTruthy();
const cssRequestCount = requests.filter((req) => req.includes('/main.css')).length;
await expect(cssRequestCount).toBe(1);

page.off('request', requestHandler);
});
});
}
Expand Down

0 comments on commit c0ab31b

Please sign in to comment.