You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,3 +118,53 @@ If you have an idea or want to contribute a feature, please first [create an iss
118
118
If you make a pull request that contributes code, please run `npm run lint src` and resolve any errors that did not get auto-fixed, preferrably before each commit.
119
119
120
120
Please also refer to our [contributor docs](https://vsc-neuropilot.github.io/docs/meta/contributors).
121
+
122
+
### Tests
123
+
124
+
We have both unit tests and integration tests. Integration tests spin up a VS Code host (desktop Electron or the browser-hosted workbench) and exercise the extension.
125
+
126
+
Folder layout:
127
+
128
+
-`src/test/unit-test/` — unit tests that validate prompt text generation logic only
129
+
-`src/test/suite/desktop/` and `src/test/suite/web/` — integration test harnesses and suites
130
+
131
+
Unit tests:
132
+
133
+
- Purpose: verify prompt text formatting and related pure logic (e.g., line counts, pluralization, escaping)
134
+
- Scope: they DO NOT execute action handlers or use VS Code APIs; they only cover prompt-generation logic
135
+
- Examples: `rewrite_all.simple.test.ts`, `find_text.simple.test.ts`, etc. under `src/test/unit-test/`
136
+
- Execution: unit tests are imported into both the desktop and web test runners, so `pnpm test` (and CI) runs them alongside integration tests; no separate Node/Mocha job is required
137
+
138
+
Integration tests:
139
+
140
+
- Purpose: verify actual action functionality and end-to-end extension behavior
141
+
- Scope: these use VS Code APIs (open/save files, edits, decorations, terminal/tasks, git, etc.) and assert the real effects
142
+
- Environments:
143
+
- Desktop integration runs in the Electron host
144
+
- Web integration runs either under the Electron host with the web bundle or in a real browser via `@vscode/test-web`
145
+
146
+
Prerequisites (web tests):
147
+
148
+
- Install Playwright browsers (required for Firefox/WebKit; Chromium usually works out-of-the-box but we recommend installing all):
149
+
-`pnpm dlx playwright install --with-deps`
150
+
151
+
Commands:
152
+
153
+
- Desktop (Electron host):
154
+
- Run desktop tests: `pnpm run test:desktop`
155
+
156
+
- Web (true browser via `@vscode/test-web`):
157
+
- Quick (Chromium default, build + run): `pnpm run test:web`
158
+
- Per-browser shortcuts (build + run):
159
+
- Chromium: `pnpm run test:web:browser:chromium`
160
+
- Firefox: `pnpm run test:web:browser:firefox`
161
+
- WebKit: `pnpm run test:web:browser:webkit`
162
+
- Manual steps (if you need them):
163
+
- Build browser test bundle: `pnpm run test:web:browser:esbuild`
164
+
- Run with explicit browser flag: `pnpm run test:web:browser:vscode -- --browser=chromium`
165
+
166
+
Notes:
167
+
- Web tests run in a real browser using the web extension bundle; they do not use the Electron (desktop) harness.
168
+
- The browser test workspace is mounted under a virtual scheme; the workspace name may appear as `mount` instead of `test-playground`.
169
+
- File operations in browser mode use the VS Code virtual FS, so ‘trash’ is disabled and deletes are immediate.
170
+
- Headless web runs may log warnings like "Output channel not initialized", "[NeuroClient] WebSocket is not open", or 404s for dev assets. These are expected in the test harness; assertions still validate real side effects (file edits/opens/renames/deletes, document text, active editor) and verify `sendContext` via a mocked client.
0 commit comments