How to assert not null?
问题 I'm very new in javascript testing, I would like to know how to assert not null in Mocha framework. 回答1: Mocha supports any assertion library you want. You can take a look at how it deals with assertions here: http://mochajs.org/#assertions. I don't know which one you want to use. Considering you are using Chai, which is pretty popular, here are some options: Consider "foo" to be the target variable you want to test Assert var assert = chai.assert; assert(foo) // will pass for any truthy