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
8 changes: 5 additions & 3 deletions docs/maintainers/vscode-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ panel opens, it checks the Testing view: the **Projections** controller lists
the projection with its checks, and the demo repository's comparator tests
(`tools/first.comparator.test.yaml`, used by no projection) at their lines;
running them reports one pass and one failure at the line of the expectation
that failed, and running the projection reports its checks.
`scripts/screenshots/capture-themes.mjs` records the `--vscode-*` variables real
VS Code injects for several color themes
that failed, and running the projection reports its checks. It drives the
Inspector as on a desktop: on a GitHub-hosted Windows runner, whose display is
1024×768 with animations off, `test/smoke/run.mjs` first sets a 1920×1080
display and turns animations on. `scripts/screenshots/capture-themes.mjs`
records the `--vscode-*` variables real VS Code injects for several color themes
(`packages/host/vscode-ui/fixtures/themes/`), and
`scripts/screenshots/screenshots.mjs` takes the Inspector with the VS Code UI in
VS Code's dark, light and high contrast themes and compares each with the
Expand Down
24 changes: 24 additions & 0 deletions packages/integrations/vscode/test/smoke/run.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
// Smoke test in a real VS Code (downloaded by @vscode/test-electron into .vscode-test): the extension starts the
// runner for a demo repository, the webview Inspector reads it through the message transport and compares a pair.
import {runTests} from '@vscode/test-electron'
import {execFileSync} from 'node:child_process'
import {mkdir, mkdtemp, writeFile} from 'node:fs/promises'
import {tmpdir} from 'node:os'
import {join} from 'node:path'
import {fileURLToPath} from 'node:url'
import {createDemoRepository} from './demo-repo.mjs'

/**
* The smoke test drives the Inspector as on a desktop. A GitHub-hosted Windows runner's display is 1024×768, where VS
* Code's editor is narrower than the Inspector's two-panel layout (1012 px), which moves the Details panel into a menu;
* and Windows Server turns animations off, which Chromium reports as prefers-reduced-motion, which shows comparisons
* without playing them. The test sets both as it starts, not in a CI step before it: such a step is skipped once an
* earlier one fails, and the test then ran on the small display and timed out waiting for the Details panel's evidence.
*/
function desktopDisplay() {
const script = [
"$ErrorActionPreference = 'Stop'",
// Without a console, PowerShell would write its progress to the log as CLIXML.
"$ProgressPreference = 'SilentlyContinue'",
'Set-DisplayResolution -Width 1920 -Height 1080 -Force',
`Add-Type -Namespace Win32 -Name User -MemberDefinition '[DllImport("user32.dll")] public static extern bool SystemParametersInfo(uint action, uint parameter, IntPtr value, uint flags);'`,
// SPI_SETCLIENTAREAANIMATION, on, saved and broadcast.
"if (-not [Win32.User]::SystemParametersInfo(0x1043, 0, [IntPtr]1, 3)) { throw 'Could not turn animations on' }",
].join('\n')
// Encoded, so the script's quotes survive Windows' command line.
const encoded = Buffer.from(script, 'utf16le').toString('base64')
execFileSync('pwsh', ['-NoProfile', '-NonInteractive', '-EncodedCommand', encoded], {stdio: 'inherit'})
}
if (process.platform === 'win32' && process.env.RUNNER_ENVIRONMENT === 'github-hosted') desktopDisplay()

const extension = fileURLToPath(new URL('../../', import.meta.url))
const cli =
process.env.PROJECTIONS_CLI ??
Expand Down