Skip to content

Commit

Permalink
Add a relevant global expect test
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmorand-sonarsource committed Mar 27, 2024
1 parent b5efd66 commit de6488c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
19 changes: 19 additions & 0 deletions packages/jsts/src/rules/S2699/assertion.fixture.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const vitest = require('vitest');

describe('global expect', () => { // Compliant
it('is recognized as an assertion', () => {
expect(5).toEqual(5);
});
});

describe('global non-supported symbol', () => { // Compliant
it('is not recognized as an assertion', () => { // Noncompliant
foo(5).toEqual(5);
});
});

describe.concurrent('expect called inside describe.concurrent scope', () => { // Compliant
it('is recognized as an assertion', async ({ expect }) => {
expect(5).toEqual(5);
});
});
10 changes: 0 additions & 10 deletions packages/jsts/src/rules/S2699/vitest.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,7 @@ describe('vitest test cases', () => {
check();
});

it('recognizes global expect as an assertion', () => {
expect(5).toEqual(5);
});

function check() {
expect(1).toEqual(2);
}
});

describe.concurrent('vitest concurrent test cases', () => {
it('recognizes global expect as an assertion', async ({ expect }) => {
expect(5).toEqual(5);
});
});

0 comments on commit de6488c

Please sign in to comment.