Skip to content

Commit 3c72f42

Browse files
authored
test: use random port (#52)
1 parent 09a7890 commit 3c72f42

File tree

7 files changed

+39
-1
lines changed

7 files changed

+39
-1
lines changed

test/basic/index.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ test('should build with tailwind utilities', async ({ page }) => {
4343
cwd: __dirname,
4444
rsbuildConfig: {
4545
plugins: [pluginTailwindCSS()],
46+
server: {
47+
port: getRandomPort(),
48+
},
4649
},
4750
});
4851

test/cjs/index.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ test('should build with relative config', async ({ page }) => {
1616
config: './config/tailwind.config.js',
1717
}),
1818
],
19+
server: {
20+
port: getRandomPort(),
21+
},
1922
},
2023
});
2124

@@ -48,6 +51,9 @@ test('should build with absolute config', async ({ page }) => {
4851
config: resolve(__dirname, './config/tailwind.config.js'),
4952
}),
5053
],
54+
server: {
55+
port: getRandomPort(),
56+
},
5157
},
5258
});
5359

test/config/index.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { fileURLToPath } from 'node:url';
33
import { expect, test } from '@playwright/test';
44
import { createRsbuild } from '@rsbuild/core';
55
import { pluginTailwindCSS } from '../../src';
6-
import { supportESM } from '../helper';
6+
import { supportESM, getRandomPort } from '../helper';
77

88
const __dirname = dirname(fileURLToPath(import.meta.url));
99

@@ -21,6 +21,9 @@ test('should build with relative config', async ({ page }) => {
2121
config: './config/tailwind.config.js',
2222
}),
2323
],
24+
server: {
25+
port: getRandomPort(),
26+
},
2427
},
2528
});
2629

@@ -58,6 +61,9 @@ test('should build with absolute config', async ({ page }) => {
5861
config: resolve(__dirname, './config/tailwind.config.js'),
5962
}),
6063
],
64+
server: {
65+
port: getRandomPort(),
66+
},
6167
},
6268
});
6369

@@ -86,6 +92,9 @@ test('should build without tailwind.config.js', async ({ page }) => {
8692
cwd: __dirname,
8793
rsbuildConfig: {
8894
plugins: [pluginTailwindCSS()],
95+
server: {
96+
port: getRandomPort(),
97+
},
8998
},
9099
});
91100

test/multi-entries/index.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ test('should build with tailwind utilities in multiple entries', async ({
112112
},
113113
},
114114
plugins: [pluginTailwindCSS()],
115+
server: {
116+
port: getRandomPort(),
117+
},
115118
},
116119
});
117120

test/postcss-config/index.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url';
33
import { expect, test } from '@playwright/test';
44
import { createRsbuild } from '@rsbuild/core';
55
import { pluginTailwindCSS } from '../../src';
6+
import { getRandomPort } from '../helper';
67

78
const __dirname = dirname(fileURLToPath(import.meta.url));
89

@@ -11,6 +12,9 @@ test('should build with postcss.config.js', async ({ page }) => {
1112
cwd: __dirname,
1213
rsbuildConfig: {
1314
plugins: [pluginTailwindCSS()],
15+
server: {
16+
port: getRandomPort(),
17+
},
1418
},
1519
});
1620

test/tools-postcss/index.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url';
33
import { expect, test } from '@playwright/test';
44
import { createRsbuild } from '@rsbuild/core';
55
import { pluginTailwindCSS } from '../../src';
6+
import { getRandomPort } from '../helper';
67

78
const __dirname = dirname(fileURLToPath(import.meta.url));
89

@@ -19,6 +20,9 @@ test('should build with tools.postcss with tailwindcss', async ({ page }) => {
1920
},
2021
},
2122
},
23+
server: {
24+
port: getRandomPort(),
25+
},
2226
},
2327
});
2428

@@ -56,6 +60,9 @@ test('should build with tools.postcss with custom plugin', async ({ page }) => {
5660
},
5761
},
5862
},
63+
server: {
64+
port: getRandomPort(),
65+
},
5966
},
6067
});
6168

test/with-resource-query/index.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ test('should build with resource query on rspack', async ({ page }) => {
5353
index: resolve(__dirname, './src/index.js?entry'),
5454
},
5555
},
56+
server: {
57+
port: getRandomPort(),
58+
},
5659
plugins: [pluginTailwindCSS()],
5760
},
5861
});
@@ -122,6 +125,9 @@ test('should build with resource query on webpack', async ({ page }) => {
122125
index: resolve(__dirname, './src/index.js?entry'),
123126
},
124127
},
128+
server: {
129+
port: getRandomPort(),
130+
},
125131
provider: webpackProvider,
126132
plugins: [pluginTailwindCSS()],
127133
},

0 commit comments

Comments
 (0)