The message property in t.throws is really ergonomic - it can be a string, RegExp, or even a function. t.like should be just as ergonomic with strings:
const output = foo();
t.like(output, {
name: 'foo',
source: /foo comes from/,
});
A motivating example is trying to convert this test from npm-user to use t.like:
const user = await npmUser('sindresorhus');
t.like(user, {
name: 'Sindre Sorhus',
avatar: /npm-avatar/,
email: 'sindresorhus@gmail.com',
});
The
messageproperty int.throwsis really ergonomic - it can be astring,RegExp, or even a function.t.likeshould be just as ergonomic with strings:A motivating example is trying to convert this test from
npm-userto uset.like: