VS Code extension that previews Archify diagrams from their JSON sources (live, as you type) and opens rendered Archify HTML in a viewer tab. Bundles the Archify 3.0.1 renderer and runs it on VS Code's Node runtime. Adds validation diagnostics, JSON schema help, source-link navigation, export saving, render-to-file and open-in-browser commands. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
38 lines
1.4 KiB
JavaScript
38 lines
1.4 KiB
JavaScript
// Runs the integration suite inside a real VS Code instance with a throwaway
|
|
// profile. Uses the locally installed VS Code when VSCODE_PATH is set or the
|
|
// default macOS location exists; otherwise downloads one.
|
|
import fs from 'node:fs';
|
|
import os from 'node:os';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { runTests } from '@vscode/test-electron';
|
|
|
|
// When launched from a VS Code terminal this is inherited and would make the
|
|
// test instance start as plain Node.
|
|
delete process.env.ELECTRON_RUN_AS_NODE;
|
|
|
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
const macApp = '/Applications/Visual Studio Code.app/Contents/MacOS/Code';
|
|
const vscodeExecutablePath = process.env.VSCODE_PATH || (fs.existsSync(macApp) ? macApp : undefined);
|
|
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-ext-it-'));
|
|
const workspace = path.join(scratch, 'workspace');
|
|
fs.cpSync(path.join(root, 'test', 'fixtures'), workspace, { recursive: true });
|
|
|
|
try {
|
|
await runTests({
|
|
vscodeExecutablePath,
|
|
extensionDevelopmentPath: root,
|
|
extensionTestsPath: path.join(root, 'out', 'test', 'integration', 'suite.js'),
|
|
launchArgs: [
|
|
workspace,
|
|
'--disable-extensions',
|
|
'--disable-workspace-trust',
|
|
'--skip-welcome',
|
|
'--skip-release-notes',
|
|
`--user-data-dir=${path.join(scratch, 'user-data')}`,
|
|
],
|
|
});
|
|
} finally {
|
|
fs.rmSync(scratch, { recursive: true, force: true });
|
|
}
|