簡體   English   中英

使用Mocha ExpressJS運行測試的命令是什么

[英]What is the command for running the test with mocha expressjs

我的測試文件

describe('a basic test',function(){
    it('it should pass when everything is okay',function(){
        console.log('hi')
    })
})

我的測試結果與命令“摩卡”

hi
․

  1 passing (9ms)

但是我如何獲得如下結果,

a basic test
it should pass when everything is okay
 hi  

以勾號表示成功,任何人都可以幫助我。

Mocha的默認報告者是spec ,它會spec輸出報告:

  a basic test
hi
    ✓ it should pass when everything is okay


  1 passing (6ms)

所以問題是,為什么Mocha在您的情況下不使用默認的報告器(而是使用dot )。 造成這種情況的最可能原因是,您有一個名為./test/mocha.opts的文件,其中包含以下行:

--reporter dot

如果您不想將dot作為默認值,只需刪除該行即可。 如果您希望將dot設置為默認值,但偶爾要覆蓋它,請在命令行中傳遞另一個報告程序:

mocha --reporter spec
# or shorter:
mocha -R spec

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM