Skip to content

Commit e9f765c

Browse files
committed
Ensure unique port per test
1 parent ba22424 commit e9f765c

File tree

9 files changed

+168
-545
lines changed

9 files changed

+168
-545
lines changed

libraries/__shared__/tests/playwright.config.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
import fs from 'node:fs'
12
import {defineConfig, devices} from '@playwright/test';
23

4+
const ports = fs.readdirSync('../../', {withFileTypes: true})
5+
.filter(d => d.isDirectory() && !d.name.startsWith('__'))
6+
.reduce((acc, dir, idx) => {
7+
acc[dir.name] = 8080 + idx;
8+
return acc;
9+
}, {})
10+
11+
const workspace = process.env.CEE_WORKSPACE;
12+
313
export default defineConfig({
414
use: {
5-
baseURL: 'http://localhost:8080',
15+
baseURL: `http://localhost:${ports[workspace]}`,
616
},
717
projects: [
818
{
@@ -15,18 +25,18 @@ export default defineConfig({
1525
},
1626
],
1727
webServer: {
18-
command: `http-server ../../${process.env.CEE_WORKSPACE}/dist/`,
19-
url: 'http://localhost:8080',
28+
command: `http-server ../../${workspace}/dist/ -p ${ports[workspace]}`,
29+
port: process.env.PORT,
2030
reuseExistingServer: !process.env.CI,
2131
stdout: 'ignore',
2232
stderr: 'pipe'
2333
},
2434
reporter: [
2535
['list'],
2636
['html', {
27-
outputFolder: `../../${process.env.CEE_WORKSPACE}/results/`,
37+
outputFolder: `../../${workspace}/results/`,
2838
open: 'never',
29-
title: process.env.CEE_WORKSPACE
39+
title: workspace
3040
}],
3141
['./reporter.js']
3242
]

libraries/hybrids/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1" />
5+
6+
<meta charset="utf-8" />
7+
</head>
8+
9+
<body>
10+
<hybrids-without-children></hybrids-without-children>
11+
<hybrids-with-children></hybrids-with-children>
12+
<hybrids-with-children-rerender></hybrids-with-children-rerender>
13+
<hybrids-with-different-views></hybrids-with-different-views>
14+
<hybrids-with-properties></hybrids-with-properties>
15+
<hybrids-with-declarative-event></hybrids-with-declarative-event>
16+
<hybrids-with-imperative-event></hybrids-with-imperative-event>
17+
<script type="module" src="./src/components.js"></script>
18+
</body>
19+
</html>

libraries/hybrids/karma.conf.js

Lines changed: 0 additions & 84 deletions
This file was deleted.

libraries/hybrids/package.json

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,45 @@
11
{
22
"scripts": {
3+
"compile": "wireit",
34
"test": "wireit",
45
"build": "wireit"
56
},
7+
"library_package": "hybrids",
68
"library_repo": "hybridsjs/hybrids",
79
"devDependencies": {
8-
"babel-core": "6.26.3",
9-
"babel-loader": "9.2.1",
10-
"chai": "4.5.0",
11-
"copy-webpack-plugin": "11.0.0",
12-
"cross-env": "7.0.3",
13-
"karma": "6.4.4",
14-
"karma-chrome-launcher": "3.2.0",
15-
"karma-firefox-launcher": "2.1.3",
16-
"karma-sourcemap-loader": "0.4.0",
17-
"karma-webpack": "5.0.1",
18-
"webpack": "5.101.0"
10+
"vite": "^7.2.2"
1911
},
2012
"dependencies": {
21-
"hybrids": "4.3.4"
13+
"hybrids": "9.1.20",
14+
"wc": "workspace:*"
2215
},
2316
"wireit": {
24-
"test": {
25-
"dependencies": [
26-
"../..:karma-plugins"
27-
],
17+
"compile": {
2818
"files": [
29-
"karma.conf.js",
30-
"tests.webpack.js",
19+
"index.html",
3120
"src",
32-
"meta"
21+
"vite.config.js"
22+
],
23+
"output": [
24+
"dist"
25+
],
26+
"command": "vite build"
27+
},
28+
"test": {
29+
"files": [
30+
"dist"
31+
],
32+
"dependencies": [
33+
"compile",
34+
"../__shared__/tests:test-files"
3335
],
36+
"command": "pnpm run --filter tests test",
3437
"output": [
3538
"results"
3639
],
37-
"command": "cross-env LIBRARY_NAME=hybrids karma start || echo ''"
40+
"env": {
41+
"CEE_WORKSPACE": "hybrids"
42+
}
3843
},
3944
"build": {
4045
"dependencies": [

libraries/hybrids/src/advanced-tests.js

Lines changed: 0 additions & 151 deletions
This file was deleted.

0 commit comments

Comments
 (0)