Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default typegen([
globals: {
...globals.es6,
...globals.node,
...globals.mocha
...globals.vitest
}
},
linterOptions: {
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"scripts": {
"new": "node tools/new-rule.js",
"start": "npm run test:base -- --watch --growl",
"test:base": "mocha \"tests/lib/**/*.js\" --reporter dot",
"test": "nyc npm run test:base -- \"tests/integrations/*.js\" --timeout 60000",
"test:integrations": "mocha \"tests/integrations/*.js\" --timeout 60000",
"debug": "mocha --inspect \"tests/lib/**/*.js\" --reporter dot --timeout 60000",
"test:base": "vitest run --reporter=dot tests/lib",
"test": "vitest run",
"test:integrations": "vitest run tests/integrations",
"debug": "vitest run --inspect --no-file-parallelism --reporter=dot tests/lib",
"cover": "npm run cover:test && npm run cover:report",
"cover:test": "nyc npm run test:base -- --timeout 60000",
"cover:report": "nyc report --reporter=html",
"cover:test": "vitest run --coverage --reporter=dot tests/lib",
"cover:report": "echo 'HTML coverage report available at ./coverage/index.html'",
"lint": "eslint . && markdownlint \"**/*.md\"",
"lint:fix": "eslint . --fix && markdownlint \"**/*.md\" --fix",
"tsc": "tsc",
Expand Down Expand Up @@ -106,13 +106,13 @@
"globals": "^15.14.0",
"jsdom": "^22.0.0",
"markdownlint-cli": "^0.42.0",
"mocha": "^10.7.3",
"nyc": "^17.1.0",
"pathe": "^1.1.2",
"prettier": "^3.3.3",
"typescript": "^5.7.2",
"vite-plugin-eslint4b": "^0.5.1",
"vitepress": "^1.4.1",
"vue-eslint-parser": "^10.0.0"
"vue-eslint-parser": "^10.0.0",
"vitest": "^3.2.4",
"@vitest/coverage-v8": "^3.2.4"
}
}
14 changes: 4 additions & 10 deletions tests/integrations/eslint-plugin-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@ const cp = require('child_process')
const path = require('path')
const semver = require('semver')

const PLUGIN_DIR = path.join(__dirname, 'eslint-plugin-import')
const ESLINT = `.${path.sep}node_modules${path.sep}.bin${path.sep}eslint`

describe('Integration with eslint-plugin-import', () => {
let originalCwd

before(() => {
originalCwd = process.cwd()
process.chdir(path.join(__dirname, 'eslint-plugin-import'))
cp.execSync('npm i', { stdio: 'inherit' })
})
after(() => {
process.chdir(originalCwd)
beforeAll(() => {
cp.execSync('npm i', { cwd: PLUGIN_DIR, stdio: 'inherit' })
})

// https://github.com/vuejs/eslint-plugin-vue/issues/21#issuecomment-308957697
Expand All @@ -41,6 +35,6 @@ describe('Integration with eslint-plugin-import', () => {
return
}

cp.execSync(`${ESLINT} a.vue`, { stdio: 'inherit' })
cp.execSync(`${ESLINT} a.vue`, { cwd: PLUGIN_DIR, stdio: 'inherit' })
})
})
13 changes: 4 additions & 9 deletions tests/integrations/flat-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@ const cp = require('child_process')
const path = require('path')
const semver = require('semver')

const TARGET_DIR = path.join(__dirname, 'flat-config')
const ESLINT = `.${path.sep}node_modules${path.sep}.bin${path.sep}eslint`

describe('Integration with flat config', () => {
let originalCwd

before(() => {
originalCwd = process.cwd()
process.chdir(path.join(__dirname, 'flat-config'))
cp.execSync('npm i -f', { stdio: 'inherit' })
})
after(() => {
process.chdir(originalCwd)
beforeAll(() => {
cp.execSync('npm i -f', { cwd: TARGET_DIR, stdio: 'inherit' })
})

it('should lint without errors', () => {
Expand All @@ -33,6 +27,7 @@ describe('Integration with flat config', () => {

const result = JSON.parse(
cp.execSync(`${ESLINT} a.vue --format=json`, {
cwd: TARGET_DIR,
encoding: 'utf8'
})
)
Expand Down
24 changes: 24 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

import { configDefaults, defineConfig } from 'vitest/config';
export default defineConfig({
test: {
include: [...configDefaults.include, 'tests/lib/**/*.js', 'tests/integrations/**/*.js'],
exclude: [...configDefaults.exclude, 'tests/fixtures/**'],
passWithNoTests: true,
testTimeout: 60_000,
globals: true,
coverage: {
provider: 'v8',
include: ['lib/**/*.js'],
exclude: [
'tests/**',
'dist/**',
'tools/**',
'node_modules/**'
],
reporter: ['text', 'lcov', 'json-summary', 'html'],
all: true,
reportsDirectory: './coverage'
},
},
});