Skip to content

Commit 0098587

Browse files
committed
feat: add VS Code extension
docs: add Repository Guidelines in AGENTS.md test-run: iterate all test results and map to corresponding TestItems for TestCase runs (remove testResults[0] usage) fixed refactor(extension): delegate TestCase/TestFile run logic to testTree classes without changing behavior\n\n- Add gatherTestItems helper to testTree.ts\n- Implement TestFile.run mirroring file-level run logic\n- Implement TestCase.run mirroring case-level run logic\n- Replace duplicated branches in extension.ts with class method calls test(e2e): update expected label tree for fixtures/test/foo.test.ts changes (l1/l2/l3 structure and additional cases) feat: inform user continuous run is not implemented and no-op on watch requests feat(discovery): support common test patterns (*.test.*, *.spec.*)\n\n- Watch and discover **/*.test.* and **/*.spec.*\n- Update open/change handler to process files matching these patterns\n- Keep behavior unchanged otherwise feat(vscode): eagerly scan all test files on init to populate test tree - Add scanAllTestFiles() in src/testTree.ts to find **/*.test.* and **/*.spec.* across workspace, create root TestItems, and parse contents to build children. - Invoke scanAllTestFiles() in extension constructor and on root resolve to ensure the TestController includes all tests without opening files. - Keep existing FS watchers for incremental updates. 1 add config test bundle the extension publish 11 refactor: share test discovery utils a1 publish
1 parent 9eea73c commit 0098587

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+6556
-369
lines changed

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,73 @@ jobs:
5959
- name: Publish to npm
6060
run: |
6161
pnpm -r publish --tag ${{ github.event.inputs.npm_tag }} --publish-branch ${{ github.event.inputs.branch }}
62+
63+
release_vscode_extension:
64+
name: Release VS Code Extension (${{ matrix.vsce-target }})
65+
if: github.repository == 'web-infra-dev/rstest' && github.event_name == 'workflow_dispatch'
66+
needs: release
67+
runs-on: ${{ matrix.runner }}
68+
environment: vscode-marketplace
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
include:
73+
- runner: ubuntu-latest
74+
vsce-target: linux-x64
75+
platform: linux
76+
arch: x64
77+
- runner: ubuntu-22.04-arm64
78+
vsce-target: linux-arm64
79+
platform: linux
80+
arch: arm64
81+
- runner: macos-13
82+
vsce-target: darwin-x64
83+
platform: darwin
84+
arch: x64
85+
- runner: macos-14
86+
vsce-target: darwin-arm64
87+
platform: darwin
88+
arch: arm64
89+
- runner: windows-2022
90+
vsce-target: win32-x64
91+
platform: win32
92+
arch: x64
93+
- runner: windows-latest
94+
vsce-target: win32-arm64
95+
platform: win32
96+
arch: arm64
97+
defaults:
98+
run:
99+
shell: bash
100+
env:
101+
npm_config_arch: ${{ matrix.arch }}
102+
npm_config_platform: ${{ matrix.platform }}
103+
VSCE_TARGET: ${{ matrix.vsce-target }}
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
107+
with:
108+
fetch-depth: 1
109+
ref: ${{ github.event.inputs.branch }}
110+
111+
- name: Setup Pnpm
112+
run: |
113+
npm install -g corepack@latest --force
114+
corepack enable
115+
116+
- name: Setup Node.js
117+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
118+
with:
119+
node-version: 22
120+
cache: 'pnpm'
121+
122+
- name: Install Dependencies
123+
run: pnpm install
124+
125+
- name: Package VS Code Extension
126+
run: pnpm --filter ./packages/vscode run package:vsce -o "rstest-${{ matrix.vsce-target }}.vsix"
127+
128+
- name: Publish VS Code Extension
129+
env:
130+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
131+
run: pnpm --filter ./packages/vscode exec vsce publish --target ${{ matrix.vsce-target }}

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,7 @@ jobs:
113113
- name: E2E Test
114114
if: steps.changes.outputs.changed == 'true'
115115
run: pnpm run e2e
116+
117+
- name: VS Code Extension Test
118+
if: steps.changes.outputs.changed == 'true'
119+
run: pnpm run test:vscode

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ test-temp-*
2323
.vscode/**/*
2424
!.vscode/settings.json
2525
!.vscode/extensions.json
26+
!.vscode/launch.json
27+
!.vscode/tasks.json
2628
.idea/
2729
.nx/
2830
.history/
@@ -34,5 +36,7 @@ test-results/
3436
fixtures-test/
3537
fixtures-test-*/
3638
.rslib/
37-
3839
!packages/core/src/coverage
40+
tests-dist/
41+
.vscode-test/
42+
packages/vscode/*.vsix

.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: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
{
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"runtimeExecutable": "${execPath}",
13+
"args": [
14+
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode",
15+
"${workspaceFolder}/packages/vscode/sample"
16+
],
17+
"outFiles": ["${workspaceFolder}/packages/vscode/dist/**/*.js"],
18+
"preLaunchTask": "npm: build:local"
19+
}
20+
]
21+
}

