t.fixtureCtx Property

References the fixture context object. Each fixture has a fixture context object of its own. Store data within the fixture context object to share information between fixture hooks and the content of the fixture.

t.fixtureCtx → Object
fixture`TestController.fixtureCtx`
    .before(async ctx => {
        ctx.someProp = 123;
    })
    .after(async ctx => {
        if (ctx.someProp !== 123)
            throw new Error('Incorrect value of the context!');
    });

You cannot redefine the t.fixtureCtx object. However, you can define the object’s properties and add new properties to the object.

fixture`TestController.fixtureCtx`
    .before(async ctx => {
        ctx.someProp = 123;
    })
    .after(async ctx => {
        if (ctx.newProp !== 'abc')
            throw new Error('Incorrect value of the context!');
    });

test('Check the value of the context', async t => {
    await t.expect(t.fixtureCtx.someProp).eql(123);
});

test('Assignment the new value in the context', async t => {
    t.fixtureCtx.newProp = 'abc';
});