UNPKG

2.59 kBTypeScriptView Raw
1import { DownloadVersion, DownloadPlatform } from './download';
2export interface TestOptions {
3 /**
4 * The VS Code executable path used for testing.
5 *
6 * If not passed, will use `options.version` to download a copy of VS Code for testing.
7 * If `version` is not specified either, will download and use latest stable release.
8 */
9 vscodeExecutablePath?: string;
10 /**
11 * The VS Code version to download. Valid versions are:
12 * - `'stable'`
13 * - `'insiders'`
14 * - `'1.32.0'`, `'1.31.1'`, etc
15 *
16 * Defaults to `stable`, which is latest stable version.
17 *
18 * *If a local copy exists at `.vscode-test/vscode-<VERSION>`, skip download.*
19 */
20 version?: DownloadVersion;
21 /**
22 * The VS Code platform to download. If not specified, defaults to:
23 * - Windows: `win32-archive`
24 * - macOS: `darwin`
25 * - Linux: `linux-x64`
26 *
27 * Possible values are: `win32-archive`, `win32-x64-archive`, `darwin` and `linux-x64`.
28 */
29 platform?: DownloadPlatform;
30 /**
31 * Absolute path to the extension root. Passed to `--extensionDevelopmentPath`.
32 * Must include a `package.json` Extension Manifest.
33 */
34 extensionDevelopmentPath: string;
35 /**
36 * Absolute path to the extension tests runner. Passed to `--extensionTestsPath`.
37 * Can be either a file path or a directory path that contains an `index.js`.
38 * Must export a `run` function of the following signature:
39 *
40 * ```ts
41 * function run(): Promise<void>;
42 * ```
43 *
44 * When running the extension test, the Extension Development Host will call this function
45 * that runs the test suite. This function should throws an error if any test fails.
46 *
47 */
48 extensionTestsPath: string;
49 /**
50 * Environment variables being passed to the extension test script.
51 */
52 extensionTestsEnv?: {
53 [key: string]: string | undefined;
54 };
55 /**
56 * A list of launch arguments passed to VS Code executable, in addition to `--extensionDevelopmentPath`
57 * and `--extensionTestsPath` which are provided by `extensionDevelopmentPath` and `extensionTestsPath`
58 * options.
59 *
60 * If the first argument is a path to a file/folder/workspace, the launched VS Code instance
61 * will open it.
62 *
63 * See `code --help` for possible arguments.
64 */
65 launchArgs?: string[];
66}
67/**
68 * Run VS Code extension test
69 *
70 * @returns The exit code of the command to launch VS Code extension test
71 */
72export declare function runTests(options: TestOptions): Promise<number>;