How do I use Chai to verify that some variable does not exist?
That is to say, my js doesn't have a statement var never_declared, and I want to verify that there isn't any such variable.
I have tried all of following, but Karma keeps complaining "Can't find variable: never_declared". Which is exactly what I'm trying to test.
should.not.exist(never_declared);
expect(never_declared).to.not.exist;
expect(never_declared).to.not.exist;
expect(never_declared).to.be.undefined;
expect(never_declared).to.be.an('undefined');
assert.isNotObject(never_declared);
assert.isUndefined(never_declared);
Aucun commentaire:
Enregistrer un commentaire