Skip to content

Commit 010478c

Browse files
committed
11
1 parent daadc8e commit 010478c

File tree

11 files changed

+61
-37
lines changed

11 files changed

+61
-37
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22
1+
v22

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"runtimeExecutable": "${execPath}",
1313
"args": [
1414
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode",
15-
"${workspaceFolder}/packages/vscode/sample"
15+
"/Users/fi3ework/OSS/rslib/"
1616
],
1717
"outFiles": ["${workspaceFolder}/packages/vscode/dist/**/*.js"],
1818
"preLaunchTask": "npm: build:local"

packages/vscode/.github/workflows/release.yml

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,25 @@ name: Release VS Code Extension
22

33
on:
44
workflow_dispatch: {}
5-
push:
6-
tags:
7-
- 'v*'
8-
- 'vscode-v*'
95

106
jobs:
11-
release:
7+
publish:
128
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
target:
13+
[
14+
win32-x64,
15+
win32-arm64,
16+
darwin-x64,
17+
darwin-arm64,
18+
linux-x64,
19+
linux-arm64,
20+
linux-armhf,
21+
alpine-x64,
22+
alpine-arm64,
23+
]
1324
defaults:
1425
run:
1526
working-directory: packages/vscode
@@ -34,23 +45,7 @@ jobs:
3445
- name: Build
3546
run: npm run build
3647

37-
- name: Package VSIX
38-
run: npx vsce package
39-
40-
- name: Upload VSIX artifact
41-
uses: actions/upload-artifact@v4
42-
with:
43-
name: rstest-vsix
44-
path: packages/vscode/*.vsix
45-
46-
- name: Publish to VS Code Marketplace
47-
if: ${{ secrets.VSCE_PAT != '' }}
48+
- name: Publish to VS Code Marketplace (target)
4849
env:
4950
VSCE_PAT: ${{ secrets.VSCE_PAT }}
50-
run: npx vsce publish
51-
52-
- name: Create GitHub Release (tag push only)
53-
if: startsWith(github.ref, 'refs/tags/')
54-
uses: softprops/action-gh-release@v2
55-
with:
56-
files: packages/vscode/*.vsix
51+
run: npx vsce publish --target ${{ matrix.target }}

packages/vscode/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ Common commands (run from this package):
3434
- `npm run typecheck` — TypeScript noEmit check
3535
- `npm run test:unit` — Unit tests via Rstest
3636
- `npm run test:e2e` — VS Code Extension Host E2E tests
37+
38+
### Packaging & Publishing
39+
40+
- Local package (current platform): `npm run package:vsix`
41+
- Publish (current platform): `npm run publish:vsce` (requires `VSCE_PAT`)
42+
43+
CI
44+
- On tag push or manual dispatch, GitHub Actions runs on Linux and publishes for all platforms using `vsce publish --target` (win32/darwin/linux; x64 and arm64).
45+
- Configure the `VSCE_PAT` repository secret for Marketplace publishing.

packages/vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"test": "npm run test:unit && npm run test:e2e",
4747
"typecheck": "tsc --noEmit",
4848
"watch": "rslib build --watch",
49-
"package:vsix": "npm run build && vsce package",
49+
"package:vsce": "npm run build && vsce package",
5050
"publish:vsce": "vsce publish"
5151
},
5252
"devDependencies": {

packages/vscode/src/extension.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ class Rstest {
4646
this.api = new RstestApi();
4747
this.api.createChildProcess();
4848

49-
// Populate the test tree eagerly on construction
50-
// (does not rely on the Testing view resolving the root)
5149
scanAllTestFiles(this.ctrl);
5250
}
5351

@@ -336,7 +334,14 @@ async function findInitialFiles(
336334
pattern: vscode.GlobPattern,
337335
) {
338336
for (const file of await vscode.workspace.findFiles(pattern)) {
339-
getOrCreateFile(controller, file);
337+
const path = file.fsPath.toString();
338+
const shouldIgnore =
339+
path.includes('/node_modules/') ||
340+
path.includes('/.git/') ||
341+
path.endsWith('.git');
342+
if (!shouldIgnore) {
343+
getOrCreateFile(controller, file);
344+
}
340345
}
341346
}
342347

packages/vscode/src/master.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class RstestApi {
108108

109109
public async createChildProcess() {
110110
const execArgv: string[] = [];
111-
const workerPath = path.resolve(__dirname, 'worker/index.js');
111+
const workerPath = path.resolve(__dirname, 'worker.js');
112112
const port = await getPort();
113113
const wsAddress = `ws://localhost:${port}`;
114114
const rstestProcess = spawn('node', [...execArgv, workerPath], {

packages/vscode/src/testTree.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,15 @@ export async function scanAllTestFiles(
5151
for (const g of globs) {
5252
const pattern = new vscode.RelativePattern(folder, g);
5353
const found = await vscode.workspace.findFiles(pattern);
54-
for (const f of found) uris.add(f.toString());
54+
for (const f of found) {
55+
const shouldIgnore =
56+
f.fsPath.includes('/node_modules/') ||
57+
f.fsPath.includes('/.git/') ||
58+
f.fsPath.endsWith('.git');
59+
if (!shouldIgnore) {
60+
uris.add(f.toString());
61+
}
62+
}
5563
}
5664
}
5765

packages/vscode/src/worker/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Worker {
1111
public cwd!: string;
1212

1313
constructor() {
14+
console.log('🤚');
1415
this.ws = new WebSocket(process.env.RSTEST_WS_ADDRESS!);
1516
// this.initPromise = this.waitInitPromise();
1617
this.ws.on('message', (bufferData) => {
@@ -26,10 +27,16 @@ class Worker {
2627
}
2728

2829
public async runTest(data: WorkerRunTestData) {
29-
const rstest = await this.createRstest(data);
30-
rstest.context.fileFilters = data.fileFilters;
31-
rstest.context.normalizedConfig.testNamePattern = data.testNamePattern;
32-
await rstest.runTests();
30+
console.log('🙋', data);
31+
try {
32+
const rstest = await this.createRstest(data);
33+
rstest.context.fileFilters = data.fileFilters;
34+
rstest.context.normalizedConfig.testNamePattern = data.testNamePattern;
35+
let res = await rstest.runTests();
36+
console.log('🏁', res);
37+
} catch (error) {
38+
console.log('🤒', error);
39+
}
3340
}
3441

3542
// private waitInitPromise = () => {
@@ -47,6 +54,7 @@ class Worker {
4754
const rstestModule = (await import(
4855
this.rstestPath
4956
)) as typeof import('@rstest/core');
57+
console.log('🤶', rstestModule);
5058
const { createRstest, loadConfig } = rstestModule;
5159
const { filePath } = await loadConfig({
5260
cwd: this.cwd,

packages/vscode/src/worker/reporter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class VscodeReporter implements Reporter {
1919

2020
onTestRunEnd: Reporter['onTestRunEnd'] = ({ results, testResults }) => {
2121
if (this.onTestRunEndCallback) {
22+
console.log('💃', results, testResults);
2223
this.onTestRunEndCallback({
2324
testFileResults: results,
2425
testResults: testResults,

0 commit comments

Comments
 (0)