简体   繁体   中英

vscode-test - error when calling runTests

Its the first time im trying to set up tests for my vscode extension.

I basically just copy pasted the example from /working-with-extensions/testing-extension from code.visualstudio.

I can't call runTests because of the following error:

error TS2345: Argument of type '{ extensionDevelopmentPath: string; extensionTestsPath: string; }' is not assignable to parameter of type 'TestOptions | ExplicitTestOptions'.
  Object literal may only specify known properties, and 'extensionDevelopmentPath' does not exist in type 'TestOptions | ExplicitTestOptions'.

and that's my code:

import * as path from 'path';

import { runTests } from 'vscode-test';


async function main() {
    try {
        const extensionDevelopmentPath = path.resolve(__dirname, '../../../');

        const extensionTestsPath = path.resolve(__dirname, './suite/index');

        await runTests({ extensionDevelopmentPath, extensionTestsPath });

    } catch(err) {
        console.error('Failed to run tests.');
        process.exit(1);
    }
}


main();

I can't find a mistake and would be grateful for any help.

The correct way is currently :

async function main() {
    try {
        let testOption = { extensionDevelopmentPath: path.resolve(__dirname, '../'), extensionTestsPath: path.resolve(__dirname, './suite/index') };
        // Download VS Code, unzip it and run the integration test
        await runTests(testOption);
    } catch (err) {
        console.error('Failed to run tests');
        process.exit(1);
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM