Add better control over substreams.

This commit is contained in:
Dermot Duffy
2023-05-06 10:42:17 -07:00
parent fd74c1c855
commit 867a118a16
9 changed files with 405 additions and 26 deletions
+15
View File
@@ -0,0 +1,15 @@
import { describe, expect, it, vi } from 'vitest';
import { log } from '../../src/utils/debug.js';
describe('log', () => {
it('should do nothing without debug logging set', () => {
const spy = vi.spyOn(global.console, 'debug');
log({}, 'foo');
expect(spy).not.toBeCalled();
});
it('should log debug when appropriately configured', () => {
const spy = vi.spyOn(global.console, 'debug');
log({ debug: { logging: true } }, 'foo');
expect(spy).toBeCalledWith('foo');
});
});