fava
Version:
A wannabe tiny largely-drop-in replacement for ava that works in the browser too.
31 lines (30 loc) • 817 B
JavaScript
/* IMPORT */
/* MAIN */
// This class contains option-methods to be chained to functions
class Flags {
constructor() {
/* VARIABLES */
this.flags = {
failing: false,
only: false,
serial: false,
skip: false,
todo: false
};
/* PRIVATE API */
this.makeFlagSetter = (flag) => {
return () => {
this.flags[flag] = true;
return this;
};
};
/* API */
this.failing = this.makeFlagSetter('failing');
this.only = this.makeFlagSetter('only');
this.serial = this.makeFlagSetter('serial');
this.skip = this.makeFlagSetter('skip');
this.todo = this.makeFlagSetter('todo');
}
}
/* EXPORT */
export default Flags;