Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,73 @@ jobs:
- name: Publish to npm
run: |
pnpm -r publish --tag ${{ github.event.inputs.npm_tag }} --publish-branch ${{ github.event.inputs.branch }}

release_vscode_extension:
name: Release VS Code Extension (${{ matrix.vsce-target }})
if: github.repository == 'web-infra-dev/rstest' && github.event_name == 'workflow_dispatch'
needs: release
runs-on: ${{ matrix.runner }}
environment: vscode-marketplace
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
vsce-target: linux-x64
platform: linux
arch: x64
- runner: ubuntu-22.04-arm64
vsce-target: linux-arm64
platform: linux
arch: arm64
- runner: macos-13
vsce-target: darwin-x64
platform: darwin
arch: x64
- runner: macos-14
vsce-target: darwin-arm64
platform: darwin
arch: arm64
- runner: windows-2022
vsce-target: win32-x64
platform: win32
arch: x64
- runner: windows-latest
vsce-target: win32-arm64
platform: win32
arch: arm64
defaults:
run:
shell: bash
env:
npm_config_arch: ${{ matrix.arch }}
npm_config_platform: ${{ matrix.platform }}
VSCE_TARGET: ${{ matrix.vsce-target }}
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 1
ref: ${{ github.event.inputs.branch }}

- name: Setup Pnpm
run: |
npm install -g corepack@latest --force
corepack enable

- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install

- name: Package VS Code Extension
run: pnpm --filter ./packages/vscode run package:vsce -o "rstest-${{ matrix.vsce-target }}.vsix"

- name: Publish VS Code Extension
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: pnpm --filter ./packages/vscode exec vsce publish --target ${{ matrix.vsce-target }}
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@ jobs:
- name: E2E Test
if: steps.changes.outputs.changed == 'true'
run: pnpm run e2e

- name: VS Code Extension Test
if: steps.changes.outputs.changed == 'true'
run: pnpm run test:vscode
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ test-temp-*
.vscode/**/*
!.vscode/settings.json
!.vscode/extensions.json
!.vscode/launch.json
!.vscode/tasks.json
.idea/
.nx/
.history/
Expand All @@ -34,5 +36,7 @@ test-results/
fixtures-test/
fixtures-test-*/
.rslib/

