@@ -12,6 +12,8 @@ const ruleTester = new TSESLint.RuleTester({
12
12
13
13
ruleTester . run ( 'no-standalone-expect' , rule , {
14
14
valid : [
15
+ 'expect.any(String)' ,
16
+ 'expect.extend({})' ,
15
17
'describe("a test", () => { it("an it", () => {expect(1).toBe(1); }); });' ,
16
18
'describe("a test", () => { it("an it", () => { const func = () => { expect(1).toBe(1); }; }); });' ,
17
19
'describe("a test", () => { const func = () => { expect(1).toBe(1); }; });' ,
@@ -65,6 +67,10 @@ ruleTester.run('no-standalone-expect', rule, {
65
67
code : 'expect.hasAssertions()' ,
66
68
errors : [ { endColumn : 23 , column : 1 , messageId : 'unexpectedExpect' } ] ,
67
69
} ,
70
+ {
71
+ code : 'expect().hasAssertions()' ,
72
+ errors : [ { endColumn : 25 , column : 1 , messageId : 'unexpectedExpect' } ] ,
73
+ } ,
68
74
{
69
75
code : dedent `
70
76
describe('scenario', () => {
@@ -163,5 +169,14 @@ ruleTester.run('no-standalone-expect', rule, {
163
169
parserOptions : { sourceType : 'module' } ,
164
170
errors : [ { endColumn : 51 , column : 28 , messageId : 'unexpectedExpect' } ] ,
165
171
} ,
172
+ {
173
+ code : dedent `
174
+ import { expect as pleaseExpect } from '@jest/globals';
175
+
176
+ beforeEach(() => pleaseExpect.hasAssertions());
177
+ ` ,
178
+ parserOptions : { sourceType : 'module' } ,
179
+ errors : [ { endColumn : 46 , column : 18 , messageId : 'unexpectedExpect' } ] ,
180
+ } ,
166
181
] ,
167
182
} ) ;
0 commit comments