簡體   English   中英

vscode-test - 調用 runTests 時出錯

[英]vscode-test - error when calling runTests

這是我第一次嘗試為我的 vscode 擴展設置測試。

我基本上只是從 code.visualstudio 復制粘貼 /working-with-extensions/testing-extension 中的示例。

由於以下錯誤,我無法調用 runTests:

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'.

這就是我的代碼:

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();

我找不到錯誤,如果有任何幫助,我將不勝感激。

目前正確的方法是:

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);
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM