JavaScript Standard Style does not recognize Mocha

后端 未结 6 594
囚心锁ツ
囚心锁ツ 2020-12-23 15:35

I have a Mocha test file that looks like this:

var expect = require(\'chai\').expect
var muting = require(\'../muting\')

describe(\'muting\', function () {
         


        
6条回答
  •  我在风中等你
    2020-12-23 16:17

    As pointed out by Nick Tomlin you just need to declare globals.

    I use to put it in the command line, since I have different globals for tests as for sources or different parts of the project.

    For tests we should use

    standard --global describe --global it test/
    

    elsewhere in my project I want to lint code that uses jQuery so I use

    standard --global $ src/client/
    

    Bonus tip

    If you are using vim with Syntastic you maybe want to add to your .vimrc

    let b:syntastic_checkers = ['standard']
    let g:syntastic_javascript_standard_args = "--global $ --global it --global describe"
    

提交回复
热议问题