gpt4 book ai didi

typescript - vscode-test - 调用 runTests 时出错

转载 作者:行者123 更新时间:2023-11-28 20:13:02 25 4
gpt4 key购买 nike

这是我第一次尝试为我的 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();

我找不到错误,如果有任何帮助,我将不胜感激。

最佳答案

正确的方法是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);
}
}

关于typescript - vscode-test - 调用 runTests 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58605801/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com