Skip to content

Commit 28294e3

Browse files
tests: service worker import proxy with basepath
1 parent 2c82b4a commit 28294e3

File tree

1 file changed

+14
-1
lines changed
  • packages/kit/test/apps/options-2/test

1 file changed

+14
-1
lines changed

packages/kit/test/apps/options-2/test/test.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import path from 'node:path';
12
import process from 'node:process';
3+
import { fileURLToPath } from 'node:url';
24
import { expect } from '@playwright/test';
35
import { test } from '../../../utils.js';
46

@@ -56,7 +58,18 @@ test.describe('paths', () => {
5658
});
5759

5860
test.describe('Service worker', () => {
59-
if (process.env.DEV) return;
61+
if (process.env.DEV) {
62+
test('import proxy /basepath/service-worker.js', async ({ request }) => {
63+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
64+
const response = await request.get('/basepath/service-worker.js');
65+
const content = await response.text();
66+
expect(content).toEqual(
67+
`import '${path.join('/basepath', '/@fs', __dirname, '../src/service-worker.js')}';`
68+
);
69+
});
70+
71+
return;
72+
}
6073

6174
test('build /basepath/service-worker.js', async ({ baseURL, request }) => {
6275
const response = await request.get('/basepath/service-worker.js');

0 commit comments

Comments
 (0)