Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3b667b0

Browse files
committed
chore: migrate to vitest (manual support part)
1 parent060f779 commit3b667b0

File tree

8 files changed

+40
-37
lines changed

8 files changed

+40
-37
lines changed

‎package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
"scripts": {
88
"new":"node tools/new-rule.js",
99
"start":"npm run test:base -- --watch --growl",
10+
"test:base":"vitest run --reporter=dot tests/lib",
1011
"test":"vitest run",
12+
"test:integrations":"vitest run tests/integrations",
13+
"debug":"vitest run --inspect --no-file-parallelism --reporter=dot tests/lib",
1114
"cover":"npm run cover:test && npm run cover:report",
12-
"cover:test":"nyc npmruntest:base -- --timeout 60000",
13-
"cover:report":"nycreport--reporter=html",
15+
"cover:test":"vitestrun--coverage --reporter=dot tests/lib",
16+
"cover:report":"echo 'HTML coveragereportavailable at ./coverage/index.html'",
1417
"lint":"eslint . && markdownlint\"**/*.md\"",
1518
"lint:fix":"eslint . --fix && markdownlint\"**/*.md\" --fix",
1619
"tsc":"tsc",
@@ -24,9 +27,7 @@
2427
"docs:build":"vitepress build docs",
2528
"generate:version":"env-cmd -e version npm run update && npm run lint -- --fix",
2629
"changeset:version":"changeset version && npm run generate:version && git add --all",
27-
"changeset:publish":"npm run typegen && changeset publish",
28-
"test:watch":"vitest watch",
29-
"coverage":"vitest run --coverage"
30+
"changeset:publish":"npm run typegen && changeset publish"
3031
},
3132
"files": [
3233
"lib"
@@ -105,14 +106,13 @@
105106
"globals":"^15.14.0",
106107
"jsdom":"^22.0.0",
107108
"markdownlint-cli":"^0.42.0",
108-
"nyc":"^17.1.0",
109109
"pathe":"^1.1.2",
110110
"prettier":"^3.3.3",
111111
"typescript":"^5.7.2",
112112
"vite-plugin-eslint4b":"^0.5.1",
113113
"vitepress":"^1.4.1",
114114
"vue-eslint-parser":"^10.0.0",
115-
"vitest":"^1.0.1",
116-
"@vitest/coverage-v8":"^1.0.1"
115+
"vitest":"^3.2.4",
116+
"@vitest/coverage-v8":"^3.2.4"
117117
}
118-
}
118+
}

‎tests/fixtures/typescript/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
"strict":true,
44
"skipLibCheck":true
55
}
6-
}
6+
}

‎tests/integrations/eslint-plugin-import.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{describe,it}from"vitest";
1+
import{beforeAll,describe,it}from"vitest";
22
/**
33
*@author Toru Nagashima <https://github.com/mysticatea>
44
*@copyright 2017 Toru Nagashima. All rights reserved.
@@ -10,18 +10,12 @@ const cp = require('child_process')
1010
constpath=require('path')
1111
constsemver=require('semver')
1212

13+
constPLUGIN_DIR=path.join(__dirname,'eslint-plugin-import')
1314
constESLINT=`.${path.sep}node_modules${path.sep}.bin${path.sep}eslint`
1415

1516
describe('Integration with eslint-plugin-import',()=>{
16-
letoriginalCwd
17-
18-
before(()=>{
19-
originalCwd=process.cwd()
20-
process.chdir(path.join(__dirname,'eslint-plugin-import'))
21-
cp.execSync('npm i',{stdio:'inherit'})
22-
})
23-
after(()=>{
24-
process.chdir(originalCwd)
17+
beforeAll(()=>{
18+
cp.execSync('npm i',{cwd:PLUGIN_DIR,stdio:'inherit'})
2519
})
2620

2721
// https://github.com/vuejs/eslint-plugin-vue/issues/21#issuecomment-308957697
@@ -42,6 +36,6 @@ describe('Integration with eslint-plugin-import', () => {
4236
return
4337
}
4438

45-
cp.execSync(`${ESLINT} a.vue`,{stdio:'inherit'})
39+
cp.execSync(`${ESLINT} a.vue`,{cwd:PLUGIN_DIR,stdio:'inherit'})
4640
})
4741
})

‎tests/integrations/eslint-plugin-import/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
"eslint-plugin-import":"~2.23.4",
1313
"eslint-plugin-vue":"file:../../.."
1414
}
15-
}
15+
}

‎tests/integrations/flat-config.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
import{describe,it}from"vitest";
1+
import{beforeAll,describe,it}from"vitest";
22
'use strict'
33

44
const{strict:assert}=require('assert')
55
constcp=require('child_process')
66
constpath=require('path')
77
constsemver=require('semver')
88

9+
constTARGET_DIR=path.join(__dirname,'flat-config')
910
constESLINT=`.${path.sep}node_modules${path.sep}.bin${path.sep}eslint`
1011

1112
describe('Integration with flat config',()=>{
12-
letoriginalCwd
13-
14-
before(()=>{
15-
originalCwd=process.cwd()
16-
process.chdir(path.join(__dirname,'flat-config'))
17-
cp.execSync('npm i -f',{stdio:'inherit'})
18-
})
19-
after(()=>{
20-
process.chdir(originalCwd)
13+
beforeAll(()=>{
14+
cp.execSync('npm i -f',{cwd:TARGET_DIR,stdio:'inherit'})
2115
})
2216

2317
it('should lint without errors',()=>{
@@ -34,6 +28,7 @@ describe('Integration with flat config', () => {
3428

3529
constresult=JSON.parse(
3630
cp.execSync(`${ESLINT} a.vue --format=json`,{
31+
cwd:TARGET_DIR,
3732
encoding:'utf8'
3833
})
3934
)

‎tests/integrations/flat-config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
"eslint":"^9.0.0-0",
1111
"eslint-plugin-vue":"file:../../.."
1212
}
13-
}
13+
}

‎tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333
"docs/.vitepress/**/*.ts",
3434
"docs/.vitepress/**/*.mts"
3535
]
36-
}
36+
}

‎vitest.config.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,23 @@
22
import{configDefaults,defineConfig}from'vitest/config';
33
exportdefaultdefineConfig({
44
test:{
5-
include:[...configDefaults.include,'**/test/*.ts'],
5+
include:[...configDefaults.include,'tests/lib/**/*.js','tests/integrations/**/*.js'],
6+
exclude:[...configDefaults.exclude,'tests/fixtures/**'],
67
passWithNoTests:true,
7-
testTimeout:10_000,
8+
testTimeout:60_000,
9+
globals:true,
10+
coverage:{
11+
provider:'v8',
12+
include:['lib/**/*.js'],
13+
exclude:[
14+
'tests/**',
15+
'dist/**',
16+
'tools/**',
17+
'node_modules/**'
18+
],
19+
reporter:['text','lcov','json-summary','html'],
20+
all:true,
21+
reportsDirectory:'./coverage'
22+
},
823
},
924
});
10-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp