Allow to use expect(value, "message").toBe(1) pattern.
📝 Note: TypeScript type information is required for accurate implementation.
Since ASTs may not contain type, only simple string literals and template literals are supported.
// variable is not allowed - it is limitation of current implemtation
const message = "message";
expect(value, message).toBe(1);
// non string types
expect(value, {}).toBe(1);
expect(value, []).toBe(1);
expect(value, 1).toBe(1);
Note
This feature is undocument yet, but vitest type definition define it.
Allow to use
expect(value, "message").toBe(1)
pattern.📝 Note: TypeScript type information is required for accurate implementation. Since ASTs may not contain type, only simple string literals and template literals are supported.
OK:
NG:
Note
This feature is undocument yet, but
vitest
type definition define it.Waiting until it is documented may be the right thing to do.
fix https://github.com/vitest-dev/eslint-plugin-vitest/issues/503