diff --git a/markdown-it-plugins/.eslintrc.cjs b/markdown-it-plugins/.eslintrc.cjs
index 90db6a39d..7ead0d868 100644
--- a/markdown-it-plugins/.eslintrc.cjs
+++ b/markdown-it-plugins/.eslintrc.cjs
@@ -13,13 +13,8 @@ module.exports = {
},
"plugins": [
"@typescript-eslint",
- "jest",
"prettier"
],
- "env": {
- "jest": true,
- "jest/globals": true
- },
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
@@ -30,11 +25,6 @@ module.exports = {
"rules": {
"prettier/prettier": ["error",
require('./.prettierrc.json')
- ],
- "jest/no-disabled-tests": "warn",
- "jest/no-focused-tests": "error",
- "jest/no-identical-title": "error",
- "jest/prefer-to-have-length": "warn",
- "jest/valid-expect": "error"
+ ]
}
}
diff --git a/markdown-it-plugins/jest.config.json b/markdown-it-plugins/jest.config.json
deleted file mode 100644
index 4f95301a0..000000000
--- a/markdown-it-plugins/jest.config.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "testRegex" : "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
- "testPathIgnorePatterns" : [
- "/dist/"
- ],
- "moduleFileExtensions" : [
- "ts",
- "tsx",
- "js"
- ],
- "extensionsToTreatAsEsm" : [
- ".ts"
- ],
- "moduleNameMapper" : {
- "^(\\.{1,2}/.*)\\.js$" : "$1"
- },
- "transform" : {
- "^.+\\.tsx?$" : [
- "ts-jest",
- {
- "tsconfig" : "tsconfig.test.json",
- "useESM" : true
- }
- ]
- }
-}
diff --git a/markdown-it-plugins/jest.config.json.license b/markdown-it-plugins/jest.config.json.license
deleted file mode 100644
index c223474fb..000000000
--- a/markdown-it-plugins/jest.config.json.license
+++ /dev/null
@@ -1,3 +0,0 @@
-SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
-
-SPDX-License-Identifier: CC0-1.0
diff --git a/markdown-it-plugins/package.json b/markdown-it-plugins/package.json
index d721bc11b..1f9451f5a 100644
--- a/markdown-it-plugins/package.json
+++ b/markdown-it-plugins/package.json
@@ -86,8 +86,8 @@
],
"scripts": {
"build": "./build.sh",
- "test": "jest",
- "test:ci": "jest --ci",
+ "test": "vitest",
+ "test:ci": "vitest --run",
"prepublish": "rm -rf dist && yarn lint && yarn build && yarn test",
"lint": "eslint src --ext .ts",
"lint:fix": "eslint --fix --ext .ts src"
@@ -108,19 +108,16 @@
"html-entities": "2.5.2"
},
"devDependencies": {
- "@jest/types": "29.6.3",
"@types/markdown-it": "13.0.8",
"@typescript-eslint/eslint-plugin": "8.14.0",
"@typescript-eslint/parser": "8.14.0",
"eslint": "8.57.1",
"eslint-config-prettier": "9.1.0",
- "eslint-plugin-jest": "28.9.0",
"eslint-plugin-prettier": "5.2.3",
- "jest": "29.7.0",
"markdown-it": "13.0.2",
"prettier": "3.3.3",
- "ts-jest": "29.2.5",
- "typescript": "5.6.3"
+ "typescript": "5.6.3",
+ "vitest": "3.1.2"
},
"repository": {
"type": "git",
diff --git a/markdown-it-plugins/src/image-size/index.test.ts b/markdown-it-plugins/src/image-size/index.test.ts
index 18c2c585b..cae8468df 100644
--- a/markdown-it-plugins/src/image-size/index.test.ts
+++ b/markdown-it-plugins/src/image-size/index.test.ts
@@ -7,7 +7,7 @@
import MarkdownIt from 'markdown-it/lib'
import { imageSize } from './index.js'
-import { describe, expect, it } from '@jest/globals'
+import { describe, expect, it } from 'vitest'
describe('markdown-it-imsize', function () {
const md = new MarkdownIt({
diff --git a/markdown-it-plugins/src/task-lists/__snapshots__/index.test.ts.snap b/markdown-it-plugins/src/task-lists/__snapshots__/index.test.ts.snap
index 347eb5118..f18195bb5 100644
--- a/markdown-it-plugins/src/task-lists/__snapshots__/index.test.ts.snap
+++ b/markdown-it-plugins/src/task-lists/__snapshots__/index.test.ts.snap
@@ -1,9 +1,65 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-/*
- * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
- *
- * SPDX-License-Identifier: MIT
- */
+// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+
+exports[`markdown-it-task-lists > renders bullet correctly 1`] = `
+"
+"
+`;
+
+exports[`markdown-it-task-lists > renders dirty correctly 1`] = `
+"
+"
+`;
+
+exports[`markdown-it-task-lists > renders mixedNested correctly 1`] = `
+"Test 1
+
+- foo
+
+
+- bar
+- spam
+
+Test 2
+
+"
+`;
+
+exports[`markdown-it-task-lists > renders ordered correctly 1`] = `
+"
+- checked ordered 1
+- unchecked ordered 2
+- checked ordered 3
+- unchecked ordered 4
+
+"
+`;
exports[`markdown-it-task-lists renders bullet correctly 1`] = `
"
diff --git a/markdown-it-plugins/src/task-lists/index.test.ts b/markdown-it-plugins/src/task-lists/index.test.ts
index 960997cd3..ac0c77d5d 100644
--- a/markdown-it-plugins/src/task-lists/index.test.ts
+++ b/markdown-it-plugins/src/task-lists/index.test.ts
@@ -6,7 +6,7 @@
import MarkdownIt from 'markdown-it/lib'
import { taskLists } from './index.js'
-import { describe, expect, it } from '@jest/globals'
+import { describe, expect, it } from 'vitest'
describe('markdown-it-task-lists', () => {
it('renders bullet correctly', () => {
diff --git a/markdown-it-plugins/src/toc/__snapshots__/index.test.ts.snap b/markdown-it-plugins/src/toc/__snapshots__/index.test.ts.snap
index 5ee390d37..f3a0195c0 100644
--- a/markdown-it-plugins/src/toc/__snapshots__/index.test.ts.snap
+++ b/markdown-it-plugins/src/toc/__snapshots__/index.test.ts.snap
@@ -1,9 +1,93 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-/*
- * SPDX-FileCopyrightText: Original: (c) 2018 Fabio Zendhi Nagao / Modifications: (c) 2022 The HedgeDoc developers (see AUTHORS file)
- *
- * SPDX-License-Identifier: MIT
- */
+// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+
+exports[`toc > ignores the levels in the placeholder if not sorted 1`] = `
+"Head 1
+Head 2
+Head 3
+Head 4
+"
+`;
+
+exports[`toc > renders a toc with a level number array 1`] = `
+"Head 1
+Head 2
+Head 3
+Head 4
+"
+`;
+
+exports[`toc > renders a toc with a single level number 1`] = `
+"Head 1
+Head 2
+Head 3
+"
+`;
+
+exports[`toc > renders a toc with custom allowed token types 1`] = `
+"Head 1
text
+Head 2
+"
+`;
+
+exports[`toc > renders a toc with custom classes 1`] = `
+"Head 1
+Heading 2
+Heading 3
+"
+`;
+
+exports[`toc > renders a toc with custom format function 1`] = `
+"Head 1
+Heading 2
+Heading 3
+"
+`;
+
+exports[`toc > renders a toc with custom slugify 1`] = `
+"Head 1
+Heading 2
+Heading 3
+"
+`;
+
+exports[`toc > renders a toc with custom unique slug start index 1`] = `
+"Head 1
+Heading 2
+Heading 3
+"
+`;
+
+exports[`toc > renders a toc with default settings 1`] = `
+"Head 1
+Heading 2
+Heading 3
+Head 1
+Head 1
+Head 1
+"
+`;
+
+exports[`toc > renders a toc with levels in the placeholder 1`] = `
+"Head 1
+Head 2
+Head 3
+Head 4
+"
+`;
+
+exports[`toc > renders a toc with ordered list 1`] = `
+"Head 1
+Heading 2
+Heading 3
+"
+`;
+
+exports[`toc > renders a toc with unordered list 1`] = `
+"Head 1
+Heading 2
+Heading 3
+"
+`;
exports[`toc ignores the levels in the placeholder if not sorted 1`] = `
"Head 1
diff --git a/markdown-it-plugins/src/toc/index.test.ts b/markdown-it-plugins/src/toc/index.test.ts
index 2968674a2..d865baae1 100644
--- a/markdown-it-plugins/src/toc/index.test.ts
+++ b/markdown-it-plugins/src/toc/index.test.ts
@@ -6,7 +6,7 @@
import MarkdownIt from 'markdown-it/lib'
import { toc } from './plugin.js'
-import { describe, expect, it, jest } from '@jest/globals'
+import { describe, expect, it, vitest } from 'vitest'
describe('toc', () => {
const simpleContent = `
@@ -143,7 +143,7 @@ describe('toc', () => {
})
it('renders a toc and executes the callback', () => {
- const callback = jest.fn()
+ const callback = vitest.fn()
const markdownIt = new MarkdownIt().use(toc, { callback })
markdownIt.render(simpleContent)
expect(callback).toBeCalledWith({
diff --git a/yarn.lock b/yarn.lock
index 511e6ee48..cb75fd7dc 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3020,21 +3020,18 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hedgedoc/markdown-it-plugins@workspace:markdown-it-plugins"
dependencies:
- "@jest/types": "npm:29.6.3"
"@mrdrogdrog/optional": "npm:1.2.1"
"@types/markdown-it": "npm:13.0.8"
"@typescript-eslint/eslint-plugin": "npm:8.14.0"
"@typescript-eslint/parser": "npm:8.14.0"
eslint: "npm:8.57.1"
eslint-config-prettier: "npm:9.1.0"
- eslint-plugin-jest: "npm:28.9.0"
eslint-plugin-prettier: "npm:5.2.3"
html-entities: "npm:2.5.2"
- jest: "npm:29.7.0"
markdown-it: "npm:13.0.2"
prettier: "npm:3.3.3"
- ts-jest: "npm:29.2.5"
typescript: "npm:5.6.3"
+ vitest: "npm:3.1.2"
peerDependencies:
markdown-it: ">=12"
languageName: unknown