根据对话https://medium.com/p/b06559b35459/info,
当我试着
import `{describe, it} from '@types/mocha'我明白了
Error:-
/node_modules/@types/mocha/index.d.ts' is not a module根据serenity-js项目中的示例:- serenity-js/examples/todomvc-protractor-mocha
serenity: {
dialect: 'mocha',
crew: [
crew.serenityBDDReporter(),
crew.consoleReporter(),
crew.Photographer.who(_ => _
.takesPhotosOf(_.Tasks_and_Interactions)
.takesPhotosWhen(_.Activity_Finishes)
)
]
},当添加到主分支protractor.conf.js中时,它不会拾取特征文件。https://github.com/serenity-js/tutorial-from-scripts-to-serenity.git
你能让我知道如何在项目中使用mocha吗?
发布于 2017-04-19 01:18:30
Mocha's describe和it函数在global scope和@types/mocha definitions reflect that中定义。这意味着您不需要显式地导入它们,因为只要安装了@types/mocha依赖项,TypeScript编译器就可以使用这些定义:
默认情况下,所有可见的
“@types”包都包含在编译中。任何封闭文件夹的node_modules/@types中的包都被认为是可见的;具体地说,这意味着./node_modules/@types/、../node_modules/@types/、../../node_modules/@types/等中的包。
请注意,在Serenity/JS Handbook中描述了如何将Serenity/JS与Mocha结合使用。
您可能还会发现example project很有用。
https://stackoverflow.com/questions/43469708
复制相似问题