fava
Version:
A wannabe tiny largely-drop-in replacement for ava that works in the browser too.
25 lines (24 loc) • 742 B
JavaScript
/* IMPORT */
import Executor from './executor.js';
import Factory from './factory.js';
/* MAIN */
// The Register singleton registers new Tester(s), Describer(s) and Suiter(s)
class Register {
constructor() {
/* API */
this.describer = (describer, implementation) => {
const suiter = Executor.get();
suiter.registerDescriber(describer, implementation);
};
this.suiter = (suiter, implementation) => {
Executor.set(suiter);
implementation(Factory.makeDescribe());
};
this.tester = (tester) => {
const suiter = Executor.get();
suiter.registerTester(tester);
};
}
}
/* EXPORT */
export default new Register();