这是我第一次尝试为我的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();
我找不到错误,感谢您的帮助。
答案 0 :(得分:0)
正确的方法是currently:
http.MultipartRequest imageUploadRequest = http.MultipartRequest('POST', Uri.parse(BASE_URL));
imageUploadRequest.headers["Authorization"] = "bearer ${token}";
imageUploadRequest.fields['FileName'] = "Test";
final file = await http.MultipartFile.fromPath('file', image.path);
imageUploadRequest.files.add(file);
final streamedResponse = await imageUploadRequest.send();
print("streamedResponse.statusCode : ${streamedResponse.statusCode}");
// Log-> streamedResponse.statusCode : 307
print("streamedResponse.headers : ${streamedResponse.headers}");
// Log-> streamedResponse.headers : streamedResponse.headers : {x-powered-by: ASP.NET, location: https://api.test.me/image, date: Sat, 23 Nov 2019 05:01:48 GMT, transfer-encoding: chunked, server: Microsoft-IIS/10.0}
final MapString, dynamic responseData = json.decode(response.body);
print("statusCode : ${response.statusCode}");
// Log-> statusCode : 307
print("headers : ${response.headers}");
// Log-> headers : streamedResponse.headers : {x-powered-by: ASP.NET, location: https://api.test.me/image, date: Sat, 23 Nov 2019 05:01:48 GMT, transfer-encoding: chunked, server: Microsoft-IIS/10.0}