fix(core): update
This commit is contained in:
23
test/test.ts
23
test/test.ts
@ -1,6 +1,5 @@
|
||||
import { expect, tap } from 'tapbundle';
|
||||
import { expect, tap } from '@pushrocks/tapbundle';
|
||||
import * as logcontext from '../ts/index';
|
||||
import * as smartdelay from 'smartdelay';
|
||||
|
||||
let testLogger = new logcontext.Logger('testNamespace');
|
||||
|
||||
@ -13,10 +12,10 @@ tap.test('should log for .fatal()', async () => {
|
||||
});
|
||||
|
||||
// set up independent log context
|
||||
tap.testParallel('should create an async LogContext', async tools => {
|
||||
tap.testParallel('should create an async LogContext', async (tools) => {
|
||||
testLogger.scope(async () => {
|
||||
testLogger.logmap.addData('id1', {
|
||||
someData: 'someValue'
|
||||
someData: 'someValue',
|
||||
});
|
||||
await tools.delayFor(10).then(async () => {
|
||||
testLogger.log('hi');
|
||||
@ -28,27 +27,15 @@ tap.testParallel('should create an async LogContext', async tools => {
|
||||
tap.testParallel('should create a new scope', async () => {
|
||||
testLogger.scope(async () => {
|
||||
testLogger.logmap.addData('id1', {
|
||||
someData: 'otherValue'
|
||||
someData: 'otherValue',
|
||||
});
|
||||
testLogger.info('anything');
|
||||
});
|
||||
});
|
||||
|
||||
tap.test('should log within default scope', async tools => {
|
||||
tap.test('should log within default scope', async (tools) => {
|
||||
await tools.delayFor(3000);
|
||||
testLogger.log('message without context');
|
||||
});
|
||||
|
||||
tap.test('should not expose memory leak', async tools => {
|
||||
await tools.checkIterationLeak(async () => {
|
||||
testLogger.scope(() => {
|
||||
testLogger.addData(
|
||||
'someid',
|
||||
'wow this is an awesome string with a lot of text, so increases actually matter'
|
||||
);
|
||||
testLogger.log('hi');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
Reference in New Issue
Block a user