vscode-test
Advanced tools
Comparing version 0.4.3 to 1.0.0-next.0
# Changelog | ||
### 1.0.0-next.0 | 2019-06-24 | ||
- Updated API: | ||
- One single set of options. | ||
- `extensionPath` => `extensionDevelopmentPath` to align with VS Code launch flags | ||
- `testRunnerPath` => `extensionTestsPath` to align with VS Code launch flags | ||
- `testRunnerEnv` => `extensionTestsEnv` to align with VS Code launch flags | ||
- `additionalLaunchArgs` => `launchArgs` | ||
- `testWorkspace` removed. Pass path to file/folder/workspace as first argument to `launchArgs` instead. | ||
- `locale` removed. Pass `--locale` to `launchArgs` instead. | ||
### 0.4.3 | 2019-05-30 | ||
@@ -4,0 +15,0 @@ |
@@ -5,5 +5,4 @@ export interface TestOptions { | ||
* | ||
* If not passed, will use options.version for downloading a copy of | ||
* VS Code for testing. If `version` is not specified either, will | ||
* download and use latest stable release. | ||
* If not passed, will use `options.version` to download a copy of VS Code for testing. | ||
* If `version` is not specified either, will download and use latest stable release. | ||
*/ | ||
@@ -16,3 +15,3 @@ vscodeExecutablePath?: string; | ||
* | ||
* Default to latest stable version. | ||
* Defaults to latest stable version. | ||
*/ | ||
@@ -24,5 +23,5 @@ version?: string; | ||
*/ | ||
extensionPath: string; | ||
extensionDevelopmentPath: string; | ||
/** | ||
* Absolute path to the test runner. Passed to `--extensionTestsPath`. | ||
* Absolute path to the extension tests runner. Passed to `--extensionTestsPath`. | ||
* Can be either a file path or a directory path that contains an `index.js`. | ||
@@ -32,80 +31,33 @@ * Must export a `run` function of the following signature: | ||
* ```ts | ||
* function run(testsRoot: string, cb: (error: any, failures?: number) => void): void; | ||
* function run(): Promise<void>; | ||
* ``` | ||
* | ||
* When running integration test, the Extension Development Host will call this function | ||
* that runs the test suite. The `cb` function should be called when the test suite finishes. | ||
* When running the extension test, the Extension Development Host will call this function | ||
* that runs the test suite. This function should throws an error if any test fails. | ||
* | ||
*/ | ||
testRunnerPath: string; | ||
extensionTestsPath: string; | ||
/** | ||
* Environment variables being passed to the test runner. | ||
* Environment variables being passed to the extension test script. | ||
*/ | ||
testRunnerEnv?: { | ||
extensionTestsEnv?: { | ||
[key: string]: string | undefined; | ||
}; | ||
/** | ||
* Absolute path of the fixture workspace to launch for testing. | ||
* Passed as the first argument to `code` executable and can be: | ||
* A list of launch arguments passed to VS Code executable, in addition to `--extensionDevelopmentPath` | ||
* and `--extensionTestsPath` which are provided by `extensionDevelopmentPath` and `extensionTestsPath` | ||
* options. | ||
* | ||
* - File path: Open file on test start | ||
* - Folder path: Open folder on test start | ||
* - Workspace file path: Open workspace on test start | ||
*/ | ||
testWorkspace?: string; | ||
/** | ||
* A list of arguments appended to the default VS Code launch arguments below: | ||
* If the first argument is a path to a file/folder/workspace, the launched VS Code instance | ||
* will open it. | ||
* | ||
* ```ts | ||
* [ | ||
* options.testWorkspace, | ||
* '--extensionDevelopmentPath=' + options.extPath, | ||
* '--extensionTestsPath=' + options.testPath, | ||
* '--locale=' + (options.locale || 'en') | ||
* ]; | ||
* ``` | ||
* | ||
* See `code --help` for possible arguments. | ||
*/ | ||
additionalLaunchArgs?: string[]; | ||
/** | ||
* The locale to use (e.g. `en-US` or `zh-TW`). | ||
* If not specified, it defaults to `en`. | ||
*/ | ||
locale?: string; | ||
launchArgs?: string[]; | ||
} | ||
export interface ExplicitTestOptions { | ||
/** | ||
* The VS Code executable being used for testing. | ||
* | ||
* If not passed, will use options.version for downloading a copy of | ||
* VS Code for testing. If `version` is not specified either, will | ||
* download and use latest stable release. | ||
*/ | ||
vscodeExecutablePath?: string; | ||
/** | ||
* The VS Code version to download. Valid versions are: | ||
* - `'insiders'` | ||
* - `'1.32.0'`, `'1.31.1'`, etc | ||
* | ||
* Default to latest stable version. | ||
*/ | ||
version?: string; | ||
/** | ||
* A list of arguments used for launching VS Code executable. | ||
* | ||
* You need to provide `--extensionDevelopmentPath` and `--extensionTestsPath` manually when | ||
* using this option. If you want to open a specific workspace for testing, you need to pass | ||
* the absolute path of the workspace as first item in this list. | ||
* | ||
* See `code --help` for possible arguments. | ||
*/ | ||
launchArgs: string[]; | ||
/** | ||
* Environment variables being passed to the test runner. | ||
*/ | ||
testRunnerEnv?: { | ||
[key: string]: string | undefined; | ||
}; | ||
} | ||
export declare function runTests(options: TestOptions | ExplicitTestOptions): Promise<number>; | ||
/** | ||
* Run VS Code extension test | ||
* | ||
* @returns The exit code of the command to launch VS Code extension test | ||
*/ | ||
export declare function runTests(options: TestOptions): Promise<number>; |
@@ -44,2 +44,7 @@ "use strict"; | ||
var download_1 = require("./download"); | ||
/** | ||
* Run VS Code extension test | ||
* | ||
* @returns The exit code of the command to launch VS Code extension test | ||
*/ | ||
function runTests(options) { | ||
@@ -58,17 +63,10 @@ return __awaiter(this, void 0, void 0, function () { | ||
case 2: | ||
if ('launchArgs' in options) { | ||
return [2 /*return*/, innerRunTests(options.vscodeExecutablePath, options.launchArgs, options.testRunnerEnv)]; | ||
} | ||
args = [ | ||
'--extensionDevelopmentPath=' + options.extensionPath, | ||
'--extensionTestsPath=' + options.testRunnerPath, | ||
'--locale=' + (options.locale || 'en') | ||
'--extensionDevelopmentPath=' + options.extensionDevelopmentPath, | ||
'--extensionTestsPath=' + options.extensionTestsPath | ||
]; | ||
if (options.testWorkspace) { | ||
args.unshift(options.testWorkspace); | ||
if (options.launchArgs) { | ||
args = options.launchArgs.concat(args); | ||
} | ||
if (options.additionalLaunchArgs) { | ||
args = args.concat(options.additionalLaunchArgs); | ||
} | ||
return [2 /*return*/, innerRunTests(options.vscodeExecutablePath, args, options.testRunnerEnv)]; | ||
return [2 /*return*/, innerRunTests(options.vscodeExecutablePath, args, options.extensionTestsEnv)]; | ||
} | ||
@@ -75,0 +73,0 @@ }); |
{ | ||
"name": "vscode-test", | ||
"version": "0.4.3", | ||
"version": "1.0.0-next.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "compile": "tsc -p ./", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35480
15
560