Skip to content
Merged
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
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

concurrency:
group: ci-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
build_and_test:
name: Build and Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: FASTBuildMonitorVSCode
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
cache-dependency-path: |
FASTBuildMonitorVSCode/package-lock.json
FASTBuildMonitorVSCode/webview-ui/package-lock.json
- run: npm run ci:all
- run: npm run build:all
- run: npm run test:typecheck
- run: npm run test:coverage
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v7
with:
name: coverage
path: FASTBuildMonitorVSCode/coverage
if-no-files-found: ignore
2 changes: 1 addition & 1 deletion FASTBuildMonitorVSCode/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ node_modules/
.vscode-test/
*.vsix
artifacts/

coverage/
7 changes: 6 additions & 1 deletion FASTBuildMonitorVSCode/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

artifacts/**
scripts/**
tests/**
coverage/**
src/**
**/.gitignore
.yarnrc
Expand All @@ -14,10 +16,13 @@ src/**
**/*.ts

webview-ui/src/**
webview-ui/tests/**
webview-ui/node_modules/**

node_modules/**

# Config files
esbuild.js
*.config.js
*.config.js
vitest.config.mts
tsconfig.test.json
56 changes: 52 additions & 4 deletions FASTBuildMonitorVSCode/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## Development and tests

From `FASTBuildMonitorVSCode`, using Node.js 24:

```bash
npm run ci:all
npm test
npm run test:coverage
```

Vitest covers the extension core and React web UI. Pull requests automatically build both parts, type-check tests, and validate coverage.

# Release Process
This repository uses [semantic-release](https://github.com/semantic-release/semantic-release) for it's releases. That means that any commit that goes into `mojang/main` will potentially trigger a release and contribute to the changelog.

Expand All @@ -15,17 +27,53 @@ Some examples of this are:

# Local Development

Initialize
Use Node.js 24. Run the following commands from `FASTBuildMonitorVSCode`.

Install the extension and webview dependencies from the committed lockfiles:
```bash
npm install:all
npm run ci:all
```

Build
When changing dependencies, use `npm run install:all` and commit both updated lockfiles.

Build:
```bash
npm run build:all
```

To test: press F5 in VS Code to launch the Extension Development Host.
## Automated tests

The project uses [Vitest](https://vitest.dev/) with two projects:

- `extension`: Node-based tests in `tests/extension` covering log polling and parsing, build sessions and workers, configuration and utilities, activation, commands, status updates, and webview messaging.
- `webview`: React Testing Library tests in `webview-ui/tests`, running in jsdom, covering snapshot updates, controls, statistics, job lists, themes, progress contrast, and timeline rendering, core allocation, scrolling, zooming, and tooltips.

Run both suites once:

```bash
npm test
```

Run a single project or use watch mode:

```bash
npm test -- --project extension
npm test -- --project webview
npm test -- --watch
```

Type-check the tests and collect coverage:

```bash
npm run test:typecheck
npm run test:coverage
```

Coverage includes all extension and webview TypeScript sources, including files not imported by a test. Declaration files are excluded. Every source file must meet at least **80% statements, lines, and functions**, and **75% branches**. Reports are written to `coverage`; open `coverage/index.html` for the detailed report. Add behavior-focused regression tests alongside changes rather than excluding uncovered production code.

The extension tests mock the VS Code API and file polling boundaries, and use fake timers instead of real polling delays. Webview tests mock the VS Code bridge, canvas operations/pixel samples, and resize observers. They do not require VS Code, a running FASTBuild process, or a browser. These tests do not replace visual checks of actual canvas rendering: press F5 in VS Code to launch the Extension Development Host for manual validation.

The [CI workflow](../.github/workflows/ci.yml) runs on pull requests when opened, updated, or reopened. It installs locked dependencies, builds both parts, type-checks tests, enforces coverage thresholds, and uploads the coverage report. It uses read-only repository permissions and does not require release credentials. To enforce it before merging, configure the **Build and Test** check as required in branch protection.

# Architecture

Expand Down
1 change: 1 addition & 0 deletions FASTBuildMonitorVSCode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@
| `fbuildmonitor.logPath` | `""` | Custom path to `FastBuildLog.log`. Empty = auto-detect from `%TEMP%\FASTBuild\` or `FASTBUILD_TEMP_PATH`. |
| `fbuildmonitor.pollInterval` | `500` | Log file poll interval in milliseconds (100–5000). |
| `fbuildmonitor.autoStart` | `true` | Auto-start monitoring when the panel opens. |
| `fbuildMonitor.useLegacyColors` | `false` | Use the original fixed dark color scheme instead of colors derived from the active VS Code theme. |
Loading
Loading