[英]Cant configure unit tests correctly with mocha
我正在嘗試在打字稿項目上配置Mocha,但不能正常工作我正在使用書:打字稿設計模式,第1章。
當我運行摩卡咖啡時,它說:
警告:找不到任何匹配模式的測試文件:out / test /未找到測試文件
摩卡
--require ./test/mocha.js
out/test/
mocha.js
require('chai').should();
starter.js
describe('some feature', () => {
it('should pass', () => {
'foo'.should.not.equal('bar');
});
it('should error', () => {
(() => {
throw new Error();
}).should.throw();
}); });
基於該錯誤,mocha似乎正在嘗試在/out
目錄中查找測試。 首先,嘗試從mocha.opts
刪除/out/test
或將其替換為src/test
以查看是否可以解決路徑問題。
您也可以嘗試將mocha.js
移至/src/test
目錄,然后將mocha.opts
移至/src
目錄。
然后,在運行mocha時,請確保您從項目的根目錄運行(在這種情況下,該目錄似乎是src
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.