【发布时间】:2021-01-02 10:05:19
【问题描述】:
我正在关注webdriver io typescript instructions
Object literal may only specify known properties, and 'mochaOpts' does not exist in type 'Config'.
这是由于wdio.conf.ts 包括mochaOpts 以下:
import { Config } from "webdriverio";
const config: Config = {
//...
//
// Options to be passed to Mocha.
// See the full list at http://mochajs.org/
mochaOpts: {
ui: "bdd",
timeout: 60000,
},
//...
};
export { config };
有谁知道如何解决这个问题?
【问题讨论】:
-
您能分享一下您的打字稿设置吗?我看到你在第一行使用导入,这对我不起作用
SyntaxError: Cannot use import statement outside a module -
@Stevy 不知道这是否是正确的做法,但这就是我所拥有的 - ``` { "compileOnSave": false, "compilerOptions": { "target": "ES2020" , "module": "commonjs", "moduleResolution": "node", "strict": true, // NB expect-webdriverio 似乎有助于解决 intellij 视图问题,// 但仍然无法在 intellij 中运行测试不推荐在 docs "types": ["node", "webdriverio/sync", "expect-webdriverio", "@wdio/mocha-framework"] }, "include": ["./test/**/ **.ts", "./wdio.conf.ts" ] } ```
标签: typescript mocha.js webdriver-io