Skip to content

Commit 60523fa

Browse files
authored
Merge pull request #7424 from nextcloud-libraries/chore/import-jest-globals
chore(test): explicitly import from jest/globals to simplify migration to/from Vitest
2 parents b354db2 + 5c9974d commit 60523fa

30 files changed

Lines changed: 32 additions & 21 deletions

eslint.config.mjs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,6 @@ export default defineConfig([
4747
},
4848
},
4949

50-
{
51-
name: '@nextcloud/vue/tests-jest',
52-
files: ['tests/**/*.{js,ts}', '**/*.spec.{js,ts}', '**/*.test.{js,ts}'],
53-
languageOptions: {
54-
globals: {
55-
describe: 'readonly',
56-
it: 'readonly',
57-
test: 'readonly',
58-
expect: 'readonly',
59-
beforeEach: 'readonly',
60-
afterEach: 'readonly',
61-
beforeAll: 'readonly',
62-
afterAll: 'readonly',
63-
jest: 'readonly',
64-
},
65-
},
66-
},
67-
6850
{
6951
name: '@nextcloud/vue/tests-cypres',
7052
files: ['cypress/**/*.{js,ts}'],

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ const ignorePatterns = [
3939
]
4040

4141
module.exports = {
42+
// Disable globals to simplify migration to Vitest
43+
injectGlobals: false,
44+
4245
moduleFileExtensions: [
4346
'js',
4447
'ts',

tests/unit/components/NcActions/NcActionButton.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6+
import { describe, expect, it } from '@jest/globals'
67
import { mount } from '@vue/test-utils'
78
import NcActionButton from '../../../../src/components/NcActionButton/NcActionButton.vue'
89

tests/unit/components/NcActions/NcActions.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6+
import { beforeEach, describe, expect, it } from '@jest/globals'
67
import { mount } from '@vue/test-utils'
78
import { defineComponent } from 'vue'
89
import { Fragment } from 'vue-frag'

tests/unit/components/NcAppContent/NcAppContent.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5-
import { describe, expect, it } from '@jest/globals'
5+
import { beforeEach, describe, expect, it } from '@jest/globals'
66
import { mount } from '@vue/test-utils'
77
import NcAppContent from '../../../../src/components/NcAppContent/NcAppContent.vue'
88

tests/unit/components/NcAppNavigation/NcAppNavigation.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import { describe, expect, it } from '@jest/globals'
6+
import { beforeEach, describe, expect, it } from '@jest/globals'
77
import { emit } from '@nextcloud/event-bus'
88
import { mount } from '@vue/test-utils'
99
import { nextTick } from 'vue'

tests/unit/components/NcAppSettingsDialog/NcAppSettingsDialog.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6+
import { beforeAll, describe, expect, it, jest } from '@jest/globals'
67
import { mount } from '@vue/test-utils'
78
import { defineComponent, inject, nextTick, onMounted } from 'vue'
89
import NcAppSettingsDialog from '../../../../src/components/NcAppSettingsDialog/NcAppSettingsDialog.vue'

tests/unit/components/NcAppSidebar/NcAppSidebarTabs.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6+
import { afterEach, beforeEach, describe, expect, it, jest } from '@jest/globals'
67
import { mount } from '@vue/test-utils'
78
import Vue from 'vue'
89
import NcActionButton from '../../../../src/components/NcActionButton/NcActionButton.vue'

tests/unit/components/NcAvatar/NcAvatar.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6+
import { afterAll, beforeAll, describe, expect, it, jest } from '@jest/globals'
67
import { mount, shallowMount } from '@vue/test-utils'
78
import { nextTick } from 'vue'
89
import NcAvatar from '../../../../src/components/NcAvatar/NcAvatar.vue'

tests/unit/components/NcButton/button.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6+
import { describe, expect, it, test } from '@jest/globals'
67
import { shallowMount } from '@vue/test-utils'
78
import NcButton from '../../../../src/components/NcButton/NcButton.vue'
89

0 commit comments

Comments
 (0)