-
-
Notifications
You must be signed in to change notification settings - Fork 721
Labels
A-linterArea - LinterArea - Linter
Description
What version of Oxlint are you using?
1.10.0
What command did you run?
oxlint
What does your .oxlintrc.json config file look like?
A minimum reproducible config to see the false positive:
What happened?
After updating to 1.10.0, the following test triggers the expect-expect rule, reporting that the test has no assertions:
it('example test', async () => {
await Promise.all([
expect(
new Promise((resolve) => {
resolve(1);
})
).resolves.toBe(1),
expect(
new Promise((_, reject) => {
reject(new Error('Failed'));
})
).rejects.toThrowError('Failed'),
]);
});However, the test clearly contains two assertions. In previous version 1.9.0 this code did not produce any errors. So it seems like this could be a regression or a change in how the rule interprets assertions.
For comparison, this version has no issue:
it('example test', async () => {
await expect(
new Promise((resolve) => {
resolve(1);
})
).resolves.toBe(1);
await expect(
new Promise((_, reject) => {
reject(new Error('Failed'));
})
).rejects.toThrowError('Failed');
});I think both versions are valid tests, at least they pass without problems and behave identically in terms of assertions. I understand the first version may be more difficult to analyze statically, but since it worked previously, I'm wondering if this is an unintentional regression in 1.10.0
Metadata
Metadata
Assignees
Labels
A-linterArea - LinterArea - Linter