Debugging with VS Code
The repository includes a pre-configured VS Code debug configuration that works with nodemon’s--inspect flag.
Start the server in debug mode
--inspect flag, which opens the V8 inspector on 127.0.0.1:9229 and prints a message like:Open the Debug panel in VS Code
Click the Run and Debug icon in the Activity Bar (or press Ctrl+Shift+D on Windows/Linux, ⇧⌘D on macOS).
Select the Node: Nodemon configuration
In the Run and Debug panel, open the configuration dropdown at the top and select Node: Nodemon.Press F5 or click the green Start Debugging button.VS Code will display all running Node processes. Look for the process that was started with the
--inspect flag.Understanding nodemon restarts
nodemon watches specific file types and directories and restarts the server when it detects changes. Knowing what does and does not trigger a restart saves debugging time. Triggers a restart:- Any
.ts,.json,.yml,.md,.html, or.scssfile inside a watched directory (mainlysrc/) - Changes to
package.jsonor other config files at the root
content/— documentation Markdown filesdata/reusables/,data/variables/,data/glossaries/,data/product-examples/,data/learning-tracks/assets/,script/,tests/,translations/,rest-api-description/,semmle-code/
Key environment variables for development
Set these in your.env file or inline when starting the server.
| Variable | Example value | Effect |
|---|---|---|
NODE_ENV | development | Enables development-mode logging and error output. Set automatically by npm start. |
ENABLED_LANGUAGES | en,ja,pt | Controls which language trees are loaded. Defaults to en. |
ELASTICSEARCH_URL | http://localhost:9200 | Points search to a local Elasticsearch instance instead of production. |
TRANSLATIONS_ROOT | /path/to/translations | Overrides the default translations directory. |
ENABLE_FASTLY_TESTING | true | Enables the /fastly-cache-test route for inspecting Fastly cache headers. |
HYDRO_ENDPOINT | (your endpoint) | Sends analytics events to a local mock instead of production. |
When
ELASTICSEARCH_URL is not set, search requests are proxied to the production endpoint. Set it only if you’re working on search indexing or query logic.Using the fixture server for testing
The fixture server loads a small, self-contained content tree fromsrc/fixtures/fixtures instead of the full content directory. It is the recommended way to test application behavior in isolation.
content/ tree.
Running the test suite
The project uses Vitest as its test runner. All test commands are available vianpm test.
Running all tests
Running a specific test file or directory
Scoped test commands
Several pre-configured test commands set the right environment variables automatically:npm run test:search and npm run test:languages require a running local Elasticsearch instance at http://localhost:9200. Start one via Docker before running these.Type checking
Run the TypeScript compiler without emitting files to check for type errors across the codebase:Linting
Quick reference
| Command | Description |
|---|---|
npm run debug | Start server with Node.js inspector on port 9229 |
npm run fixture-dev | Start fixture server (lightweight content tree) |
npm run fixture-dev-debug | Fixture server with inspector attached |
npm run fixture-test | Run tests against fixture content |
npm test | Run the full Vitest test suite |
npm run tsc | Type-check the TypeScript codebase |
npm run lint | Lint TypeScript source files |
npm run lint-content | Lint Markdown content files |