Skip to content

Commit a5a6cfb

Browse files
committed
sniff cwd from env
1 parent eb0f4c9 commit a5a6cfb

File tree

7 files changed

+13
-26
lines changed

7 files changed

+13
-26
lines changed

libraries/__shared__/tests/playwright.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from 'node:fs'
22
import {defineConfig, devices} from '@playwright/test';
3+
import * as path from "node:path";
34

45
const ports = fs.readdirSync('../../', {withFileTypes: true})
56
.filter(d => d.isDirectory() && !d.name.startsWith('__'))
@@ -8,7 +9,7 @@ const ports = fs.readdirSync('../../', {withFileTypes: true})
89
return acc;
910
}, {})
1011

11-
const workspace = process.env.CEE_WORKSPACE;
12+
const workspace = path.basename(process.env.INIT_CWD);
1213

1314
export default defineConfig({
1415
use: {

libraries/__shared__/tests/reporter.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'node:fs';
2+
import path from "node:path";
23

34

45
export default class CEEReporter {
@@ -15,9 +16,9 @@ export default class CEEReporter {
1516
}
1617

1718
onEnd(result) {
18-
const frameworkDir = `../../${process.env.CEE_WORKSPACE}`
19+
const workspace = `../../${path.basename(process.env.INIT_CWD)}`;
1920

20-
const packageJson = JSON.parse(fs.readFileSync(`${frameworkDir}/package.json`, 'utf-8'));
21+
const packageJson = JSON.parse(fs.readFileSync(`${workspace}/package.json`, 'utf-8'));
2122
const pkg = packageJson.library_package
2223
const version = packageJson.dependencies[pkg];
2324

@@ -30,8 +31,8 @@ export default class CEEReporter {
3031
const weightedFailed = this.results.weight.failed ?? 0;
3132
const totalWeight = weightedPassed + weightedFailed;
3233

33-
fs.mkdirSync(`${frameworkDir}/results/`, {recursive: true})
34-
fs.writeFileSync(`${frameworkDir}/results/results.json`, JSON.stringify({
34+
fs.mkdirSync(`${workspace}/results/`, {recursive: true})
35+
fs.writeFileSync(`${workspace}/results/results.json`, JSON.stringify({
3536
summary: {
3637
success: basicPassed + advancedPassed,
3738
failed: basicFailed + advancedFailed,
@@ -56,7 +57,7 @@ export default class CEEReporter {
5657
version
5758
}
5859
}, null, 2));
59-
fs.writeFileSync(`${frameworkDir}/results/results.html`, `
60+
fs.writeFileSync(`${workspace}/results/results.html`, `
6061
<html>
6162
<head>
6263
<meta http-equiv="refresh" content="0; url=./index.html">

libraries/hybrids/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@
3636
"command": "pnpm run --filter tests test",
3737
"output": [
3838
"results"
39-
],
40-
"env": {
41-
"CEE_WORKSPACE": "hybrids"
42-
}
39+
]
4340
},
4441
"build": {
4542
"dependencies": [

libraries/react/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@
3434
"command": "pnpm run --filter tests test",
3535
"output": [
3636
"results"
37-
],
38-
"env": {
39-
"CEE_WORKSPACE": "react"
40-
}
37+
]
4138
},
4239
"build": {
4340
"dependencies": [

libraries/stencil/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@
4747
"command": "pnpm run --filter tests test",
4848
"output": [
4949
"results"
50-
],
51-
"env": {
52-
"CEE_WORKSPACE": "stencil"
53-
}
50+
]
5451
},
5552
"build": {
5653
"dependencies": [

libraries/svelte/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@
3434
"command": "pnpm run --filter tests test",
3535
"output": [
3636
"results"
37-
],
38-
"env": {
39-
"CEE_WORKSPACE": "svelte"
40-
}
37+
]
4138
},
4239
"build": {
4340
"dependencies": [

libraries/vue/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@
3535
"command": "pnpm run --filter tests test",
3636
"output": [
3737
"results"
38-
],
39-
"env": {
40-
"CEE_WORKSPACE": "vue"
41-
}
38+
]
4239
},
4340
"build": {
4441
"dependencies": [

0 commit comments

Comments
 (0)