my node project's boilerplate. support in-source testing.
nr dev
watchsrc/index.ts
nr test
run vitestnr test:watch
run vitest with watch modenr test:coverage
show test coveragenr build
create build filenr preview
exec build file
const sub =
(x: number) =>
(y: number): number =>
x - y;
const div =
(x: number) =>
(y: number): number =>
x / y;
const goodbye = () => {
return {
baz: 'a disruption and blinder',
qux: 'mn..',
};
};
if (import.meta.vitest) {
const { assert, describe, it, expect } = import.meta.vitest;
describe('calc', () => {
it('sub', () => {
expect(sub(2)(1)).eq(1);
});
it('div', () => {
expect(div(2)(1)).eq(2);
});
it('goodbye', () => {
const actual = goodbye();
assert.deepEqual(actual, {
baz: 'a disruption and blinder',
qux: 'mn..',
});
});
});
}