我test/
的项目充满了摩卡测试:
test/
├── a.coffee
└── b.coffee
说a.coffee
是
console.log 'Executing A test!'
global.foo = 'FOO'
并且b.coffee
是
console.log 'Executing B test!'
console.log 'Expecting foo not defined:', assert.equal(foo, undefined)
执行 mocha 时:
$ mocha --compilers coffee:coffee-script test/*
Executing A test!
Executing B test!
Expecting foo not defined: false
看起来测试共享相同的全局对象(我想避免)......
有没有办法单独执行每个测试?
谢谢你。