It seems like your error refers to another line of code. Anyway, in order to add a custom message to expect statement you should use:
await expect(page.getByText('Name'), 'should be logged in').toBeVisible();
as you can see in their official documentation here