jeudi 5 mars 2015

Accessing module's local var

For testing reasons, is there a way to access a module's local variable?



module m {
var i = 0;
export function go() {
++i;
}
}

m.go();
expect(m["i"]).toBe(1); // m["i"] is undefined


[That is - is it possible to access a javascript function's local var?]


Ofcourse I can export it, or make it static and wrap it in a class, but I'm looking for something cleaner.


Aucun commentaire:

Enregistrer un commentaire