@@ -104,6 +104,60 @@ ruleTester.run('prefer-importing-jest-globals', rule, {
104104 } ,
105105 ] ,
106106 } ,
107+ {
108+ code : dedent `
109+ import { describe as context } from '@jest/globals';
110+ context("suite", () => {
111+ test("foo");
112+ expect(true).toBeDefined();
113+ })
114+ ` ,
115+ output : dedent `
116+ import { describe as context, expect, test } from '@jest/globals';
117+ context("suite", () => {
118+ test("foo");
119+ expect(true).toBeDefined();
120+ })
121+ ` ,
122+ parserOptions : { sourceType : 'module' } ,
123+ errors : [
124+ {
125+ endColumn : 7 ,
126+ column : 3 ,
127+ line : 3 ,
128+ messageId : 'preferImportingJestGlobal' ,
129+ } ,
130+ ] ,
131+ } ,
132+ {
133+ code : dedent `
134+ import { describe as context } from '@jest/globals';
135+ describe("something", () => {
136+ context("suite", () => {
137+ test("foo");
138+ expect(true).toBeDefined();
139+ })
140+ })
141+ ` ,
142+ output : dedent `
143+ import { describe, describe as context, expect, test } from '@jest/globals';
144+ describe("something", () => {
145+ context("suite", () => {
146+ test("foo");
147+ expect(true).toBeDefined();
148+ })
149+ })
150+ ` ,
151+ parserOptions : { sourceType : 'module' } ,
152+ errors : [
153+ {
154+ endColumn : 9 ,
155+ column : 1 ,
156+ line : 2 ,
157+ messageId : 'preferImportingJestGlobal' ,
158+ } ,
159+ ] ,
160+ } ,
107161 {
108162 code : dedent `
109163 jest.useFakeTimers();
0 commit comments