Skip to content

Commit b8a0b4b

Browse files
authored
Merge pull request #149 from NaverPayDev/feature/148
markdown-lint 패키지 테스트 러너를 jest에서 vitest로 마이그레이션
2 parents ee62c4c + d4cbb0d commit b8a0b4b

6 files changed

Lines changed: 266 additions & 1475 deletions

File tree

.changeset/silent-windows-fly.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@naverpay/markdown-lint": patch
3+
---
4+
5+
테스트 러너를 jest에서 vitest로 마이그레이션
6+
7+
- vitest 설정 파일 추가
8+
- 테스트 파일의 import 구문을 ESM 형식으로 변경
9+
- jest 관련 설정 및 의존성 제거
10+
- package.json의 test 스크립트를 vitest로 변경

packages/markdown-lint/index.test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
const path = require('path')
1+
import path from 'path'
22

3-
const {parse} = require('jsonc-parser')
4-
const markdownlint = require('markdownlint')
3+
import {parse} from 'jsonc-parser'
4+
import markdownlint from 'markdownlint'
5+
import {describe, test, expect} from 'vitest'
56

67
describe('markdown lint', () => {
7-
const config = markdownlint.readConfigSync(path.join(__dirname, '.markdownlint.jsonc'), [parse])
8+
const config = markdownlint.readConfigSync(path.join(import.meta.dirname, '.markdownlint.jsonc'), [parse])
89

910
test('heading-style', () => {
1011
const errors = markdownlint.sync({

packages/markdown-lint/jest.config.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/markdown-lint/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
".markdownlint.jsonc"
2525
],
2626
"scripts": {
27-
"test": "jest --config jest.config.js"
27+
"test": "vitest run",
28+
"test:watch": "vitest watch"
2829
},
2930
"dependencies": {
3031
"markdownlint-cli2": "^0.11.0"
3132
},
3233
"devDependencies": {
33-
"jest": "^29.5.0",
3434
"jsonc-parser": "^3.2.1",
35-
"markdownlint": "^0.32.1"
35+
"markdownlint": "^0.32.1",
36+
"vitest": "^4.0.17"
3637
}
3738
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import {defineConfig} from 'vitest/config'
2+
3+
export default defineConfig({
4+
test: {
5+
include: ['**/*.test.js'],
6+
},
7+
})

0 commit comments

Comments
 (0)