diff --git a/.eslintrc.yml b/.eslintrc.yml index fc46ef3a06433c05c5e60649eca96209fe837812..0b242e4cb9401cf83996e1f55029d91c87639518 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -135,6 +135,7 @@ overrides: rules: '@gitlab/require-i18n-strings': off '@gitlab/no-runtime-template-compiler': off + 'require-await': error 'import/no-dynamic-require': off 'no-import-assign': off 'no-restricted-syntax': diff --git a/ee/spec/frontend/ai/components/ai_genie_spec.js b/ee/spec/frontend/ai/components/ai_genie_spec.js index a704e4888a00c25cba5d3b53492650d0d72b1fdf..77098e711a84203014d1d46942bd9355286b0113 100644 --- a/ee/spec/frontend/ai/components/ai_genie_spec.js +++ b/ee/spec/frontend/ai/components/ai_genie_spec.js @@ -106,7 +106,7 @@ describe('AiGenie', () => { }; const requestExplanation = async () => { - findButton().vm.$emit('click'); + await findButton().vm.$emit('click'); }; beforeEach(() => { diff --git a/ee/spec/frontend/dora/components/deployment_frequency_charts_spec.js b/ee/spec/frontend/dora/components/deployment_frequency_charts_spec.js index d0781a0ff7a91c75fa9c5f69ed413728b7eb82c1..f7c277026b524c8a34b50e922d93ad007208cf4d 100644 --- a/ee/spec/frontend/dora/components/deployment_frequency_charts_spec.js +++ b/ee/spec/frontend/dora/components/deployment_frequency_charts_spec.js @@ -332,16 +332,13 @@ describe('deployment_frequency_charts.vue', () => { ${'Last month'} | ${1} | ${mockLastMonthData} ${'Last 90 days'} | ${2} | ${mockLast90DaysData} ${'Last 180 days'} | ${3} | ${mockLast180DaysData} - `( - 'does not calculate a forecast for $timePeriod by default', - async ({ chartDataIndex, result }) => { - const currentTimePeriodChartData = getChartData()[chartDataIndex]; - const dataSeries = currentTimePeriodChartData.data[0]; - - expect(currentTimePeriodChartData.data).toHaveLength(2); - expect(dataSeries.data).toEqual(result); - }, - ); + `('does not calculate a forecast for $timePeriod by default', ({ chartDataIndex, result }) => { + const currentTimePeriodChartData = getChartData()[chartDataIndex]; + const dataSeries = currentTimePeriodChartData.data[0]; + + expect(currentTimePeriodChartData.data).toHaveLength(2); + expect(dataSeries.data).toEqual(result); + }); describe('Show forecast toggle', () => { afterEach(() => { diff --git a/ee/spec/frontend/related_items_tree/components/create_epic_form_spec.js b/ee/spec/frontend/related_items_tree/components/create_epic_form_spec.js index 1165f7391c523bb4bb1b849d71be2356646fcd93..6b056387af14804f807a27e13be1819b53245565 100644 --- a/ee/spec/frontend/related_items_tree/components/create_epic_form_spec.js +++ b/ee/spec/frontend/related_items_tree/components/create_epic_form_spec.js @@ -71,7 +71,7 @@ describe('RelatedItemsTree', () => { }); describe('buttonLabel', () => { - it('returns string "Creating epic" when `isSubmitting` prop is true', async () => { + it('returns string "Creating epic" when `isSubmitting` prop is true', () => { createComponent(true); expect(findSubmitButton().text()).toBe('Creating epic'); }); @@ -86,7 +86,7 @@ describe('RelatedItemsTree', () => { expect(findDropdown().props('text')).toBe(mockParentItem.groupName); }); - it('returns group name when a group is selected', async () => { + it('returns group name when a group is selected', () => { findAllDropdownItems().at(0).vm.$emit('click'); expect(findDropdown().props('text')).toBe('GitLab Org'); }); diff --git a/ee/spec/frontend/security_orchestration/components/policy_editor/scan_result_policy/scan_result_policy_editor_spec.js b/ee/spec/frontend/security_orchestration/components/policy_editor/scan_result_policy/scan_result_policy_editor_spec.js index f672636f79d3536c1817a4a598139082140ddcd5..b8818fd3789181ea103e6547bc4a1c4a9341fa12 100644 --- a/ee/spec/frontend/security_orchestration/components/policy_editor/scan_result_policy/scan_result_policy_editor_spec.js +++ b/ee/spec/frontend/security_orchestration/components/policy_editor/scan_result_policy/scan_result_policy_editor_spec.js @@ -115,7 +115,7 @@ describe('ScanResultPolicyEditor', () => { const findAllDisabledComponents = () => wrapper.findAllComponents(DimDisableContainer); const findAllRuleBuilders = () => wrapper.findAllComponents(PolicyRuleBuilder); - const changesToRuleMode = async () => { + const changesToRuleMode = () => { findPolicyEditorLayout().vm.$emit('update-editor-mode', EDITOR_MODE_RULE); }; @@ -140,21 +140,21 @@ describe('ScanResultPolicyEditor', () => { ${'policy'} | ${'toStrictEqual'} | ${fromYaml({ manifest: DEFAULT_SCAN_RESULT_POLICY })} `( 'passes the correct $prop prop to the PolicyEditorLayout component', - async ({ prop, compareFn, expected }) => { + ({ prop, compareFn, expected }) => { factory(); expect(findPolicyEditorLayout().props(prop))[compareFn](expected); }, ); - it('displays the initial rule and add rule button', async () => { + it('displays the initial rule and add rule button', () => { factory(); expect(findAllRuleBuilders().length).toBe(1); expect(findAddRuleButton().exists()).toBe(true); }); - it('displays the initial action', async () => { + it('displays the initial action', () => { factory(); expect(findAllPolicyActionBuilders()).toHaveLength(1); @@ -164,7 +164,7 @@ describe('ScanResultPolicyEditor', () => { }); describe('when a user is not an owner of the project', () => { - it('displays the empty state with the appropriate properties', async () => { + it('displays the empty state with the appropriate properties', () => { factory({ provide: { disableScanPolicyUpdate: true } }); const emptyState = findEmptyState(); @@ -215,7 +215,7 @@ describe('ScanResultPolicyEditor', () => { ${'name'} | ${''} | ${'new policy name'} ${'description'} | ${''} | ${'new description'} ${'enabled'} | ${true} | ${false} - `('triggers a change on $component', async ({ component, newValue, oldValue }) => { + `('triggers a change on $component', ({ component, newValue, oldValue }) => { factory(); expect(findPolicyEditorLayout().props('policy')[component]).toBe(oldValue); @@ -238,7 +238,7 @@ describe('ScanResultPolicyEditor', () => { expect(findAllRuleBuilders()).toHaveLength(rulesCount + 1); }); - it('hides add button when the limit of five rules has been reached', async () => { + it('hides add button when the limit of five rules has been reached', () => { const limit = 5; const rule = mockDefaultBranchesScanResultObject.rules[0]; factoryWithExistingPolicy({ rules: [rule, rule, rule, rule, rule] }); @@ -247,7 +247,7 @@ describe('ScanResultPolicyEditor', () => { expect(findAddRuleButton().exists()).toBe(false); }); - it('updates an existing rule', async () => { + it('updates an existing rule', () => { const newValue = { type: 'scan_finding', branches: [], diff --git a/ee/spec/frontend/users/identity_verification/components/credit_card_verification_spec.js b/ee/spec/frontend/users/identity_verification/components/credit_card_verification_spec.js index 3a6e9a55f4f7cf5fe09037a8802ee76ee5cef9b8..f25ad21ffc55f98d7f9e78c71137818ddca0d589 100644 --- a/ee/spec/frontend/users/identity_verification/components/credit_card_verification_spec.js +++ b/ee/spec/frontend/users/identity_verification/components/credit_card_verification_spec.js @@ -56,7 +56,7 @@ describe('CreditCardVerification', () => { }); describe('when zuora emits load error', () => { - it('disables the submit button', async () => { + it('disables the submit button', () => { createComponent(); wrapper.findComponent(Zuora).vm.$emit('load-error'); diff --git a/ee/spec/frontend/vue_shared/components/markdown/ai_actions_dropdown_spec.js b/ee/spec/frontend/vue_shared/components/markdown/ai_actions_dropdown_spec.js index b1221fbf0c2d3c8dde010295c759c9c89349fd7c..38533f30c9a25940bfca96d5ab2f461852e191af 100644 --- a/ee/spec/frontend/vue_shared/components/markdown/ai_actions_dropdown_spec.js +++ b/ee/spec/frontend/vue_shared/components/markdown/ai_actions_dropdown_spec.js @@ -172,7 +172,7 @@ describe('AI actions dropdown component', () => { ); }); - it('shows an error and logs to Sentry when the AI subscription fails', async () => { + it('shows an error and logs to Sentry when the AI subscription fails', () => { const mockError = new Error('ding'); aiResponseSubscriptionHandler.error(mockError); diff --git a/spec/frontend/__helpers__/wait_for_text.js b/spec/frontend/__helpers__/wait_for_text.js index 6bed8a90a9879fabaf4f7eab6a19fa7cc01c450d..991adc5d6c03e2107281d5898488c83b8db9f5b3 100644 --- a/spec/frontend/__helpers__/wait_for_text.js +++ b/spec/frontend/__helpers__/wait_for_text.js @@ -1,3 +1,3 @@ import { findByText } from '@testing-library/dom'; -export const waitForText = async (text, container = document) => findByText(container, text); +export const waitForText = (text, container = document) => findByText(container, text); diff --git a/spec/frontend/ci/ci_variable_list/components/ci_variable_shared_spec.js b/spec/frontend/ci/ci_variable_list/components/ci_variable_shared_spec.js index 06b3ec4aab896a4ad2b01dde398cfcfdbc37c3bb..a25d325f7a172ec512c588f9f5e410d4e184335e 100644 --- a/spec/frontend/ci/ci_variable_list/components/ci_variable_shared_spec.js +++ b/spec/frontend/ci/ci_variable_list/components/ci_variable_shared_spec.js @@ -626,7 +626,7 @@ describe('Ci Variable Shared Component', () => { } }); - it('report custom validator error on wrong data', async () => { + it('report custom validator error on wrong data', () => { expect(() => assertProps( ciVariableShared, diff --git a/spec/frontend/ci/runner/components/registration/registration_instructions_spec.js b/spec/frontend/ci/runner/components/registration/registration_instructions_spec.js index 629272c0bf006cca4b855b29cf3dfbebd64a3790..8c196d7b5e37d908b4dbfc05fe34dae251eec428 100644 --- a/spec/frontend/ci/runner/components/registration/registration_instructions_spec.js +++ b/spec/frontend/ci/runner/components/registration/registration_instructions_spec.js @@ -280,7 +280,7 @@ describe('RegistrationInstructions', () => { }); describe('when the page is closing', () => { - it('warns the user against closing', async () => { + it('warns the user against closing', () => { const { event, preventDefault, returnValueSetter } = mockBeforeunload(); expect(preventDefault).not.toHaveBeenCalled(); diff --git a/spec/frontend/design_management/components/design_notes/design_reply_form_spec.js b/spec/frontend/design_management/components/design_notes/design_reply_form_spec.js index c8fa02cb6aa0980c637e548ad617c61191d4823b..f08efc0c68538a64bf133e21eb3b235f3734aa72 100644 --- a/spec/frontend/design_management/components/design_notes/design_reply_form_spec.js +++ b/spec/frontend/design_management/components/design_notes/design_reply_form_spec.js @@ -124,7 +124,7 @@ describe('Design reply form component', () => { ${'gid://gitlab/DiffDiscussion/123'} | ${123} `( 'initializes autosave support on discussion with proper key', - async ({ discussionId, shortDiscussionId }) => { + ({ discussionId, shortDiscussionId }) => { createComponent({ props: { discussionId } }); expect(Autosave).toHaveBeenCalledWith(expect.any(Element), [ @@ -136,7 +136,7 @@ describe('Design reply form component', () => { ); describe('when form has no text', () => { - beforeEach(async () => { + beforeEach(() => { createComponent(); }); @@ -148,7 +148,7 @@ describe('Design reply form component', () => { key | keyData ${'ctrl'} | ${ctrlKey} ${'meta'} | ${metaKey} - `('does not perform mutation on textarea $key+enter keydown', async ({ keyData }) => { + `('does not perform mutation on textarea $key+enter keydown', ({ keyData }) => { findTextarea().trigger('keydown.enter', keyData); expect(mockMutationHandler).not.toHaveBeenCalled(); @@ -266,7 +266,7 @@ describe('Design reply form component', () => { expect(wrapper.emitted('cancel-form')).toHaveLength(1); }); - it('opens confirmation modal on Escape key when text has changed', async () => { + it('opens confirmation modal on Escape key when text has changed', () => { createComponent(); findTextarea().setValue(mockComment); diff --git a/spec/frontend/repository/components/fork_info_spec.js b/spec/frontend/repository/components/fork_info_spec.js index 6b3d7552bb3b7abb4a6b6ee9b3987d37fbf4c6e8..8521f91a6c749b24b3862d712e3e2bcef1ca7ee1 100644 --- a/spec/frontend/repository/components/fork_info_spec.js +++ b/spec/frontend/repository/components/fork_info_spec.js @@ -224,7 +224,7 @@ describe('ForkInfo component', () => { ); }); - it('does not render Update Fork button', async () => { + it('does not render Update Fork button', () => { expect(findUpdateForkButton().exists()).toBe(false); }); }); diff --git a/spec/frontend/repository/components/table/row_spec.js b/spec/frontend/repository/components/table/row_spec.js index 38260c5b1cdb8cb2222678422164acd3f0d79044..02b505c828cd52c2fe1424a0471486fd38bdd1e9 100644 --- a/spec/frontend/repository/components/table/row_spec.js +++ b/spec/frontend/repository/components/table/row_spec.js @@ -63,7 +63,7 @@ describe('Repository table row component', () => { const findRouterLink = () => wrapper.findComponent(RouterLinkStub); const findIntersectionObserver = () => wrapper.findComponent(GlIntersectionObserver); - it('renders table row', async () => { + it('renders table row', () => { factory({ propsData: { id: '1', @@ -77,7 +77,7 @@ describe('Repository table row component', () => { expect(wrapper.element).toMatchSnapshot(); }); - it('renders a symlink table row', async () => { + it('renders a symlink table row', () => { factory({ propsData: { id: '1', @@ -92,7 +92,7 @@ describe('Repository table row component', () => { expect(wrapper.element).toMatchSnapshot(); }); - it('renders table row for path with special character', async () => { + it('renders table row for path with special character', () => { factory({ propsData: { id: '1', @@ -128,7 +128,7 @@ describe('Repository table row component', () => { ${'tree'} | ${RouterLinkStub} | ${'RouterLink'} ${'blob'} | ${RouterLinkStub} | ${'RouterLink'} ${'commit'} | ${'a'} | ${'hyperlink'} - `('renders a $componentName for type $type', async ({ type, component }) => { + `('renders a $componentName for type $type', ({ type, component }) => { factory({ propsData: { id: '1', @@ -146,7 +146,7 @@ describe('Repository table row component', () => { path ${'test#'} ${'Änderungen'} - `('renders link for $path', async ({ path }) => { + `('renders link for $path', ({ path }) => { factory({ propsData: { id: '1', @@ -162,7 +162,7 @@ describe('Repository table row component', () => { }); }); - it('renders link for directory with hash', async () => { + it('renders link for directory with hash', () => { factory({ propsData: { id: '1', @@ -176,7 +176,7 @@ describe('Repository table row component', () => { expect(wrapper.find('.tree-item-link').props('to')).toEqual({ path: '/-/tree/main/test%23' }); }); - it('renders commit ID for submodule', async () => { + it('renders commit ID for submodule', () => { factory({ propsData: { id: '1', @@ -190,7 +190,7 @@ describe('Repository table row component', () => { expect(wrapper.find('.commit-sha').text()).toContain('1'); }); - it('renders link with href', async () => { + it('renders link with href', () => { factory({ propsData: { id: '1', @@ -205,7 +205,7 @@ describe('Repository table row component', () => { expect(wrapper.find('a').attributes('href')).toEqual('https://test.com'); }); - it('renders LFS badge', async () => { + it('renders LFS badge', () => { factory({ propsData: { id: '1', @@ -220,7 +220,7 @@ describe('Repository table row component', () => { expect(findBadge().exists()).toBe(true); }); - it('renders commit and web links with href for submodule', async () => { + it('renders commit and web links with href for submodule', () => { factory({ propsData: { id: '1', @@ -237,7 +237,7 @@ describe('Repository table row component', () => { expect(wrapper.findComponent(GlLink).attributes('href')).toEqual('https://test.com/commit'); }); - it('renders lock icon', async () => { + it('renders lock icon', () => { factory({ propsData: { id: '1', diff --git a/spec/frontend/tags/components/delete_tag_modal_spec.js b/spec/frontend/tags/components/delete_tag_modal_spec.js index 8438bdb7db064b30884c2e54d4e2bb72e93c19d5..8ec9925563aa11b266c9f659aafeddbd09916bbc 100644 --- a/spec/frontend/tags/components/delete_tag_modal_spec.js +++ b/spec/frontend/tags/components/delete_tag_modal_spec.js @@ -69,7 +69,7 @@ describe('Delete tag modal', () => { expect(submitFormSpy).toHaveBeenCalled(); }); - it('calls show on the modal when a `openModal` event is received through the event hub', async () => { + it('calls show on the modal when a `openModal` event is received through the event hub', () => { const showSpy = jest.spyOn(wrapper.vm.$refs.modal, 'show'); eventHub.$emit('openModal', { diff --git a/spec/frontend_integration/content_editor/content_editor_integration_spec.js b/spec/frontend_integration/content_editor/content_editor_integration_spec.js index a80c4db19b54fc6c0d6aa577d63af0b9ee2065b5..b3997fdb676fcc7e0ab33f4b179ec05b23ae027c 100644 --- a/spec/frontend_integration/content_editor/content_editor_integration_spec.js +++ b/spec/frontend_integration/content_editor/content_editor_integration_spec.js @@ -66,7 +66,7 @@ describe('content_editor', () => { expect(wrapper.findByTestId('content-editor-loading-indicator').exists()).toBe(false); }); - it('displays the initial content', async () => { + it('displays the initial content', () => { expect(wrapper.html()).toContain(initialContent); }); }); diff --git a/spec/frontend_integration/ide/user_opens_ide_spec.js b/spec/frontend_integration/ide/user_opens_ide_spec.js index d4656b1098e985dde7549a53a35211f9232e0066..2f89b3c061251a85fac0fe8b5d3d8578ce7ae5bc 100644 --- a/spec/frontend_integration/ide/user_opens_ide_spec.js +++ b/spec/frontend_integration/ide/user_opens_ide_spec.js @@ -23,7 +23,7 @@ describe('IDE: User opens IDE', () => { resetHTMLFixture(); }); - it('shows loading indicator while the IDE is loading', async () => { + it('shows loading indicator while the IDE is loading', () => { vm = startWebIDE(container); expect(container.querySelectorAll('.multi-file-loading-container')).toHaveLength(3); @@ -52,7 +52,7 @@ describe('IDE: User opens IDE', () => { await screen.findByText('README'); // wait for file tree to load }); - it('shows a list of files in the left sidebar', async () => { + it('shows a list of files in the left sidebar', () => { expect(ideHelper.getFilesList()).toEqual( expect.arrayContaining(['README', 'LICENSE', 'CONTRIBUTING.md']), ); diff --git a/spec/frontend_integration/snippets/snippets_notes_spec.js b/spec/frontend_integration/snippets/snippets_notes_spec.js index bfda86a48a272ead01afe31436df9d8c743be8b1..27be7793ce67c7dd5738377be60eacd2d6549e00 100644 --- a/spec/frontend_integration/snippets/snippets_notes_spec.js +++ b/spec/frontend_integration/snippets/snippets_notes_spec.js @@ -6,7 +6,7 @@ import initDeprecatedNotes from '~/init_deprecated_notes'; import { setHTMLFixture } from 'helpers/fixtures'; describe('Integration Snippets notes', () => { - beforeEach(async () => { + beforeEach(() => { setHTMLFixture(htmlSnippetsShow); // Check if we have to Load GFM Input