Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import { makeDefaultExo } from '@metamask/kernel-utils/exo';
import type { TestPowers } from '../test-powers.ts';
/**
* Build function for vats that will run various tests.
*
* @param vatPowers - Special powers granted to this vat.
* @param vatPowers.logger - The logger for the vat.
* @param parameters - Initialization parameters from the vat's config object.
* @param parameters.name - The name of the vat.
* @param _baggage - Root of vat's persistent state (not used here).
* @returns The root object for the new vat.
*/
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export function buildRootObject(
vatPowers: TestPowers,
parameters: { name?: string } = {},
_baggage: unknown = null,
) {
const name = parameters?.name ?? 'anonymous';
const logger = vatPowers.logger.subLogger({ tags: ['test'] });
return makeDefaultExo('root', {
bootstrap() {
// do nothing
},
foo() {
logger.log(`foo: ${name}`);
// eslint-disable-next-line no-console
console.log(`bar: ${name}`);
},
});
}
|