Skip to content

css/html: use built-in node test framework#309625

Merged
aeschli merged 2 commits into
mainfrom
aeschli/frantic-anteater-383
Apr 14, 2026
Merged

css/html: use built-in node test framework#309625
aeschli merged 2 commits into
mainfrom
aeschli/frantic-anteater-383

Conversation

@aeschli
Copy link
Copy Markdown
Contributor

@aeschli aeschli commented Apr 13, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 13, 2026 21:01
@aeschli aeschli enabled auto-merge (squash) April 13, 2026 21:01
@aeschli aeschli self-assigned this Apr 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the CSS and HTML language server unit/integration tests off Mocha and onto Node’s built-in node:test framework, aligning these extension test suites with the platform’s move towards the native Node test runner.

Changes:

  • Replaced Mocha-based JS test runners in CSS/HTML servers with a node:test-driven runner (run({ files })) and updated test file imports to node:test.
  • Updated CSS/HTML server TypeScript test files to use node:assert/strict and node:* builtins, removing Mocha globals.
  • Removed Mocha-specific configuration/typing artifacts (mocha.opts, @types/mocha) and updated VS Code launch configurations and npm scripts accordingly.
Show a summary per file
File Description
extensions/json-language-features/server/test/mocha.opts Removes leftover Mocha opts file (test harness cleanup).
extensions/json-language-features/server/package.json Drops @types/mocha from devDependencies.
extensions/json-language-features/server/package-lock.json Removes @types/mocha from lockfile.
extensions/json-language-features/server/.vscode/launch.json Removes obsolete Mocha “Unit Tests” debug configuration.
extensions/html-language-features/server/test/index.js Switches HTML server test runner from Mocha to node:test programmatic runner.
extensions/html-language-features/server/src/test/words.test.ts Migrates tests to node:test + node:assert/strict and node builtins.
extensions/html-language-features/server/src/test/semanticTokens.test.ts Migrates tests to node:test + strict assert.
extensions/html-language-features/server/src/test/selectionRanges.test.ts Migrates tests to node:test + strict assert.
extensions/html-language-features/server/src/test/rename.test.ts Migrates tests to node:test + strict assert.
extensions/html-language-features/server/src/test/formatting.test.ts Migrates tests to node:test + strict assert and node builtins.
extensions/html-language-features/server/src/test/folding.test.ts Migrates tests to node:test + strict assert.
extensions/html-language-features/server/src/test/embedded.test.ts Migrates tests to node:test + strict assert.
extensions/html-language-features/server/src/test/documentContext.test.ts Migrates tests to node:test + strict assert.
extensions/html-language-features/server/src/test/completions.test.ts Migrates tests to node:test + strict assert and node builtins.
extensions/html-language-features/server/package.json Drops @types/mocha from devDependencies.
extensions/html-language-features/server/package-lock.json Removes @types/mocha from lockfile.
extensions/html-language-features/server/.vscode/launch.json Updates “Unit Tests” debug configuration to run test/index.js.
extensions/html-language-features/.vscode/launch.json Removes obsolete “Launch Tests” configuration.
extensions/css-language-features/test/mocha.opts Removes Mocha opts file now that Mocha runner is gone.
extensions/css-language-features/server/test/index.js Switches CSS server test runner from Mocha to node:test programmatic runner.
extensions/css-language-features/server/src/test/links.test.ts Migrates tests to node:test + node:assert/strict and node builtins.
extensions/css-language-features/server/src/test/completion.test.ts Migrates tests to node:test + node:assert/strict and node builtins.
extensions/css-language-features/server/package.json Drops @types/mocha from devDependencies.
extensions/css-language-features/server/package-lock.json Removes @types/mocha from lockfile.
extensions/css-language-features/server/.vscode/launch.json Updates “Unit Tests” debug configuration to run test/index.js.
extensions/css-language-features/package.json Updates top-level test script to delegate to server tests.
extensions/css-language-features/.vscode/launch.json Updates “Server Unit Tests” debug configuration to run the new runner with correct cwd.

Copilot's findings

Files not reviewed (3)
  • extensions/css-language-features/server/package-lock.json: Language not supported
  • extensions/html-language-features/server/package-lock.json: Language not supported
  • extensions/json-language-features/server/package-lock.json: Language not supported
  • Files reviewed: 24/27 changed files
  • Comments generated: 4

Comment thread extensions/html-language-features/server/.vscode/launch.json
Comment on lines +6 to +23
import { run } from 'node:test';
import { spec } from 'node:test/reporters';
import path from 'node:path';
import glob from 'glob';
import Mocha from 'mocha';

const suite = 'Integration CSS Extension Tests';
const testRoot = import.meta.dirname;
const files = glob.sync(path.posix.join(testRoot, '../out/test/**/*.test.js'));

const options = {
ui: 'tdd',
color: true,
timeout: 60000
};
const stream = run({
files,
timeout: 60000,
...(process.env.MOCHA_GREP ? { testNamePatterns: [process.env.MOCHA_GREP] } : {}),
});

if (process.env.MOCHA_GREP) {
options.grep = process.env.MOCHA_GREP;
}
let failed = 0;
stream.on('test:fail', () => failed++);
stream.compose(spec).pipe(process.stdout);
stream.on('close', () => process.exit(failed ? 1 : 0));
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous Mocha runner emitted a JUnit XML report under BUILD_ARTIFACTSTAGINGDIRECTORY/GITHUB_WORKSPACE (used by CI’s PublishTestResults step). The new node:test runner only prints the spec reporter to stdout, so CSS integration test results will no longer be published as JUnit. Consider adding a CI-only JUnit reporter/file output (e.g. using node:test/reporters’ junit reporter) while keeping the spec output for console logs.

Copilot uses AI. Check for mistakes.
Comment thread extensions/html-language-features/server/test/index.js Outdated
Comment on lines 15 to 21
"name": "Unit Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/../../../node_modules/mocha/bin/_mocha",
"program": "${workspaceFolder}/test/index.js",
"stopOnEntry": false,
"args": [
"--timeout",
"999999",
"--colors"
],
"args": [],
"cwd": "${workspaceFolder}",
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the launch configuration now invoking test/index.js directly (and no longer passing a very large timeout), debugging these tests is likely to hit the hardcoded 60s timeout in test/index.js when breakpoints are set. Consider restoring a debug-only higher timeout (via args/env in launch.json, or by letting test/index.js read an override such as NODE_TEST_TIMEOUT).

See below for a potential fix:

			"env": {
				"NODE_TEST_TIMEOUT": "600000"
			},

Copilot uses AI. Check for mistakes.
roblourens
roblourens previously approved these changes Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 91b02efb Current: 2a0f6e2c

Changed (12)

chat/aiCustomizations/aiCustomizationManagementEditor/WelcomePage/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/WelcomePage/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/Sessions/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/Sessions/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/SessionsSkillsTab/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/SessionsSkillsTab/Light
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePagePromptLaunchers/Dark
Before After
before after
editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePagePromptLaunchers/Light
Before After
before after
chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePageSelectorPromptLaunchers/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationWelcomePages/WelcomePageSelectorPromptLaunchers/Light
Before After
before after

@aeschli aeschli merged commit 0204b2d into main Apr 14, 2026
26 checks passed
@aeschli aeschli deleted the aeschli/frantic-anteater-383 branch April 14, 2026 09:36
@vs-code-engineering vs-code-engineering Bot added this to the 1.117.0 milestone Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants