Skip to content

Commit 43571c2

Browse files
Merge pull request #7861 from nextcloud/renovate/main-major-vitest-monorepo
chore(deps): update vitest monorepo to v4 (main) (major)
2 parents 5a40c85 + 27921ba commit 43571c2

File tree

16 files changed

+273
-1054
lines changed

16 files changed

+273
-1054
lines changed

package-lock.json

Lines changed: 199 additions & 1030 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"prettier:change": "git diff HEAD --name-only | xargs prettier --write --no-error-on-unmatched-pattern",
1919
"prettier:fix": "prettier --write .",
2020
"serve": "BASE=${BASE:-/apps/text} NODE_ENV=development vite --mode development serve --host",
21-
"test": "NODE_ENV=test vitest",
22-
"test:coverage": "NODE_ENV=test vitest --coverage",
21+
"test": "NODE_ENV=test vitest run",
22+
"test:coverage": "NODE_ENV=test vitest run --coverage",
2323
"test:cypress": "cd cypress && ./runLocal.sh run",
2424
"test:cypress:open": "cd cypress && ./runLocal.sh open",
2525
"watch": "NODE_ENV=development NODE_OPTIONS='--max-old-space-size=8192' vite --mode development build --watch"
@@ -117,7 +117,8 @@
117117
"@nextcloud/prettier-config": "^1.2.0",
118118
"@nextcloud/vite-config": "^1.7.2",
119119
"@types/markdown-it": "^14.1.2",
120-
"@vitest/coverage-v8": "^3.2.4",
120+
"@vitejs/plugin-vue2": "^2.3.4",
121+
"@vitest/coverage-v8": "^4.0.3",
121122
"@vue/test-utils": "^1.3.0 <2",
122123
"@vue/tsconfig": "^0.5.1",
123124
"@vueuse/core": "^11.3.0",
@@ -135,7 +136,7 @@
135136
"typescript": "^5.9.3",
136137
"vite": "^7.1.12",
137138
"vite-plugin-commonjs": "^0.10.4",
138-
"vitest": "^3.2.4",
139+
"vitest": "^4.0.3",
139140
"vue-demi": "^0.14.10",
140141
"vue-template-compiler": "^2.7.16",
141142
"vue-tsc": "^2.2.12"

src/tests/components/Editor/TableOfContents.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ test('renders nothing for editor without headings', () => {
3030
const wrapper = mountWithEditor(editor)
3131
expect(wrapper.text()).toEqual('')
3232
expect(wrapper.vm.$data.headings).toEqual([])
33+
editor.destroy()
3334
})
3435

3536
test('renders initial heading', async () => {
@@ -38,6 +39,7 @@ test('renders initial heading', async () => {
3839
await nextTick()
3940
expect(wrapper.text()).toEqual(text)
4041
expect(wrapper.vm.$data.headings).toEqual(headingsForContent)
42+
editor.destroy()
4143
})
4244

4345
test('updates according to editor changes', async () => {
@@ -48,6 +50,7 @@ test('updates according to editor changes', async () => {
4850
await nextTick()
4951
expect(wrapper.text()).toEqual(text)
5052
expect(wrapper.vm.$data.headings).toEqual(headingsForContent)
53+
editor.destroy()
5154
})
5255

5356
test('disconnects on destroy', async () => {
@@ -58,4 +61,5 @@ test('disconnects on destroy', async () => {
5861
expect(on).toHaveBeenCalledWith('update', expect.any(Function))
5962
wrapper.destroy()
6063
expect(off).toHaveBeenCalledWith('update', expect.any(Function))
64+
editor.destroy()
6165
})

src/tests/components/Menu/TranslateButton.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ test('does not render without state', async () => {
3636
const wrapper = mountWithEditor(editor)
3737
await nextTick()
3838
expect(wrapper.find('button').exists()).toBe(false)
39+
editor.destroy()
3940
})
4041

4142
test('does render with translations', async () => {
@@ -44,6 +45,7 @@ test('does render with translations', async () => {
4445
const wrapper = mountWithEditor(editor)
4546
await nextTick()
4647
expect(wrapper.find('button').exists()).toBe(true)
48+
editor.destroy()
4749
})
4850

4951
test('emits the full content when clicked', async () => {
@@ -56,4 +58,5 @@ test('emits the full content when clicked', async () => {
5658
wrapper.find('button').trigger('click')
5759
await nextTick()
5860
expect(listen).toHaveBeenCalledWith({ content: text })
61+
editor.destroy()
5962
})

src/tests/extensions/Search.spec.ts

Lines changed: 5 additions & 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 'vitest'
6+
import { afterAll, describe, expect, it } from 'vitest'
77
import Search from '../../extensions/Search'
88
import HardBreak from '../../nodes/HardBreak.js'
99
import { searchDecorationsPluginKey } from '../../plugins/searchDecorations.js'
@@ -13,6 +13,10 @@ import createCustomEditor from '../testHelpers/createCustomEditor'
1313
describe('editor search highlighting', () => {
1414
const editor = createCustomEditor(lorem, [Search, HardBreak])
1515

16+
afterAll(() => {
17+
editor.destroy()
18+
})
19+
1620
it('can highlight a match', () => {
1721
const searchQuery = 'Lorem'
1822
editor.commands.setSearchQuery(searchQuery)

src/tests/markdown.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,5 +334,6 @@ describe('Trailing nodes', () => {
334334
const serializer = createMarkdownSerializer(tiptap.schema)
335335
const md = serializer.serialize(tiptap.state.doc)
336336
expect(md).toBe(source)
337+
tiptap.destroy()
337338
})
338339
})

src/tests/marks/Link.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ describe('Link extension integrated in the editor', () => {
1313
[Link],
1414
)
1515
expect(editor.commands).toHaveProperty('insertOrSetLink')
16+
editor.destroy()
1617
})
1718

1819
it('should update link if anchor has mark', () => {
@@ -23,6 +24,7 @@ describe('Link extension integrated in the editor', () => {
2324
editor.commands.setTextSelection(3)
2425
editor.commands.insertOrSetLink('updated.de', { href: 'updated.de' })
2526
expect(editor.getJSON()).toMatchSnapshot()
27+
editor.destroy()
2628
})
2729

2830
it('Should only update link the anchor is on', () => {
@@ -33,6 +35,7 @@ describe('Link extension integrated in the editor', () => {
3335
editor.commands.setTextSelection(3)
3436
editor.commands.insertOrSetLink('updated.de', { href: 'updated.de' })
3537
expect(editor.getJSON()).toMatchSnapshot()
38+
editor.destroy()
3639
})
3740

3841
it('should insert new link if none at anchor', () => {
@@ -45,5 +48,6 @@ describe('Link extension integrated in the editor', () => {
4548
href: 'https://nextcloud.com',
4649
})
4750
expect(editor.getJSON()).toMatchSnapshot()
51+
editor.destroy()
4852
})
4953
})

src/tests/marks/Underline.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ describe('Underline extension integrated in the editor', () => {
2323
it('is not active by default', () => {
2424
const editor = createCustomEditor('<p>Test</p>', [Underline])
2525
expect(editor.isActive('underline')).toBe(false)
26+
editor.destroy()
2627
})
2728

2829
it('is active within <u> tags', () => {
2930
const editor = createCustomEditor('<p><u>Test</u></p>', [Underline])
3031
expect(editor.isActive('underline')).toBe(true)
32+
editor.destroy()
3133
})
3234
})

src/tests/nodes/TaskItem.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe('TaskItem extension', () => {
2323
const editor = createCustomEditor('', [Markdown, TaskList, TaskItem])
2424
const taskItem = editor.schema.nodes.taskItem
2525
expect(taskItem.spec.toMarkdown).toBeDefined()
26+
editor.destroy()
2627
})
2728

2829
it('markdown syntax is preserved through editor', () => {

src/tests/plaintext.spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ const plaintextThroughEditor = (markdown) => {
2121
const content = '<pre>' + escapeHTML(markdown) + '</pre>'
2222
const tiptap = createPlainEditor()
2323
tiptap.commands.setContent(content)
24-
return serializePlainText(tiptap.state.doc) || 'failed'
24+
const plaintext = serializePlainText(tiptap.state.doc) || 'failed'
25+
tiptap.destroy()
26+
return plaintext
2527
}
2628

2729
describe('commonmark as plaintext', () => {
@@ -93,5 +95,6 @@ describe('regression tests', () => {
9395
tiptap.commands.enter()
9496
tiptap.commands.enter()
9597
expect(serializePlainText(tiptap.state.doc)).toEqual('\n\n\n')
98+
tiptap.destroy()
9699
})
97100
})

0 commit comments

Comments
 (0)