简体   繁体   English

vscode-test - 调用 runTests 时出错

[英]vscode-test - error when calling runTests

Its the first time im trying to set up tests for my vscode extension.这是我第一次尝试为我的 vscode 扩展设置测试。

I basically just copy pasted the example from /working-with-extensions/testing-extension from code.visualstudio.我基本上只是从 code.visualstudio 复制粘贴 /working-with-extensions/testing-extension 中的示例。

I can't call runTests because of the following error:由于以下错误,我无法调用 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'.

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 vscode-test 设置中的 runTest.ts 类即使在示例项目中也从未使用过,它有什么用? - runTest.ts class in vscode-test setup gets never used even in example project, what is it's use? 不在默认的“/test”文件夹中时使用带有 VScode 的 Mocha 测试资源管理器 - Using Mocha Test Explorer with VScode when not in default `/test' folder 创建 vscode 扩展时忽略无效证书的 axios 错误 - Ignoring axios error for invalid certificates when creating a vscode extension vscode 在使用 satisfies 关键字时显示错误消息 - vscode shows an error message when `satisfies` keyword is used 从父级调用时出现Typescript错误未定义 - Typescript Error undefined when calling from parent 使用 npm 和 package.json 脚本启动测试时,VSCode 不会在断点处停止 - VSCode not stopping at breakpoints when test launched using npm and package.json scripts 调用vscode Extension以从Webview获取数据 - Calling vscode Extension for data from webview Angular 10:使用绝对路径导入时 VSCode 显示错误 - Angular 10: VSCode show error when import with absolute path Angular 10:导入时路径映射在 VSCode 中显示错误 - Angular 10: Path Mapping shows error in VSCode when import vscode-jest 插件在测试明显失败时显示成功 - vscode-jest plugin shows success when the test should clearly fail
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM