Skip to content

Commit 88b1be3

Browse files
rusackasclaude
andcommitted
chore(tests): Add TODO markers to existing describe blocks and enforce error on new ones
- Changed no-restricted-globals rule from 'warn' to 'error' for describe/it - Added eslint-disable comments with TODO markers on all existing describe blocks - This allows existing code to work while preventing new describe blocks - Updated 243 test files with 1,080 describe blocks The TODO markers make it clear these are legacy patterns that should be migrated over time, while the error rule prevents new code from using describe blocks. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a095dc7 commit 88b1be3

File tree

244 files changed

+458
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+458
-1
lines changed

superset-frontend/src/.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"files": ["*.test.ts", "*.test.tsx", "*.test.js", "*.test.jsx"],
55
"rules": {
66
"jest/consistent-test-it": ["error", {"fn": "test"}],
7-
"no-restricted-globals": ["warn", "describe", "it"]
7+
"no-restricted-globals": ["error", "describe", "it"]
88
}
99
}
1010
]

superset-frontend/src/SqlLab/actions/sqlLab.test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jest.mock('@superset-ui/core', () => ({
4949
isFeatureEnabled: jest.fn(),
5050
}));
5151

52+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
5253
describe('getUpToDateQuery', () => {
5354
test('should return the up to date query editor state', () => {
5455
const outOfUpdatedQueryEditor = {
@@ -72,6 +73,7 @@ describe('getUpToDateQuery', () => {
7273
});
7374
});
7475

76+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
7577
describe('async actions', () => {
7678
const mockBigNumber = '9223372036854775807';
7779
const queryEditor = {
@@ -100,6 +102,7 @@ describe('async actions', () => {
100102
const runQueryEndpoint = 'glob:*/api/v1/sqllab/execute/';
101103
fetchMock.post(runQueryEndpoint, `{ "data": ${mockBigNumber} }`);
102104

105+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
103106
describe('saveQuery', () => {
104107
const saveQueryEndpoint = 'glob:*/api/v1/saved_query/';
105108
fetchMock.post(saveQueryEndpoint, { results: { json: {} } });
@@ -163,6 +166,7 @@ describe('async actions', () => {
163166
});
164167
});
165168

169+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
166170
describe('formatQuery', () => {
167171
const formatQueryEndpoint = 'glob:*/api/v1/sqllab/format_sql/';
168172
const expectedSql = 'SELECT 1';
@@ -179,6 +183,7 @@ describe('async actions', () => {
179183
});
180184
});
181185

186+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
182187
describe('fetchQueryResults', () => {
183188
const makeRequest = () => {
184189
const store = mockStore(initialState);
@@ -248,6 +253,7 @@ describe('async actions', () => {
248253
});
249254
});
250255

256+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
251257
describe('runQuery without query params', () => {
252258
const makeRequest = () => {
253259
const request = actions.runQuery(query);
@@ -324,6 +330,7 @@ describe('async actions', () => {
324330
});
325331
});
326332

333+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
327334
describe('runQuery with query params', () => {
328335
const { location } = window;
329336

@@ -355,6 +362,7 @@ describe('async actions', () => {
355362
});
356363
});
357364

365+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
358366
describe('reRunQuery', () => {
359367
test('creates new query with a new id', () => {
360368
const id = 'id';
@@ -372,6 +380,7 @@ describe('async actions', () => {
372380
});
373381
});
374382

383+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
375384
describe('postStopQuery', () => {
376385
const stopQueryEndpoint = 'glob:*/api/v1/query/stop';
377386
fetchMock.post(stopQueryEndpoint, {});
@@ -412,6 +421,7 @@ describe('async actions', () => {
412421
});
413422
});
414423

424+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
415425
describe('cloneQueryToNewTab', () => {
416426
test('creates new query editor', () => {
417427
expect.assertions(1);
@@ -455,6 +465,7 @@ describe('async actions', () => {
455465
});
456466
});
457467

468+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
458469
describe('popSavedQuery', () => {
459470
const supersetClientGetSpy = jest.spyOn(SupersetClient, 'get');
460471
const store = mockStore({});
@@ -561,6 +572,7 @@ describe('async actions', () => {
561572
});
562573
});
563574

575+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
564576
describe('addQueryEditor', () => {
565577
test('creates new query editor', () => {
566578
expect.assertions(1);
@@ -582,6 +594,7 @@ describe('async actions', () => {
582594
expect(store.getActions()).toEqual(expectedActions);
583595
});
584596

597+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
585598
describe('addNewQueryEditor', () => {
586599
test('creates new query editor with new tab name', () => {
587600
const store = mockStore({
@@ -636,6 +649,7 @@ describe('async actions', () => {
636649
expect(store.getActions()).toEqual(expectedActions);
637650
});
638651

652+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
639653
describe('swithQueryEditor', () => {
640654
test('switch to the next tab editor', () => {
641655
const store = mockStore(initialState);
@@ -715,6 +729,7 @@ describe('async actions', () => {
715729
});
716730
});
717731

732+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
718733
describe('backend sync', () => {
719734
const updateTabStateEndpoint = 'glob:*/tabstateview/*';
720735
fetchMock.put(updateTabStateEndpoint, {});
@@ -745,6 +760,7 @@ describe('async actions', () => {
745760

746761
afterEach(() => fetchMock.resetHistory());
747762

763+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
748764
describe('addQueryEditor', () => {
749765
test('creates the tab state in the local storage', () => {
750766
expect.assertions(2);
@@ -769,6 +785,7 @@ describe('async actions', () => {
769785
});
770786
});
771787

788+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
772789
describe('removeQueryEditor', () => {
773790
test('updates the tab state in the backend', () => {
774791
expect.assertions(1);
@@ -785,6 +802,7 @@ describe('async actions', () => {
785802
});
786803
});
787804

805+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
788806
describe('queryEditorSetDb', () => {
789807
test('updates the tab state in the backend', () => {
790808
expect.assertions(1);
@@ -803,6 +821,7 @@ describe('async actions', () => {
803821
});
804822
});
805823

824+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
806825
describe('queryEditorSetCatalog', () => {
807826
test('updates the tab state in the backend', () => {
808827
expect.assertions(1);
@@ -821,6 +840,7 @@ describe('async actions', () => {
821840
});
822841
});
823842

843+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
824844
describe('queryEditorSetSchema', () => {
825845
test('updates the tab state in the backend', () => {
826846
expect.assertions(1);
@@ -839,6 +859,7 @@ describe('async actions', () => {
839859
});
840860
});
841861

862+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
842863
describe('queryEditorSetAutorun', () => {
843864
test('updates the tab state in the backend', () => {
844865
expect.assertions(1);
@@ -857,6 +878,7 @@ describe('async actions', () => {
857878
});
858879
});
859880

881+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
860882
describe('queryEditorSetTitle', () => {
861883
test('updates the tab state in the backend', () => {
862884
expect.assertions(1);
@@ -877,6 +899,7 @@ describe('async actions', () => {
877899
});
878900
});
879901

902+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
880903
describe('queryEditorSetAndSaveSql', () => {
881904
const sql = 'SELECT * ';
882905
const expectedActions = [
@@ -886,6 +909,7 @@ describe('async actions', () => {
886909
sql,
887910
},
888911
];
912+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
889913
describe('with backend persistence flag on', () => {
890914
test('updates the tab state in the backend', () => {
891915
expect.assertions(2);
@@ -904,6 +928,7 @@ describe('async actions', () => {
904928
});
905929
});
906930
});
931+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
907932
describe('with backend persistence flag off', () => {
908933
test('does not update the tab state in the backend', () => {
909934
isFeatureEnabled.mockImplementation(
@@ -927,6 +952,7 @@ describe('async actions', () => {
927952
});
928953
});
929954

955+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
930956
describe('queryEditorSetQueryLimit', () => {
931957
test('updates the tab state in the backend', () => {
932958
expect.assertions(1);
@@ -947,6 +973,7 @@ describe('async actions', () => {
947973
});
948974
});
949975

976+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
950977
describe('queryEditorSetTemplateParams', () => {
951978
test('updates the tab state in the backend', () => {
952979
expect.assertions(1);
@@ -968,6 +995,7 @@ describe('async actions', () => {
968995
});
969996
});
970997

998+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
971999
describe('addTable', () => {
9721000
test('dispatches table state from unsaved change', () => {
9731001
const tableName = 'table';
@@ -1083,6 +1111,7 @@ describe('async actions', () => {
10831111
});
10841112
});
10851113

1114+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
10861115
describe('syncTable', () => {
10871116
test('updates the table schema state in the backend', () => {
10881117
expect.assertions(4);
@@ -1107,6 +1136,7 @@ describe('async actions', () => {
11071136
});
11081137
});
11091138

1139+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
11101140
describe('runTablePreviewQuery', () => {
11111141
const results = {
11121142
data: mockBigNumber,
@@ -1186,6 +1216,7 @@ describe('async actions', () => {
11861216
});
11871217
});
11881218

1219+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
11891220
describe('expandTable', () => {
11901221
test('updates the table schema state in the backend', () => {
11911222
expect.assertions(2);
@@ -1205,6 +1236,7 @@ describe('async actions', () => {
12051236
});
12061237
});
12071238

1239+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
12081240
describe('collapseTable', () => {
12091241
test('updates the table schema state in the backend', () => {
12101242
expect.assertions(2);
@@ -1224,6 +1256,7 @@ describe('async actions', () => {
12241256
});
12251257
});
12261258

1259+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
12271260
describe('removeTables', () => {
12281261
test('updates the table schema state in the backend', () => {
12291262
expect.assertions(2);
@@ -1280,6 +1313,7 @@ describe('async actions', () => {
12801313
});
12811314
});
12821315

1316+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
12831317
describe('syncQueryEditor', () => {
12841318
test('updates the tab state in the backend', () => {
12851319
expect.assertions(3);

superset-frontend/src/SqlLab/components/AceEditorWrapper/AceEditorWrapper.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const setup = (queryEditor: QueryEditor, store?: Store) =>
6868
},
6969
);
7070

71+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
7172
describe('AceEditorWrapper', () => {
7273
beforeEach(() => {
7374
(FullSQLEditor as any as jest.Mock).mockClear();

superset-frontend/src/SqlLab/components/App/App.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const sqlLabReducer = combineReducers({
4747
});
4848
const mockAction = {} as AnyAction;
4949

50+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
5051
describe('SqlLab App', () => {
5152
const middlewares = [thunk];
5253
const mockStore = configureStore(middlewares);

superset-frontend/src/SqlLab/components/ColumnElement/ColumnElement.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { render } from 'spec/helpers/testing-library';
2121
import ColumnElement from 'src/SqlLab/components/ColumnElement';
2222
import { mockedActions, table } from 'src/SqlLab/fixtures';
2323

24+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
2425
describe('ColumnElement', () => {
2526
const mockedProps = {
2627
actions: mockedActions,

superset-frontend/src/SqlLab/components/EstimateQueryCostButton/EstimateQueryCostButton.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const setup = (props: Partial<EstimateQueryCostButtonProps>, store?: Store) =>
5353
},
5454
);
5555

56+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
5657
describe('EstimateQueryCostButton', () => {
5758
test('renders EstimateQueryCostButton', async () => {
5859
const { queryByText } = setup({}, mockStore(initialState));

superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/ExploreCtasResultsButton.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const setup = (props: Partial<ExploreCtasResultsButtonProps>, store?: Store) =>
4747
},
4848
);
4949

50+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
5051
describe('ExploreCtasResultsButton', () => {
5152
const postFormSpy = jest.spyOn(SupersetClientClass.prototype, 'postForm');
5253
postFormSpy.mockImplementation(jest.fn());

superset-frontend/src/SqlLab/components/ExploreResultsButton/ExploreResultsButton.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const setup = (
3131
useRedux: true,
3232
});
3333

34+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
3435
describe('ExploreResultsButton', () => {
3536
test('renders', async () => {
3637
const { queryByText } = setup(jest.fn(), {

superset-frontend/src/SqlLab/components/QueryAutoRefresh/QueryAutoRefresh.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const mockState = {
4343
databases: mockDatabases,
4444
};
4545

46+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
4647
describe('QueryAutoRefresh', () => {
4748
const runningQueries: QueryDictionary = { [runningQuery.id]: runningQuery };
4849
const successfulQueries: QueryDictionary = {

superset-frontend/src/SqlLab/components/QueryLimitSelect/QueryLimitSelect.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const setup = (props?: Partial<QueryLimitSelectProps>, store?: Store) =>
5858
},
5959
);
6060

61+
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
6162
describe('QueryLimitSelect', () => {
6263
test('renders current query limit size', () => {
6364
const queryLimit = 10;

0 commit comments

Comments
 (0)