!packages/core/src/coverage
tests-dist/
.vscode-test/
packages/vscode/*.vsix
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v22
v22
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/packages/vscode",
"${workspaceFolder}/packages/vscode/sample"
],
"outFiles": ["${workspaceFolder}/packages/vscode/dist/**/*.js"],
"preLaunchTask": "npm: build:local"
}
]
}
21 changes: 21 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build:local",
"path": "packages/vscode",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
10 changes: 8 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
"$schema": "https://biomejs.dev/schemas/2.2.2/schema.json",
"assist": { "actions": { "source": { "organizeImports": "on" } } },
"vcs": {
"enabled": true,
Expand All @@ -9,7 +9,13 @@
},
"files": {
"ignoreUnknown": true,
"includes": ["**", "!**/*.vue", "!**/dist", "!**/dist-types"]
"includes": [
"**",
"!**/*.vue",
"!**/dist",
"!**/dist-types",
"!**/.vscode-test.mjs"
]
},
"formatter": {
"indentStyle": "space"
Expand Down
1 change: 0 additions & 1 deletion e2e/scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class Cli {
public stdout = '';
public stderr = '';
private stdoutListeners: Array<() => void> = [];
// biome-ignore lint/correctness/noUnusedPrivateClassMembers: will use it
private stderrListeners: Array<() => void> = [];

constructor(
Expand Down
2 changes: 1 addition & 1 deletion e2e/test-coverage/fixtures/src/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ export const countWords = (str: string): number => {

export const truncate = (str: string, maxLength: number): string => {
if (str.length <= maxLength) return str;
return str.slice(0, maxLength - 3) + '...';
return `${str.slice(0, maxLength - 3)}...`;
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"scripts": {
"typecheck": "cross-env NX_DAEMON=false nx run-many -t typecheck --exclude @examples/* --parallel=10",
"build": "cross-env NX_DAEMON=false nx run-many -t build --exclude @examples/* @rstest/tests-* --parallel=10",
"test:vscode": "pnpm --filter ./packages/vscode test",
"e2e": "cd e2e && pnpm test",
"test": "rstest",
"change": "changeset",
Expand Down
66 changes: 1 addition & 65 deletions packages/core/LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,30 +390,6 @@ Licensed under MIT license in the repository at https://github.com/jestjs/jest.g
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.

### @jridgewell/trace-mapping

Licensed under MIT license in the repository at git+https://github.com/jridgewell/sourcemaps.git.

> Copyright 2024 Justin Ridgewell <[email protected]>
>
> 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:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> 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.

### @sinonjs/commons

Licensed under BSD-3-Clause license in the repository at git+https://github.com/sinonjs/commons.git.
Expand Down Expand Up @@ -751,7 +727,7 @@ Licensed under MIT license.

### magic-string

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

> Copyright 2018 Rich Harris
>
Expand Down Expand Up @@ -1017,46 +993,6 @@ Licensed under MIT license in the repository at git+https://github.com/errwischt
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.

### std-env

Licensed under MIT license.

> MIT License
>
> Copyright (c) Pooya Parsa <[email protected]>
>
> 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:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> 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.

### strip-ansi

Licensed under MIT license.

> MIT License
>
> Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)
>
> 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:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> 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.

### supports-color

Licensed under MIT license.
Expand Down
3 changes: 3 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
"types": "./dist-types/index.d.ts",
"default": "./dist/index.js"
},
"./package.json": {
"default": "./package.json"
},
"./globals": {
"types": "./globals.d.ts"
},
Expand Down
Empty file.
4 changes: 3 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import type {
} from './types';

export { runCLI } from './cli';
export { mergeRstestConfig } from './config';
export { loadConfig, mergeRstestConfig } from './config';
export { createRstest } from './core';

export * from './runtime/api/public';

export type {
Expand Down
5 changes: 5 additions & 0 deletions packages/vscode/.vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'tests-dist/e2e/*.test.js',
});
49 changes: 49 additions & 0 deletions packages/vscode/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Repository guidelines

Concise contributor guide for the Rstest VS Code extension package.

## Project structure & module organization

- `src/` — TypeScript sources. Key modules: `extension.ts` (entry/TestController), `testTree.ts` (builds TestItem tree), `parserTest.ts` (SWC-based parser), `master.ts` (spawns worker), `worker/` (runner + reporter).
- `tests/` — E2E tests under `tests/suite/**`. Compiled to `tests-dist/` for the Extension Host.
- `tests/unit/**` — Unit tests executed by `@rstest/core` with fixtures in `tests/unit/fixtures`.
- `dist/` — Built extension output. Do not edit.
- Config: `tsconfig.json`, `tsconfig.test.json`, `rslib.config.ts`, `rstest.config.ts`.

## Build, test, and development commands

- `npm run build` — Build with `rslib` (use `build:local` for sourcemaps).
- `npm run watch` — Rebuild on change.
- `npm run typecheck` — TypeScript `--noEmit` check.
- `npm run test:unit` — Run unit tests via `rstest`.
- `npm run test:e2e` — Compile tests and run VS Code Extension Host E2E (downloads VS Code on first run).
- `npm run lint` — Run Biome checks.

## Coding style & naming conventions

- Language: TypeScript, 2-space indentation. Keep changes minimal and focused.
- Naming: camelCase for files and symbols; PascalCase for classes; follow existing patterns (e.g., `testTree.ts`, `parserTest.ts`).
- Linting: Biome (`npm run lint`). Prefer simple, readable logic over cleverness.

## Testing guidelines

- Name tests `*.test.ts`. Place parser/unit tests in `tests/unit/**`; E2E tests in `tests/suite/**` (loaded by the E2E runner only).
- E2E opens `tests/fixtures` workspace automatically; use `toLabelTree()` from `tests/suite/index.test.ts` for stable tree assertions.
- Typical loop: `npm run typecheck` → `npm run test:unit` → `npm run test:e2e`.

## Commit & pull request guidelines

- Write clear, imperative commit messages; keep PRs small and scoped. Reference issues (e.g., `Fixes #123`).
- Include rationale, testing notes, and screenshots/logs if relevant (e.g., label trees, error output).
- Avoid unrelated refactors; update or add tests with behavior changes.

## Architecture overview

- Two-process design: VS Code extension (`extension.ts`) communicates with a worker (`worker/index.ts`) via WebSocket. Main sends `WorkerInitData`/`WorkerRunTestData`; worker emits `WorkerEventFinish`.

## References

- VS Code Testing Guide: https://code.visualstudio.com/api/extension-guides/testing
- VS Code Test API: https://code.visualstudio.com/api/references/vscode-api#tests
- VS Code `TestController` API: https://code.visualstudio.com/api/references/vscode-api#TestController
- VS Code `TestItem` API: https://code.visualstudio.com/api/references/vscode-api#TestItem
Loading
Loading