.vscode/tasks.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// See https://go.microsoft.com/fwlink/?LinkId=733558
2+
// for the documentation about the tasks.json format
3+
{
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "build:local",
9+
"path": "packages/vscode",
10+
"problemMatcher": "$tsc-watch",
11+
"isBackground": true,
12+
"presentation": {
13+
"reveal": "never"
14+
},
15+
"group": {
16+
"kind": "build",
17+
"isDefault": true
18+
}
19+
}
20+
]
21+
}

biome.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.2.2/schema.json",
33
"assist": { "actions": { "source": { "organizeImports": "on" } } },
44
"vcs": {
55
"enabled": true,
@@ -9,7 +9,13 @@
99
},
1010
"files": {
1111
"ignoreUnknown": true,
12-
"includes": ["**", "!**/*.vue", "!**/dist", "!**/dist-types"]
12+
"includes": [
13+
"**",
14+
"!**/*.vue",
15+
"!**/dist",
16+
"!**/dist-types",
17+
"!**/.vscode-test.mjs"
18+
]
1319
},
1420
"formatter": {
1521
"indentStyle": "space"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"scripts": {
55
"typecheck": "cross-env NX_DAEMON=false nx run-many -t typecheck --exclude @examples/* --parallel=10",
66
"build": "cross-env NX_DAEMON=false nx run-many -t build --exclude @examples/* @rstest/tests-* --parallel=10",
7+
"test:vscode": "pnpm --filter ./packages/vscode test",
78
"e2e": "cd e2e && pnpm test",
89
"test": "rstest",
910
"change": "changeset",

packages/core/LICENSE.md

Lines changed: 1 addition & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -390,30 +390,6 @@ Licensed under MIT license in the repository at https://github.com/jestjs/jest.g
390390
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
391391
> SOFTWARE.
392392
393-
### @jridgewell/trace-mapping
394-
395-
Licensed under MIT license in the repository at git+https://github.com/jridgewell/sourcemaps.git.
396-
397-
> Copyright 2024 Justin Ridgewell <[email protected]>
398-
>
399-
> Permission is hereby granted, free of charge, to any person obtaining a copy
400-
> of this software and associated documentation files (the "Software"), to deal
401-
> in the Software without restriction, including without limitation the rights
402-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
403-
> copies of the Software, and to permit persons to whom the Software is
404-
> furnished to do so, subject to the following conditions:
405-
>
406-
> The above copyright notice and this permission notice shall be included in
407-
> all copies or substantial portions of the Software.
408-
>
409-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
410-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
411-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
412-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
413-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
414-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
415-
> SOFTWARE.
416-
417393
### @sinonjs/commons
418394

419395
Licensed under BSD-3-Clause license in the repository at git+https://github.com/sinonjs/commons.git.
@@ -751,7 +727,7 @@ Licensed under MIT license.
751727
752728
### magic-string
753729

754-
Licensed under MIT license in the repository at https://github.com/rich-harris/magic-string.git.
730+
Licensed under MIT license.
755731

756732
> Copyright 2018 Rich Harris
757733
>
@@ -1017,46 +993,6 @@ Licensed under MIT license in the repository at git+https://github.com/errwischt
1017993
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1018994
> SOFTWARE.
1019995
1020-
### std-env
1021-
1022-
Licensed under MIT license.
1023-
1024-
> MIT License
1025-
>
1026-
> Copyright (c) Pooya Parsa <[email protected]>
1027-
>
1028-
> Permission is hereby granted, free of charge, to any person obtaining a copy
1029-
> of this software and associated documentation files (the "Software"), to deal
1030-
> in the Software without restriction, including without limitation the rights
1031-
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1032-
> copies of the Software, and to permit persons to whom the Software is
1033-
> furnished to do so, subject to the following conditions:
1034-
>
1035-
> The above copyright notice and this permission notice shall be included in all
1036-
> copies or substantial portions of the Software.
1037-
>
1038-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1039-
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1040-
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1041-
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1042-
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1043-
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1044-
> SOFTWARE.
1045-
1046-
### strip-ansi
1047-
1048-
Licensed under MIT license.
1049-
1050-
> MIT License
1051-
>
1052-
> Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)
1053-
>
1054-
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1055-
>
1056-
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1057-
>
1058-
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1059-
1060996
### supports-color
1061997

1062998
Licensed under MIT license.

packages/core/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
"types": "./dist-types/index.d.ts",
2929
"default": "./dist/index.js"
3030
},
31+
"./package.json": {
32+
"default": "./package.json"
33+
},
3134
"./globals": {
3235
"types": "./globals.d.ts"
3336
},

0 commit comments

Comments
 (0)