Skip to content

Commit

Permalink
fixup! wrap t.log in causal console
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Feb 29, 2024
1 parent a1abaa6 commit caf11d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
8 changes: 6 additions & 2 deletions packages/ses-ava/src/ses-ava-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'ses';
import { loggedErrorHandler, makeCausalConsole } from 'ses/console-tools.js';

const { stringify } = JSON;
const { defineProperty, freeze } = Object;
Expand Down Expand Up @@ -91,8 +92,11 @@ const getLogger = (tlogger, loggerOrOptions) => {
} else if (typeof loggerOrOptions === 'object') {
const { tlog } = loggerOrOptions;
if (tlog) {
// TODO wrap with SES causal console
return tlogger;
const baseConsole = harden({
error: tlogger,
});
const causalConsole = makeCausalConsole(baseConsole, loggedErrorHandler);
return causalConsole.error;
} else {
// Without causal console wrapper
return tlogger;
Expand Down
14 changes: 7 additions & 7 deletions packages/ses-ava/test/test-ses-ava-reject.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ test('ses-ava reject console output', t => {
t.assert(true);
// Uncomment this to see something like the text in the extended comment below

// return Promise.resolve(null)
// .then(v => v)
// .then(v => v)
// .then(_ => {
// assert.typeof(88, 'string', assert.details`msg ${'NOTICE ME'}`);
// });
});
// return Promise.resolve(null)
// .then(v => v)
// .then(v => v)
// .then(_ => {
// assert.typeof(88, 'string', assert.details`msg ${'NOTICE ME'}`);
// });
// });

/*
Uncommenting the test code above should produce something like the following.
Expand Down

0 comments on commit caf11d6

Please sign in to comment.