I'm working on unit tests for my CLI Project based on JS library https://github.com/tj/commander.js
I'm trying to override few variables to check function which is printing help information.
I need to create a new instance of Command and set variables _alias, _name, _description
and options
I have:
import program from 'commander';
describe('test', function() {
before(function() {
new program.Command();
program.Command.prototype._alias = 'testAlias';
program.Command.prototype._name = 'testName';
program.Command.prototype._description = 'testDescription';
});
it('first test', function() {
console.log(program);
});
});
and I'm receiving an "old" instance with not updated variables.