From 0627a118e4d4d2b98f5531c8e51385e51215956a Mon Sep 17 00:00:00 2001 From: Wang Yiding Date: Wed, 25 Dec 2024 15:21:08 +0800 Subject: [PATCH 01/11] fix: match glob logic for negate ignores --- shared/configs.ts | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/shared/configs.ts b/shared/configs.ts index a3999f0..2ada5b2 100644 --- a/shared/configs.ts +++ b/shared/configs.ts @@ -13,9 +13,27 @@ function minimatch(file: string, pattern: string) { return m.match(file) } -export function getMatchedGlobs(file: string, glob: (string | string[])[]) { - const globs = (Array.isArray(glob) ? glob : [glob]).flat() - return globs.filter(glob => minimatch(file, glob)).flat() +export function getMatchedGlobs(file: string, globs: (string | string[])[]) { + const flatGlobs = (Array.isArray(globs) ? globs : [globs]).flat() + let unmatched: string[] = [] + + flatGlobs.forEach((glob, i) => { + if (minimatch(file, glob)) { + if (glob.startsWith('!')) + unmatched.push(glob) + } + else { + if (glob.startsWith('!')) { + const unignoreMatched = getMatchedGlobs(file, flatGlobs.slice(0, i)) + unmatched = unmatched.concat(unignoreMatched.length > 0 ? unignoreMatched : [], glob) + } + else { + unmatched.push(glob) + } + } + }) + + return flatGlobs.filter(glob => !unmatched.includes(glob)) } const META_KEYS = new Set(['name', 'index']) @@ -40,7 +58,9 @@ export function matchFile( configs: FlatConfigItem[], ignoreOnlyConfigs: FlatConfigItem[], ): MatchedFile { - const globalIgnored = ignoreOnlyConfigs.flatMap(config => getMatchedGlobs(filepath, config.ignores!)) + const globIgnoreBlobs = ignoreOnlyConfigs.flatMap(config => config.ignores ?? []) + const globalIgnored = getMatchedGlobs(filepath, globIgnoreBlobs) + if (globalIgnored.length) { return { filepath, From fc2ea9a43450c688ba11b490f15efd1b13b8c3a3 Mon Sep 17 00:00:00 2001 From: Wang Yiding Date: Thu, 26 Dec 2024 23:31:50 +0800 Subject: [PATCH 02/11] Revert "fix: match glob logic for negate ignores" This reverts commit 0627a118e4d4d2b98f5531c8e51385e51215956a. --- shared/configs.ts | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/shared/configs.ts b/shared/configs.ts index 2ada5b2..a3999f0 100644 --- a/shared/configs.ts +++ b/shared/configs.ts @@ -13,27 +13,9 @@ function minimatch(file: string, pattern: string) { return m.match(file) } -export function getMatchedGlobs(file: string, globs: (string | string[])[]) { - const flatGlobs = (Array.isArray(globs) ? globs : [globs]).flat() - let unmatched: string[] = [] - - flatGlobs.forEach((glob, i) => { - if (minimatch(file, glob)) { - if (glob.startsWith('!')) - unmatched.push(glob) - } - else { - if (glob.startsWith('!')) { - const unignoreMatched = getMatchedGlobs(file, flatGlobs.slice(0, i)) - unmatched = unmatched.concat(unignoreMatched.length > 0 ? unignoreMatched : [], glob) - } - else { - unmatched.push(glob) - } - } - }) - - return flatGlobs.filter(glob => !unmatched.includes(glob)) +export function getMatchedGlobs(file: string, glob: (string | string[])[]) { + const globs = (Array.isArray(glob) ? glob : [glob]).flat() + return globs.filter(glob => minimatch(file, glob)).flat() } const META_KEYS = new Set(['name', 'index']) @@ -58,9 +40,7 @@ export function matchFile( configs: FlatConfigItem[], ignoreOnlyConfigs: FlatConfigItem[], ): MatchedFile { - const globIgnoreBlobs = ignoreOnlyConfigs.flatMap(config => config.ignores ?? []) - const globalIgnored = getMatchedGlobs(filepath, globIgnoreBlobs) - + const globalIgnored = ignoreOnlyConfigs.flatMap(config => getMatchedGlobs(filepath, config.ignores!)) if (globalIgnored.length) { return { filepath, From 470d160d5c8d934edc8f0b37b300381fb1ab1abd Mon Sep 17 00:00:00 2001 From: Wang Yiding Date: Thu, 26 Dec 2024 23:31:22 +0800 Subject: [PATCH 03/11] fix: use config array built in ignore check --- app/pages/configs.vue | 4 ++-- nuxt.config.ts | 1 + shared/configs.ts | 47 +++++++++++++++++++++++++++++-------------- src/configs.ts | 45 +++++------------------------------------ 4 files changed, 40 insertions(+), 57 deletions(-) diff --git a/app/pages/configs.vue b/app/pages/configs.vue index 0be98ae..984d129 100644 --- a/app/pages/configs.vue +++ b/app/pages/configs.vue @@ -7,7 +7,7 @@ import { useRoute } from '#app/composables/router' import { debouncedWatch } from '@vueuse/core' import Fuse from 'fuse.js' import { computed, defineComponent, h, nextTick, onMounted, ref, shallowRef, watch, watchEffect } from 'vue' -import { isIgnoreOnlyConfig, matchFile } from '~~/shared/configs' +import { buildConfigArray, isIgnoreOnlyConfig, matchFile } from '~~/shared/configs' import { getRuleLevel } from '~~/shared/rules' import { payload } from '~/composables/payload' import { configsOpenState, filtersConfigs as filters, stateStorage } from '~/composables/state' @@ -32,7 +32,7 @@ watchEffect(() => { fileMatchResult.value = matchFile( filters.filepath, payload.value.configs, - payload.value.configsIgnoreOnly, + buildConfigArray(payload.value.configs, payload.value.meta.basePath), ) if (fileMatchResult.value.configs.length) { configs = Array.from(new Set([ diff --git a/nuxt.config.ts b/nuxt.config.ts index 0c182f3..8f3c309 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -18,6 +18,7 @@ export default defineNuxtConfig({ experimental: { typedPages: true, + clientNodeCompat: true, }, features: { diff --git a/shared/configs.ts b/shared/configs.ts index a3999f0..6acc581 100644 --- a/shared/configs.ts +++ b/shared/configs.ts @@ -1,4 +1,5 @@ import type { FlatConfigItem, MatchedFile } from './types' +import { ConfigArray } from '@eslint/config-array' import { Minimatch } from 'minimatch' const minimatchOpts = { dot: true } @@ -38,31 +39,47 @@ export function isGeneralConfig(config: FlatConfigItem) { export function matchFile( filepath: string, configs: FlatConfigItem[], - ignoreOnlyConfigs: FlatConfigItem[], + configArray: ConfigArray, ): MatchedFile { - const globalIgnored = ignoreOnlyConfigs.flatMap(config => getMatchedGlobs(filepath, config.ignores!)) - if (globalIgnored.length) { - return { - filepath, - globs: globalIgnored, - configs: [], - } - } - const result: MatchedFile = { filepath, globs: [], configs: [], } + configs.forEach((config, index) => { const positive = getMatchedGlobs(filepath, config.files || []) const negative = getMatchedGlobs(filepath, config.ignores || []) - if (!negative.length && positive.length) + if (configArray && !configArray.isFileIgnored(filepath) && positive.length > 0) { result.configs.push(index) - result.globs.push( - ...positive, - ...negative, - ) + // push positive globs only when there are configs matched + result.globs.push(...positive) + } + // push negative globs except for unignore globs + result.globs.push(...negative.filter(glob => !glob.startsWith('!'))) }) + return result } + +const NOOP_SCHEMA = { + merge: 'replace', + validate() {}, +} + +const FLAT_CONFIG_NOOP_SCHEMA = { + settings: NOOP_SCHEMA, + linterOptions: NOOP_SCHEMA, + language: NOOP_SCHEMA, + languageOptions: NOOP_SCHEMA, + processor: NOOP_SCHEMA, + plugins: NOOP_SCHEMA, + rules: NOOP_SCHEMA, +} + +export function buildConfigArray(configs: FlatConfigItem[], basePath: string) { + return new ConfigArray(configs.map(({ index: _, ...c }) => c), { + basePath, + schema: FLAT_CONFIG_NOOP_SCHEMA, + }).normalizeSync() +} diff --git a/src/configs.ts b/src/configs.ts index 2098d30..ccff7e8 100644 --- a/src/configs.ts +++ b/src/configs.ts @@ -1,13 +1,12 @@ import type { FlatConfigItem, MatchedFile, Payload, RuleInfo } from '../shared/types' import { basename, dirname, relative, resolve } from 'node:path' import process from 'node:process' -import { ConfigArray } from '@eslint/config-array' import { configArrayFindFiles } from '@voxpelli/config-array-find-files' import { bundleRequire } from 'bundle-require' import { findUp } from 'find-up' import { resolve as resolveModule } from 'mlly' import c from 'picocolors' -import { isIgnoreOnlyConfig, matchFile } from '../shared/configs' +import { buildConfigArray, matchFile } from '../shared/configs' import { configFilenames, legacyConfigFilenames, MARK_CHECK, MARK_INFO } from './constants' import { ConfigPathError, ConfigPathLegacyError } from './errors' @@ -235,56 +234,22 @@ export async function readConfig( } } -const noopSchema = { - merge: 'replace', - validate() {}, -} - -const flatConfigNoopSchema = { - settings: noopSchema, - linterOptions: noopSchema, - language: noopSchema, - languageOptions: noopSchema, - processor: noopSchema, - plugins: noopSchema, - rules: noopSchema, -} - export async function globMatchedFiles( basePath: string, configs: FlatConfigItem[], ): Promise { console.log(MARK_INFO, 'Globing matched files') - const configArray = new ConfigArray(configs, { - basePath, - schema: flatConfigNoopSchema, - }) - - await configArray.normalize() - - const files = await configArrayFindFiles({ + const configArray = buildConfigArray(configs, basePath) + const files = (await configArrayFindFiles({ basePath, configs: configArray, - }) - - files.sort() - - const ignoreOnlyConfigs = configs.filter(isIgnoreOnlyConfig) - // const functionalGlobMap = new Map() - // function stringifyGlob(glob: string) { - // if (typeof glob === 'function') { - // if (!functionalGlobMap.has(glob)) - // functionalGlobMap.set(glob, ``) - // return functionalGlobMap.get(glob)! - // } - // return glob - // } + })).toSorted() return files .map((filepath) => { filepath = relative(basePath, filepath) - const result = matchFile(filepath, configs, ignoreOnlyConfigs) + const result = matchFile(filepath, configs, configArray) if (!result.configs.length) return undefined return result From d5e0321136153ed183d680bfbd73193e2c79c811 Mon Sep 17 00:00:00 2001 From: Wang Yiding Date: Sat, 28 Dec 2024 21:12:02 +0800 Subject: [PATCH 04/11] feat: check current config ignores as well --- app/pages/configs.vue | 2 +- shared/configs.ts | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/pages/configs.vue b/app/pages/configs.vue index 984d129..9d623a8 100644 --- a/app/pages/configs.vue +++ b/app/pages/configs.vue @@ -339,7 +339,7 @@ onMounted(async () => {
Ignored by globs:
{ + const isFileGlobalIgnored = configArray.isFileIgnored(filepath) + let isFileIgnoredInCurrConfig = false + if (config.ignores) { + const ignoreConfigArray = buildConfigArray([{ + index: config.index, + // only include ignores because of how ConfigArray works internally: + // isFileIgnored only works when only `ignore` exists + // (https://github.com/eslint/rewrite/blob/config-array-v0.19.1/packages/config-array/src/config-array.js#L726) + ignores: config.ignores ?? [], + }], configArray.basePath) + isFileIgnoredInCurrConfig = ignoreConfigArray.isFileIgnored(filepath) + } + const positive = getMatchedGlobs(filepath, config.files || []) const negative = getMatchedGlobs(filepath, config.ignores || []) - if (configArray && !configArray.isFileIgnored(filepath) && positive.length > 0) { + if (!isFileGlobalIgnored && !isFileIgnoredInCurrConfig && positive.length > 0) { result.configs.push(index) // push positive globs only when there are configs matched result.globs.push(...positive) } - // push negative globs except for unignore globs - result.globs.push(...negative.filter(glob => !glob.startsWith('!'))) + + result.globs.push(...negative) }) + result.globs = [...new Set(result.globs)] + return result } From 12ca09e4337034eddc9998ef8002149e48094c7e Mon Sep 17 00:00:00 2001 From: Wang Yiding Date: Mon, 30 Dec 2024 01:52:46 +0800 Subject: [PATCH 05/11] fix: make full use of config array --- app/pages/configs.vue | 4 +- package.json | 3 ++ patches/@eslint__config-array@0.19.1.patch | 26 +++++++++++++ pnpm-lock.yaml | 17 ++++++--- shared/configs.ts | 44 ++++++++++++---------- shared/types.ts | 5 +-- src/configs.ts | 9 +++-- 7 files changed, 72 insertions(+), 36 deletions(-) create mode 100644 patches/@eslint__config-array@0.19.1.patch diff --git a/app/pages/configs.vue b/app/pages/configs.vue index 9d623a8..767bc0b 100644 --- a/app/pages/configs.vue +++ b/app/pages/configs.vue @@ -7,7 +7,7 @@ import { useRoute } from '#app/composables/router' import { debouncedWatch } from '@vueuse/core' import Fuse from 'fuse.js' import { computed, defineComponent, h, nextTick, onMounted, ref, shallowRef, watch, watchEffect } from 'vue' -import { buildConfigArray, isIgnoreOnlyConfig, matchFile } from '~~/shared/configs' +import { isIgnoreOnlyConfig, matchFile } from '~~/shared/configs' import { getRuleLevel } from '~~/shared/rules' import { payload } from '~/composables/payload' import { configsOpenState, filtersConfigs as filters, stateStorage } from '~/composables/state' @@ -32,7 +32,7 @@ watchEffect(() => { fileMatchResult.value = matchFile( filters.filepath, payload.value.configs, - buildConfigArray(payload.value.configs, payload.value.meta.basePath), + payload.value.meta.basePath, ) if (fileMatchResult.value.configs.length) { configs = Array.from(new Set([ diff --git a/package.json b/package.json index b8674e7..661a291 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,9 @@ "pnpm": { "overrides": { "nitropack": "catalog:" + }, + "patchedDependencies": { + "@eslint/config-array@0.19.1": "patches/@eslint__config-array@0.19.1.patch" } }, "simple-git-hooks": { diff --git a/patches/@eslint__config-array@0.19.1.patch b/patches/@eslint__config-array@0.19.1.patch new file mode 100644 index 0000000..8968474 --- /dev/null +++ b/patches/@eslint__config-array@0.19.1.patch @@ -0,0 +1,26 @@ +diff --git a/dist/cjs/index.cjs b/dist/cjs/index.cjs +index cc033c315239251752f4a2feb3d7546ef0d24013..356fc93fe59e43794bb84ea61fd18a45ced0df8f 100644 +--- a/dist/cjs/index.cjs ++++ b/dist/cjs/index.cjs +@@ -241,7 +241,7 @@ const CONFIG_TYPES = new Set(["array", "function"]); + * Fields that are considered metadata and not part of the config object. + * @type {Set} + */ +-const META_FIELDS = new Set(["name"]); ++const META_FIELDS = new Set(["name", "index"]); + + /** + * A schema containing just files and ignores for early validation. +diff --git a/dist/esm/index.js b/dist/esm/index.js +index 1e68f33e3d641d856ab25b8206be085b6c205067..7dd46e0b8872078bba033ac75c79a9046020d589 100644 +--- a/dist/esm/index.js ++++ b/dist/esm/index.js +@@ -221,7 +221,7 @@ const CONFIG_TYPES = new Set(["array", "function"]); + * Fields that are considered metadata and not part of the config object. + * @type {Set} + */ +-const META_FIELDS = new Set(["name"]); ++const META_FIELDS = new Set(["name", "index"]); + + /** + * A schema containing just files and ignores for early validation. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d01c862..32c71da 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -145,16 +145,21 @@ catalogs: overrides: nitropack: 2.8.1 +patchedDependencies: + '@eslint/config-array@0.19.1': + hash: x7vaku5tfstwhfkemiablef5bi + path: patches/@eslint__config-array@0.19.1.patch + importers: .: dependencies: '@eslint/config-array': specifier: 'catalog:' - version: 0.19.1 + version: 0.19.1(patch_hash=x7vaku5tfstwhfkemiablef5bi) '@voxpelli/config-array-find-files': specifier: 'catalog:' - version: 1.2.1(@eslint/config-array@0.19.1) + version: 1.2.1(@eslint/config-array@0.19.1(patch_hash=x7vaku5tfstwhfkemiablef5bi)) bundle-require: specifier: 'catalog:' version: 5.0.0(esbuild@0.24.0) @@ -6132,7 +6137,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@eslint/config-array@0.19.1': + '@eslint/config-array@0.19.1(patch_hash=x7vaku5tfstwhfkemiablef5bi)': dependencies: '@eslint/object-schema': 2.1.5 debug: 4.3.7 @@ -7485,9 +7490,9 @@ snapshots: '@eslint/config-array': 0.18.0 '@nodelib/fs.walk': 2.0.0 - '@voxpelli/config-array-find-files@1.2.1(@eslint/config-array@0.19.1)': + '@voxpelli/config-array-find-files@1.2.1(@eslint/config-array@0.19.1(patch_hash=x7vaku5tfstwhfkemiablef5bi))': dependencies: - '@eslint/config-array': 0.19.1 + '@eslint/config-array': 0.19.1(patch_hash=x7vaku5tfstwhfkemiablef5bi) '@nodelib/fs.walk': 2.0.0 '@vue-macros/common@1.14.0(rollup@3.29.4)(vue@3.5.13(typescript@5.6.3))': @@ -8710,7 +8715,7 @@ snapshots: dependencies: '@eslint-community/eslint-utils': 4.4.1(eslint@9.16.0(jiti@2.4.1)) '@eslint-community/regexpp': 4.12.1 - '@eslint/config-array': 0.19.1 + '@eslint/config-array': 0.19.1(patch_hash=x7vaku5tfstwhfkemiablef5bi) '@eslint/core': 0.9.0 '@eslint/eslintrc': 3.2.0 '@eslint/js': 9.16.0 diff --git a/shared/configs.ts b/shared/configs.ts index 65b8f05..c409d23 100644 --- a/shared/configs.ts +++ b/shared/configs.ts @@ -1,3 +1,4 @@ +import type { Linter } from 'eslint' import type { FlatConfigItem, MatchedFile } from './types' import { ConfigArray } from '@eslint/config-array' import { Minimatch } from 'minimatch' @@ -16,7 +17,11 @@ function minimatch(file: string, pattern: string) { export function getMatchedGlobs(file: string, glob: (string | string[])[]) { const globs = (Array.isArray(glob) ? glob : [glob]).flat() - return globs.filter(glob => minimatch(file, glob)).flat() + return globs.filter((glob) => { + const matchResult = minimatch(file, glob) + // for unignore glob, we need to flip back the match + return glob.startsWith('!') ? !matchResult : matchResult + }).flat() } const META_KEYS = new Set(['name', 'index']) @@ -39,7 +44,7 @@ export function isGeneralConfig(config: FlatConfigItem) { export function matchFile( filepath: string, configs: FlatConfigItem[], - configArray: ConfigArray, + basePath: string, ): MatchedFile { const result: MatchedFile = { filepath, @@ -47,24 +52,16 @@ export function matchFile( configs: [], } - configs.forEach((config, index) => { - const isFileGlobalIgnored = configArray.isFileIgnored(filepath) - let isFileIgnoredInCurrConfig = false - if (config.ignores) { - const ignoreConfigArray = buildConfigArray([{ - index: config.index, - // only include ignores because of how ConfigArray works internally: - // isFileIgnored only works when only `ignore` exists - // (https://github.com/eslint/rewrite/blob/config-array-v0.19.1/packages/config-array/src/config-array.js#L726) - ignores: config.ignores ?? [], - }], configArray.basePath) - isFileIgnoredInCurrConfig = ignoreConfigArray.isFileIgnored(filepath) - } - + const { + config: globalMatchedConfig = {}, + status: globalMatchStatus, + } = buildConfigArray(configs, basePath).getConfigWithStatus(filepath) + configs.forEach((config) => { const positive = getMatchedGlobs(filepath, config.files || []) const negative = getMatchedGlobs(filepath, config.ignores || []) - if (!isFileGlobalIgnored && !isFileIgnoredInCurrConfig && positive.length > 0) { - result.configs.push(index) + + if (globalMatchStatus === 'matched' && globalMatchedConfig.index?.includes(config.index) && positive.length > 0) { + result.configs.push(config.index) // push positive globs only when there are configs matched result.globs.push(...positive) } @@ -89,11 +86,18 @@ const FLAT_CONFIG_NOOP_SCHEMA = { languageOptions: NOOP_SCHEMA, processor: NOOP_SCHEMA, plugins: NOOP_SCHEMA, + index: { + ...NOOP_SCHEMA, + // accumulate the matched config index to an array + merge(v1: number, v2: number) { + return [v1].concat(v2).flat() + }, + }, rules: NOOP_SCHEMA, } -export function buildConfigArray(configs: FlatConfigItem[], basePath: string) { - return new ConfigArray(configs.map(({ index: _, ...c }) => c), { +export function buildConfigArray(configs: Linter.Config[], basePath: string) { + return new ConfigArray(configs, { basePath, schema: FLAT_CONFIG_NOOP_SCHEMA, }).normalizeSync() diff --git a/shared/types.ts b/shared/types.ts index 022e9ec..f62327e 100644 --- a/shared/types.ts +++ b/shared/types.ts @@ -1,11 +1,8 @@ import type { RuleMetaData } from '@typescript-eslint/utils/ts-eslint' import type { Linter } from 'eslint' -export interface FlatConfigItem extends Omit { - name?: string +export interface FlatConfigItem extends Linter.Config { index: number - files?: (string | string[])[] - ignores?: string[] } export type RuleLevel = 'off' | 'warn' | 'error' diff --git a/src/configs.ts b/src/configs.ts index ccff7e8..fdc761e 100644 --- a/src/configs.ts +++ b/src/configs.ts @@ -1,3 +1,4 @@ +import type { Linter } from 'eslint' import type { FlatConfigItem, MatchedFile, Payload, RuleInfo } from '../shared/types' import { basename, dirname, relative, resolve } from 'node:path' import process from 'node:process' @@ -218,7 +219,7 @@ export async function readConfig( configs, rules, files: globFiles - ? await globMatchedFiles(basePath, rawConfigs) + ? await globMatchedFiles(basePath, configs, rawConfigs) : undefined, meta: { lastUpdate: Date.now(), @@ -237,19 +238,19 @@ export async function readConfig( export async function globMatchedFiles( basePath: string, configs: FlatConfigItem[], + rawConfigs: Linter.Config[], ): Promise { console.log(MARK_INFO, 'Globing matched files') - const configArray = buildConfigArray(configs, basePath) const files = (await configArrayFindFiles({ basePath, - configs: configArray, + configs: buildConfigArray(rawConfigs, basePath), })).toSorted() return files .map((filepath) => { filepath = relative(basePath, filepath) - const result = matchFile(filepath, configs, configArray) + const result = matchFile(filepath, configs, basePath) if (!result.configs.length) return undefined return result From 9abdd0ac2a19d5d5ec2b1cb4ad95e5850e31162e Mon Sep 17 00:00:00 2001 From: Charlie Croom Date: Fri, 27 Dec 2024 11:18:06 -0500 Subject: [PATCH 06/11] Add testing --- .github/workflows/ci.yml | 4 +- .mocharc.json | 4 ++ eslint.config.js | 3 +- package.json | 4 ++ pnpm-workspace.yaml | 5 ++- tests/shared_configs.test.ts | 85 ++++++++++++++++++++++++++++++++++++ tsconfig.json | 1 + 7 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 .mocharc.json create mode 100644 tests/shared_configs.test.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ef33ba..7a6c76a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,5 +64,5 @@ jobs: - name: Build run: nr build - # - name: Test - # run: nr test + - name: Test + run: nr test diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 0000000..e8ecf2c --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,4 @@ +{ + "$schema": "https://json.schemastore.org/mocharc.json", + "require": "tsx" +} diff --git a/eslint.config.js b/eslint.config.js index 65c9517..2829d51 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -12,11 +12,12 @@ export default nuxt() 'vue/no-extra-parens': 'off', }, }, + ignores: ['**/*.d.ts', '!**/special.d.ts'], }, ), ) .append({ - files: ['src/**/*.ts'], + files: ['src/**/*.d.ts'], rules: { 'no-console': 'off', }, diff --git a/package.json b/package.json index 661a291..503e933 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "start": "node bin.mjs", "prepack": "pnpm build", "lint": "nuxi prepare && eslint .", + "test": "mocha tests/**.ts", "typecheck": "vue-tsc --noEmit" }, "peerDependencies": { @@ -63,6 +64,7 @@ "@nuxt/eslint": "catalog:", "@shikijs/transformers": "catalog:", "@types/connect": "catalog:", + "@types/mocha": "catalog:", "@types/ws": "catalog:", "@typescript-eslint/utils": "catalog:", "@unocss/eslint-config": "catalog:", @@ -72,11 +74,13 @@ "floating-vue": "catalog:", "fuse.js": "catalog:", "lint-staged": "catalog:", + "mocha": "catalog:", "nuxt": "catalog:", "nuxt-eslint-auto-explicit-import": "catalog:", "shiki": "catalog:", "simple-git-hooks": "catalog:", "textmate-grammar-glob": "catalog:", + "tsx": "catalog:", "typescript": "catalog:", "unbuild": "catalog:", "vue-tsc": "catalog:" diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index dc13076..236a493 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -13,6 +13,7 @@ catalog: '@nuxt/eslint': ^0.7.2 '@shikijs/transformers': ^1.24.2 '@types/connect': ^3.4.38 + '@types/mocha': ^10.0.10 '@types/ws': ^8.5.13 '@typescript-eslint/utils': ^8.18.0 '@unocss/eslint-config': ^0.65.1 @@ -34,6 +35,7 @@ catalog: # v10.0 requires Node.js v20, so we stick with v9.0 minimatch: ^9.0.5 mlly: ^1.7.3 + mocha: ^10.4.0 mrmime: ^2.0.0 nitropack: 2.8.1 nuxt: ^3.14.1592 @@ -43,7 +45,8 @@ catalog: shiki: ^1.24.2 simple-git-hooks: ^2.11.1 textmate-grammar-glob: ^0.0.1 - typescript: ~5.6.3 + tsx: ^4.19.2 + typescript: ^5.6.3 unbuild: ^2.0.0 vue-tsc: ^2.1.10 ws: ^8.18.0 diff --git a/tests/shared_configs.test.ts b/tests/shared_configs.test.ts new file mode 100644 index 0000000..6781ed7 --- /dev/null +++ b/tests/shared_configs.test.ts @@ -0,0 +1,85 @@ +import assert from 'node:assert' +import { matchFile } from '../shared/configs.js' + +describe('matchFile', () => { + describe('global ignored', () => { + it('should match no configs', () => { + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['tests/**'] }], [{ index: 0, ignores: ['tests/**'] }]) + assert.deepEqual(result, { + filepath: 'tests/folder/foo.test.ts', + globs: ['tests/**'], + configs: [], + }) + }) + + it('should match when global ignored is a series of specificity', () => { + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['tests/**'] }], [{ index: 0, ignores: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'] }]) + assert.deepEqual(result, { + filepath: 'tests/folder/foo.test.ts', + globs: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'], + configs: [], + }) + }) + + it('should match when irrelevant unignores included', () => { + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['tests/**'] }], [{ index: 0, ignores: ['tests/**', '!tests/other/**', '!tests/*.test.ts'] }]) + assert.deepEqual(result, { + filepath: 'tests/folder/foo.test.ts', + globs: ['tests/**'], + configs: [], + }) + }) + + it('should not match when file is unignored', () => { + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['tests/**'] }], [{ index: 0, ignores: ['tests/**', '!tests/**/*.test.ts'] }]) + assert.deepEqual(result, { + filepath: 'tests/folder/foo.test.ts', + globs: ['tests/**'], + configs: [0], + }) + }) + }) + + describe('config matching', () => { + it('should match a basic config', () => { + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: [] }], []) + assert.deepEqual(result, { + filepath: 'tests/folder/foo.test.ts', + globs: ['**'], + configs: [0], + }) + }) + + it('should be ignored when a complex series of unignores and rematches', () => { + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'] }], []) + assert.deepEqual(result, { + filepath: 'tests/folder/foo.test.ts', + globs: ['**', 'tests/**', '!tests/folder/**', 'tests/**/*.test.ts'], + configs: [], + }) + }) + + it('should match when last matching glob is an unignored', () => { + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**'] }], []) + assert.deepEqual(result, { + filepath: 'tests/folder/foo.test.ts', + globs: ['**', 'tests/**', '!tests/folder/**'], + configs: [0], + }) + }) + + it ('should match multiple configs / a complex case', () => { + const result = matchFile('tests/folder/foo.test.ts', [ + { index: 0, files: ['**'], ignores: [] }, + { index: 1, files: ['**/*.miss.ts'], ignores: ['tests/**'] }, + { index: 2, files: ['**/*.miss.ts'], ignores: [] }, + { index: 3, files: ['**'], ignores: ['tests/**', '!**/*.ts'] }, + { index: 4, files: ['**'], ignores: ['tests/**.miss'] }, + { index: 5, files: ['**'], ignores: ['tests/**', '!tests/folder/*.foo', '!tests/folder/*.bar'] }, + { index: 6, files: ['**'], ignores: ['tests/**', '!tests/*.test.ts', 'tests/folder/*'] }, + { index: 7, files: ['**'], ignores: ['tests/**', '!tests/*.test.ts', 'tests/folder/*', '!tests/folder/*.ts'] }, + ], []) + assert.deepEqual(result.configs, [0, 3, 4, 7]) + }) + }) +}) diff --git a/tsconfig.json b/tsconfig.json index e5fea14..df65d10 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "moduleResolution": "Bundler", "resolveJsonModule": true, + "types": ["mocha"], "noEmit": true } } From bed49b38c69ffbc21548c9eac6ae0f3718e34bd1 Mon Sep 17 00:00:00 2001 From: Charlie Croom Date: Fri, 27 Dec 2024 11:19:59 -0500 Subject: [PATCH 07/11] Revert config --- eslint.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 2829d51..65c9517 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -12,12 +12,11 @@ export default nuxt() 'vue/no-extra-parens': 'off', }, }, - ignores: ['**/*.d.ts', '!**/special.d.ts'], }, ), ) .append({ - files: ['src/**/*.d.ts'], + files: ['src/**/*.ts'], rules: { 'no-console': 'off', }, From 5e60eb6f50205a155e08abd961dfe64128617cc9 Mon Sep 17 00:00:00 2001 From: Charlie Croom Date: Fri, 27 Dec 2024 11:23:24 -0500 Subject: [PATCH 08/11] little clean --- tests/shared_configs.test.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/shared_configs.test.ts b/tests/shared_configs.test.ts index 6781ed7..562cb86 100644 --- a/tests/shared_configs.test.ts +++ b/tests/shared_configs.test.ts @@ -3,8 +3,11 @@ import { matchFile } from '../shared/configs.js' describe('matchFile', () => { describe('global ignored', () => { + const testGlobalIgnores = (ignores: string[]) => { + return matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['tests/**'] }], [{ index: 0, ignores }]) + } it('should match no configs', () => { - const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['tests/**'] }], [{ index: 0, ignores: ['tests/**'] }]) + const result = testGlobalIgnores(['tests/**']) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', globs: ['tests/**'], @@ -13,7 +16,7 @@ describe('matchFile', () => { }) it('should match when global ignored is a series of specificity', () => { - const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['tests/**'] }], [{ index: 0, ignores: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'] }]) + const result = testGlobalIgnores(['tests/**', '!tests/folder/**', 'tests/**/*.test.ts']) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', globs: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'], @@ -22,7 +25,7 @@ describe('matchFile', () => { }) it('should match when irrelevant unignores included', () => { - const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['tests/**'] }], [{ index: 0, ignores: ['tests/**', '!tests/other/**', '!tests/*.test.ts'] }]) + const result = testGlobalIgnores(['tests/**', '!tests/other/**', '!tests/*.test.ts']) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', globs: ['tests/**'], @@ -31,7 +34,7 @@ describe('matchFile', () => { }) it('should not match when file is unignored', () => { - const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['tests/**'] }], [{ index: 0, ignores: ['tests/**', '!tests/**/*.test.ts'] }]) + const result = testGlobalIgnores(['tests/**', '!tests/**/*.test.ts']) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', globs: ['tests/**'], From 8e8eaf56848c9b7422e09598248b184afadce53b Mon Sep 17 00:00:00 2001 From: Charlie Croom Date: Fri, 27 Dec 2024 11:25:46 -0500 Subject: [PATCH 09/11] more clear --- tests/shared_configs.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/shared_configs.test.ts b/tests/shared_configs.test.ts index 562cb86..37e80c1 100644 --- a/tests/shared_configs.test.ts +++ b/tests/shared_configs.test.ts @@ -15,7 +15,7 @@ describe('matchFile', () => { }) }) - it('should match when global ignored is a series of specificity', () => { + it('should match when final matched glob is not an unignore', () => { const result = testGlobalIgnores(['tests/**', '!tests/folder/**', 'tests/**/*.test.ts']) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', @@ -34,7 +34,7 @@ describe('matchFile', () => { }) it('should not match when file is unignored', () => { - const result = testGlobalIgnores(['tests/**', '!tests/**/*.test.ts']) + const result = testGlobalIgnores(['tests/**', '!tests/**/*.test.ts', 'tests/other/**']) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', globs: ['tests/**'], @@ -53,7 +53,7 @@ describe('matchFile', () => { }) }) - it('should be ignored when a complex series of unignores and rematches', () => { + it('should be ignored when final matched glob is not an unignore', () => { const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'] }], []) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', @@ -62,8 +62,8 @@ describe('matchFile', () => { }) }) - it('should match when last matching glob is an unignored', () => { - const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**'] }], []) + it('should match when last matching glob is an unignore', () => { + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**', 'tests/other/**'] }], []) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', globs: ['**', 'tests/**', '!tests/folder/**'], @@ -80,7 +80,7 @@ describe('matchFile', () => { { index: 4, files: ['**'], ignores: ['tests/**.miss'] }, { index: 5, files: ['**'], ignores: ['tests/**', '!tests/folder/*.foo', '!tests/folder/*.bar'] }, { index: 6, files: ['**'], ignores: ['tests/**', '!tests/*.test.ts', 'tests/folder/*'] }, - { index: 7, files: ['**'], ignores: ['tests/**', '!tests/*.test.ts', 'tests/folder/*', '!tests/folder/*.ts'] }, + { index: 7, files: ['**'], ignores: ['tests/**', '!tests/*.test.ts', 'tests/folder/*', '!tests/folder/*.ts', 'tests/other/**'] }, ], []) assert.deepEqual(result.configs, [0, 3, 4, 7]) }) From 06c81e746c55cee188c21ecbd439064cd5d83e44 Mon Sep 17 00:00:00 2001 From: Wang Yiding Date: Mon, 30 Dec 2024 01:57:32 +0800 Subject: [PATCH 10/11] feat: update test and resolve conflicts --- pnpm-lock.yaml | 216 +++++++++++++++++++++++++++++------ tests/shared_configs.test.ts | 26 +++-- 2 files changed, 200 insertions(+), 42 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 32c71da..e72d135 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,6 +45,9 @@ catalogs: '@types/connect': specifier: ^3.4.38 version: 3.4.38 + '@types/mocha': + specifier: ^10.0.10 + version: 10.0.10 '@types/ws': specifier: ^8.5.13 version: 8.5.13 @@ -105,6 +108,9 @@ catalogs: mlly: specifier: ^1.7.3 version: 1.7.3 + mocha: + specifier: ^10.4.0 + version: 10.8.2 mrmime: specifier: ^2.0.0 version: 2.0.0 @@ -129,8 +135,11 @@ catalogs: textmate-grammar-glob: specifier: ^0.0.1 version: 0.0.1 + tsx: + specifier: ^4.19.2 + version: 4.19.2 typescript: - specifier: ~5.6.3 + specifier: ^5.6.3 version: 5.6.3 unbuild: specifier: ^2.0.0 @@ -239,6 +248,9 @@ importers: '@types/connect': specifier: 'catalog:' version: 3.4.38 + '@types/mocha': + specifier: 'catalog:' + version: 10.0.10 '@types/ws': specifier: 'catalog:' version: 8.5.13 @@ -266,6 +278,9 @@ importers: lint-staged: specifier: 'catalog:' version: 15.2.10 + mocha: + specifier: 'catalog:' + version: 10.8.2 nuxt: specifier: 'catalog:' version: 3.14.1592(@opentelemetry/api@1.8.0)(@parcel/watcher@2.4.1)(@types/node@20.12.11)(encoding@0.1.13)(eslint@9.16.0(jiti@2.4.1))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@3.29.4)(terser@5.31.0)(typescript@5.6.3)(vite@5.4.11(@types/node@20.12.11)(terser@5.31.0))(vue-tsc@2.1.10(typescript@5.6.3)) @@ -281,6 +296,9 @@ importers: textmate-grammar-glob: specifier: 'catalog:' version: 0.0.1 + tsx: + specifier: 'catalog:' + version: 4.19.2 typescript: specifier: 'catalog:' version: 5.6.3 @@ -1881,6 +1899,9 @@ packages: '@types/mdast@4.0.4': resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} + '@types/mocha@10.0.10': + resolution: {integrity: sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==} + '@types/ms@0.7.34': resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} @@ -2438,6 +2459,9 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + browser-stdout@1.3.1: + resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} + browserslist@4.24.2: resolution: {integrity: sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -2487,6 +2511,10 @@ packages: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} + camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + caniuse-api@3.0.0: resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==} @@ -2555,6 +2583,9 @@ packages: resolution: {integrity: sha512-5mOlNS0mhX0707P2I0aZ2V/cmHUEO/fL7VFLqszkhUsxt7RwnmrInf/eEQKlf5GzvYeHIjT+Ov1HRfNmymlG0w==} engines: {node: '>=18'} + cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + cliui@8.0.1: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} @@ -2752,6 +2783,10 @@ packages: supports-color: optional: true + decamelize@4.0.0: + resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} + engines: {node: '>=10'} + decode-named-character-reference@1.0.2: resolution: {integrity: sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==} @@ -2818,6 +2853,10 @@ packages: devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} + diff@5.2.0: + resolution: {integrity: sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==} + engines: {node: '>=0.3.1'} + diff@7.0.0: resolution: {integrity: sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==} engines: {node: '>=0.3.1'} @@ -3238,6 +3277,10 @@ packages: resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} engines: {node: '>=16'} + flat@5.0.2: + resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} + hasBin: true + flatted@3.3.2: resolution: {integrity: sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==} @@ -3571,6 +3614,10 @@ packages: resolution: {integrity: sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==} engines: {node: '>=12'} + is-plain-obj@2.1.0: + resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} + engines: {node: '>=8'} + is-primitive@3.0.1: resolution: {integrity: sha512-GljRxhWvlCNRfZyORiH77FwdFwGcMO620o37EOYC0ORWdq+WYNVqW0w2Juzew4M+L81l6/QS3t5gkkihyRqv9w==} engines: {node: '>=0.10.0'} @@ -3585,6 +3632,10 @@ packages: resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + is-unicode-supported@0.1.0: + resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} + engines: {node: '>=10'} + is-what@4.1.16: resolution: {integrity: sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==} engines: {node: '>=12.13'} @@ -3763,6 +3814,10 @@ packages: lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + log-symbols@4.1.0: + resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} + engines: {node: '>=10'} + log-update@6.1.0: resolution: {integrity: sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==} engines: {node: '>=18'} @@ -4008,6 +4063,11 @@ packages: mlly@1.7.3: resolution: {integrity: sha512-xUsx5n/mN0uQf4V548PKQ+YShA4/IW0KI1dZhrNrPCLG+xizETbHTkOa1f8/xut9JRPp8kQuMnz0oqwkTiLo/A==} + mocha@10.8.2: + resolution: {integrity: sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==} + engines: {node: '>= 14.0.0'} + hasBin: true + mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} @@ -5001,8 +5061,8 @@ packages: tslib@2.6.3: resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} - tsx@4.16.3: - resolution: {integrity: sha512-MP8AEUxVnboD2rCC6kDLxnpDBNWN9k3BSVU/0/nNxgm70bPBnfn+yCKcnOsIVPQwdkbKYoFOlKjjWZWJ2XCXUg==} + tsx@4.19.2: + resolution: {integrity: sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==} engines: {node: '>=18.0.0'} hasBin: true @@ -5400,6 +5460,9 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} + workerpool@6.5.1: + resolution: {integrity: sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==} + wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -5446,10 +5509,22 @@ packages: engines: {node: '>= 14'} hasBin: true + yargs-parser@20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} + engines: {node: '>=10'} + yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} + yargs-unparser@2.0.0: + resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} + engines: {node: '>=10'} + + yargs@16.2.0: + resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} + engines: {node: '>=10'} + yargs@17.7.2: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} @@ -5566,7 +5641,7 @@ snapshots: '@babel/traverse': 7.26.4 '@babel/types': 7.26.3 convert-source-map: 2.0.0 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -5726,7 +5801,7 @@ snapshots: '@babel/parser': 7.26.3 '@babel/template': 7.25.9 '@babel/types': 7.26.3 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -6132,7 +6207,7 @@ snapshots: '@eslint/config-array@0.18.0': dependencies: '@eslint/object-schema': 2.1.5 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -6140,7 +6215,7 @@ snapshots: '@eslint/config-array@0.19.1(patch_hash=x7vaku5tfstwhfkemiablef5bi)': dependencies: '@eslint/object-schema': 2.1.5 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -6175,7 +6250,7 @@ snapshots: '@eslint/eslintrc@3.2.0': dependencies: ajv: 6.12.6 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) espree: 10.3.0 globals: 14.0.0 ignore: 5.3.2 @@ -6267,7 +6342,7 @@ snapshots: '@antfu/install-pkg': 0.4.1 '@antfu/utils': 0.7.10 '@iconify/types': 2.0.0 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) kolorist: 1.8.0 local-pkg: 0.5.1 mlly: 1.7.3 @@ -6303,7 +6378,7 @@ snapshots: '@kwsites/file-exists@1.1.1': dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) transitivePeerDependencies: - supports-color @@ -7055,6 +7130,8 @@ snapshots: dependencies: '@types/unist': 3.0.3 + '@types/mocha@10.0.10': {} + '@types/ms@0.7.34': {} '@types/node@20.12.11': @@ -7097,7 +7174,7 @@ snapshots: '@typescript-eslint/types': 8.17.0 '@typescript-eslint/typescript-estree': 8.17.0(typescript@5.6.3) '@typescript-eslint/visitor-keys': 8.17.0 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) eslint: 9.16.0(jiti@2.4.1) optionalDependencies: typescript: 5.6.3 @@ -7118,7 +7195,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 8.17.0(typescript@5.6.3) '@typescript-eslint/utils': 8.17.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) eslint: 9.16.0(jiti@2.4.1) ts-api-utils: 1.3.0(typescript@5.6.3) optionalDependencies: @@ -7134,7 +7211,7 @@ snapshots: dependencies: '@typescript-eslint/types': 8.17.0 '@typescript-eslint/visitor-keys': 8.17.0 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 @@ -7149,7 +7226,7 @@ snapshots: dependencies: '@typescript-eslint/types': 8.18.0 '@typescript-eslint/visitor-keys': 8.18.0 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 @@ -7763,7 +7840,7 @@ snapshots: agent-base@6.0.2: dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) transitivePeerDependencies: - supports-color @@ -7889,6 +7966,8 @@ snapshots: dependencies: fill-range: 7.1.1 + browser-stdout@1.3.1: {} + browserslist@4.24.2: dependencies: caniuse-lite: 1.0.30001687 @@ -7954,6 +8033,8 @@ snapshots: callsites@3.1.0: {} + camelcase@6.3.0: {} + caniuse-api@3.0.0: dependencies: browserslist: 4.24.2 @@ -8025,6 +8106,12 @@ snapshots: is-wsl: 3.1.0 is64bit: 2.0.0 + cliui@7.0.4: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + cliui@8.0.1: dependencies: string-width: 4.2.3 @@ -8201,9 +8288,13 @@ snapshots: dependencies: ms: 2.1.3 - debug@4.3.7: + debug@4.3.7(supports-color@8.1.1): dependencies: ms: 2.1.3 + optionalDependencies: + supports-color: 8.1.1 + + decamelize@4.0.0: {} decode-named-character-reference@1.0.2: dependencies: @@ -8249,6 +8340,8 @@ snapshots: dependencies: dequal: 2.0.3 + diff@5.2.0: {} + diff@7.0.0: {} dir-glob@3.0.1: @@ -8527,7 +8620,7 @@ snapshots: dependencies: '@typescript-eslint/scope-manager': 8.18.0 '@typescript-eslint/utils': 8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) doctrine: 3.0.0 eslint: 9.16.0(jiti@2.4.1) eslint-import-resolver-node: 0.3.9 @@ -8546,7 +8639,7 @@ snapshots: '@es-joy/jsdoccomment': 0.49.0 are-docs-informative: 0.0.2 comment-parser: 1.4.1 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) escape-string-regexp: 4.0.0 eslint: 9.16.0(jiti@2.4.1) espree: 10.3.0 @@ -8609,7 +8702,7 @@ snapshots: eslint-plugin-toml@0.11.1(eslint@9.16.0(jiti@2.4.1)): dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) eslint: 9.16.0(jiti@2.4.1) eslint-compat-utils: 0.5.1(eslint@9.16.0(jiti@2.4.1)) lodash: 4.17.21 @@ -8641,7 +8734,7 @@ snapshots: dependencies: '@typescript-eslint/scope-manager': 8.18.0 '@typescript-eslint/utils': 8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) eslint: 9.16.0(jiti@2.4.1) pathe: 1.1.2 unimport: 3.14.5(rollup@3.29.4) @@ -8672,7 +8765,7 @@ snapshots: eslint-plugin-yml@1.16.0(eslint@9.16.0(jiti@2.4.1)): dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) eslint: 9.16.0(jiti@2.4.1) eslint-compat-utils: 0.6.4(eslint@9.16.0(jiti@2.4.1)) lodash: 4.17.21 @@ -8728,7 +8821,7 @@ snapshots: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.6 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) escape-string-regexp: 4.0.0 eslint-scope: 8.2.0 eslint-visitor-keys: 4.2.0 @@ -8880,6 +8973,8 @@ snapshots: flatted: 3.3.2 keyv: 4.5.4 + flat@5.0.2: {} + flatted@3.3.2: {} floating-vue@5.2.2(@nuxt/kit@3.14.1592(magicast@0.3.5)(rollup@3.29.4))(vue@3.5.13(typescript@5.6.3)): @@ -9099,7 +9194,7 @@ snapshots: https-proxy-agent@5.0.1: dependencies: agent-base: 6.0.2 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) transitivePeerDependencies: - supports-color @@ -9128,13 +9223,13 @@ snapshots: importx@0.4.3: dependencies: bundle-require: 5.0.0(esbuild@0.23.1) - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) esbuild: 0.23.1 jiti: 2.0.0-beta.2 jiti-v1: jiti@1.21.6 pathe: 1.1.2 pkg-types: 1.2.1 - tsx: 4.16.3 + tsx: 4.19.2 transitivePeerDependencies: - supports-color @@ -9167,7 +9262,7 @@ snapshots: dependencies: '@ioredis/commands': 1.2.0 cluster-key-slot: 1.1.2 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) denque: 2.1.0 lodash.defaults: 4.2.0 lodash.isarguments: 3.1.0 @@ -9229,6 +9324,8 @@ snapshots: is-path-inside@4.0.0: {} + is-plain-obj@2.1.0: {} + is-primitive@3.0.1: {} is-reference@1.2.1: @@ -9241,6 +9338,8 @@ snapshots: is-stream@3.0.0: {} + is-unicode-supported@0.1.0: {} + is-what@4.1.16: {} is-wsl@2.2.0: @@ -9347,7 +9446,7 @@ snapshots: dependencies: chalk: 5.3.0 commander: 12.1.0 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) execa: 8.0.1 lilconfig: 3.1.2 listr2: 8.2.4 @@ -9425,6 +9524,11 @@ snapshots: lodash@4.17.21: {} + log-symbols@4.1.0: + dependencies: + chalk: 4.1.2 + is-unicode-supported: 0.1.0 + log-update@6.1.0: dependencies: ansi-escapes: 7.0.0 @@ -9756,7 +9860,7 @@ snapshots: micromark@4.0.0: dependencies: '@types/debug': 4.1.12 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) decode-named-character-reference: 1.0.2 devlop: 1.1.0 micromark-core-commonmark: 2.0.1 @@ -9849,6 +9953,29 @@ snapshots: pkg-types: 1.2.1 ufo: 1.5.4 + mocha@10.8.2: + dependencies: + ansi-colors: 4.1.3 + browser-stdout: 1.3.1 + chokidar: 3.6.0 + debug: 4.3.7(supports-color@8.1.1) + diff: 5.2.0 + escape-string-regexp: 4.0.0 + find-up: 5.0.0 + glob: 8.1.0 + he: 1.2.0 + js-yaml: 4.1.0 + log-symbols: 4.1.0 + minimatch: 5.1.6 + ms: 2.1.3 + serialize-javascript: 6.0.2 + strip-json-comments: 3.1.1 + supports-color: 8.1.1 + workerpool: 6.5.1 + yargs: 16.2.0 + yargs-parser: 20.2.9 + yargs-unparser: 2.0.0 + mri@1.2.0: {} mrmime@2.0.0: {} @@ -10759,7 +10886,7 @@ snapshots: dependencies: '@kwsites/file-exists': 1.1.1 '@kwsites/promise-deferred': 1.1.1 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) transitivePeerDependencies: - supports-color @@ -11007,9 +11134,9 @@ snapshots: tslib@2.6.3: {} - tsx@4.16.3: + tsx@4.19.2: dependencies: - esbuild: 0.21.5 + esbuild: 0.23.1 get-tsconfig: 4.8.1 optionalDependencies: fsevents: 2.3.3 @@ -11298,7 +11425,7 @@ snapshots: vite-node@2.1.8(@types/node@20.12.11)(terser@5.31.0): dependencies: cac: 6.7.14 - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) es-module-lexer: 1.5.4 pathe: 1.1.2 vite: 5.4.11(@types/node@20.12.11)(terser@5.31.0) @@ -11340,7 +11467,7 @@ snapshots: dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.1.3(rollup@3.29.4) - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) error-stack-parser-es: 0.1.5 fs-extra: 11.2.0 open: 10.1.0 @@ -11410,7 +11537,7 @@ snapshots: vue-eslint-parser@9.4.3(eslint@9.16.0(jiti@2.4.1)): dependencies: - debug: 4.3.7 + debug: 4.3.7(supports-color@8.1.1) eslint: 9.16.0(jiti@2.4.1) eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 @@ -11512,6 +11639,8 @@ snapshots: word-wrap@1.2.5: {} + workerpool@6.5.1: {} + wrap-ansi@7.0.0: dependencies: ansi-styles: 4.3.0 @@ -11544,8 +11673,27 @@ snapshots: yaml@2.5.0: {} + yargs-parser@20.2.9: {} + yargs-parser@21.1.1: {} + yargs-unparser@2.0.0: + dependencies: + camelcase: 6.3.0 + decamelize: 4.0.0 + flat: 5.0.2 + is-plain-obj: 2.1.0 + + yargs@16.2.0: + dependencies: + cliui: 7.0.4 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.9 + yargs@17.7.2: dependencies: cliui: 8.0.1 diff --git a/tests/shared_configs.test.ts b/tests/shared_configs.test.ts index 37e80c1..7c28d2a 100644 --- a/tests/shared_configs.test.ts +++ b/tests/shared_configs.test.ts @@ -4,7 +4,8 @@ import { matchFile } from '../shared/configs.js' describe('matchFile', () => { describe('global ignored', () => { const testGlobalIgnores = (ignores: string[]) => { - return matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['tests/**'] }], [{ index: 0, ignores }]) + const configs = [{ index: 0, files: ['tests/folder/foo.test.ts'] }, { index: 1, ignores }] + return matchFile('tests/folder/foo.test.ts', configs, process.cwd()) } it('should match no configs', () => { const result = testGlobalIgnores(['tests/**']) @@ -33,11 +34,20 @@ describe('matchFile', () => { }) }) - it('should not match when file is unignored', () => { + it('should match when file is unignored but directory is ignored', () => { const result = testGlobalIgnores(['tests/**', '!tests/**/*.test.ts', 'tests/other/**']) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', - globs: ['tests/**'], + globs: ['tests/**', '!tests/**/*.test.ts'], + configs: [], + }) + }) + + it('should not match when file is unignored and directory is ignored but sub directory is unignored', () => { + const result = testGlobalIgnores(['tests/**/*', '!tests/**/*/', '!tests/**/*.test.ts', 'tests/other/**']) + assert.deepEqual(result, { + filepath: 'tests/folder/foo.test.ts', + globs: ['tests/folder/foo.test.ts', 'tests/**/*', '!tests/**/*.test.ts'], configs: [0], }) }) @@ -45,7 +55,7 @@ describe('matchFile', () => { describe('config matching', () => { it('should match a basic config', () => { - const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: [] }], []) + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: [] }], process.cwd()) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', globs: ['**'], @@ -54,16 +64,16 @@ describe('matchFile', () => { }) it('should be ignored when final matched glob is not an unignore', () => { - const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'] }], []) + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'] }], process.cwd()) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', - globs: ['**', 'tests/**', '!tests/folder/**', 'tests/**/*.test.ts'], + globs: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'], configs: [], }) }) it('should match when last matching glob is an unignore', () => { - const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**', 'tests/other/**'] }], []) + const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**', 'tests/other/**'] }], process.cwd()) assert.deepEqual(result, { filepath: 'tests/folder/foo.test.ts', globs: ['**', 'tests/**', '!tests/folder/**'], @@ -81,7 +91,7 @@ describe('matchFile', () => { { index: 5, files: ['**'], ignores: ['tests/**', '!tests/folder/*.foo', '!tests/folder/*.bar'] }, { index: 6, files: ['**'], ignores: ['tests/**', '!tests/*.test.ts', 'tests/folder/*'] }, { index: 7, files: ['**'], ignores: ['tests/**', '!tests/*.test.ts', 'tests/folder/*', '!tests/folder/*.ts', 'tests/other/**'] }, - ], []) + ], process.cwd()) assert.deepEqual(result.configs, [0, 3, 4, 7]) }) }) From e49cb7462b59b312b332570e4efb76f23cedd222 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Mon, 30 Dec 2024 11:45:25 +0800 Subject: [PATCH 11/11] chore: migrate to Vitest --- .mocharc.json | 4 - package.json | 6 +- pnpm-lock.yaml | 435 ++++++++++++++++++++--------------- tests/shared_configs.test.ts | 22 +- tsconfig.json | 1 - 5 files changed, 268 insertions(+), 200 deletions(-) delete mode 100644 .mocharc.json diff --git a/.mocharc.json b/.mocharc.json deleted file mode 100644 index e8ecf2c..0000000 --- a/.mocharc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/mocharc.json", - "require": "tsx" -} diff --git a/package.json b/package.json index 503e933..c5c115b 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "start": "node bin.mjs", "prepack": "pnpm build", "lint": "nuxi prepare && eslint .", - "test": "mocha tests/**.ts", + "test": "vitest", "typecheck": "vue-tsc --noEmit" }, "peerDependencies": { @@ -64,7 +64,6 @@ "@nuxt/eslint": "catalog:", "@shikijs/transformers": "catalog:", "@types/connect": "catalog:", - "@types/mocha": "catalog:", "@types/ws": "catalog:", "@typescript-eslint/utils": "catalog:", "@unocss/eslint-config": "catalog:", @@ -74,15 +73,14 @@ "floating-vue": "catalog:", "fuse.js": "catalog:", "lint-staged": "catalog:", - "mocha": "catalog:", "nuxt": "catalog:", "nuxt-eslint-auto-explicit-import": "catalog:", "shiki": "catalog:", "simple-git-hooks": "catalog:", "textmate-grammar-glob": "catalog:", - "tsx": "catalog:", "typescript": "catalog:", "unbuild": "catalog:", + "vitest": "^2.1.8", "vue-tsc": "catalog:" }, "pnpm": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e72d135..0691365 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,9 +45,6 @@ catalogs: '@types/connect': specifier: ^3.4.38 version: 3.4.38 - '@types/mocha': - specifier: ^10.0.10 - version: 10.0.10 '@types/ws': specifier: ^8.5.13 version: 8.5.13 @@ -108,9 +105,6 @@ catalogs: mlly: specifier: ^1.7.3 version: 1.7.3 - mocha: - specifier: ^10.4.0 - version: 10.8.2 mrmime: specifier: ^2.0.0 version: 2.0.0 @@ -135,9 +129,6 @@ catalogs: textmate-grammar-glob: specifier: ^0.0.1 version: 0.0.1 - tsx: - specifier: ^4.19.2 - version: 4.19.2 typescript: specifier: ^5.6.3 version: 5.6.3 @@ -214,7 +205,7 @@ importers: devDependencies: '@antfu/eslint-config': specifier: 'catalog:' - version: 3.11.2(@typescript-eslint/utils@8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(@unocss/eslint-plugin@0.65.1(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(@vue/compiler-sfc@3.5.13)(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) + version: 3.11.2(@typescript-eslint/utils@8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(@unocss/eslint-plugin@0.65.1(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(@vue/compiler-sfc@3.5.13)(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3)(vitest@2.1.8(@types/node@20.12.11)(terser@5.31.0)) '@iconify-json/carbon': specifier: 'catalog:' version: 1.2.4 @@ -248,9 +239,6 @@ importers: '@types/connect': specifier: 'catalog:' version: 3.4.38 - '@types/mocha': - specifier: 'catalog:' - version: 10.0.10 '@types/ws': specifier: 'catalog:' version: 8.5.13 @@ -278,9 +266,6 @@ importers: lint-staged: specifier: 'catalog:' version: 15.2.10 - mocha: - specifier: 'catalog:' - version: 10.8.2 nuxt: specifier: 'catalog:' version: 3.14.1592(@opentelemetry/api@1.8.0)(@parcel/watcher@2.4.1)(@types/node@20.12.11)(encoding@0.1.13)(eslint@9.16.0(jiti@2.4.1))(ioredis@5.4.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@3.29.4)(terser@5.31.0)(typescript@5.6.3)(vite@5.4.11(@types/node@20.12.11)(terser@5.31.0))(vue-tsc@2.1.10(typescript@5.6.3)) @@ -296,15 +281,15 @@ importers: textmate-grammar-glob: specifier: 'catalog:' version: 0.0.1 - tsx: - specifier: 'catalog:' - version: 4.19.2 typescript: specifier: 'catalog:' version: 5.6.3 unbuild: specifier: 'catalog:' version: 2.0.0(typescript@5.6.3)(vue-tsc@2.1.10(typescript@5.6.3)) + vitest: + specifier: ^2.1.8 + version: 2.1.8(@types/node@20.12.11)(terser@5.31.0) vue-tsc: specifier: 'catalog:' version: 2.1.10(typescript@5.6.3) @@ -1899,9 +1884,6 @@ packages: '@types/mdast@4.0.4': resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} - '@types/mocha@10.0.10': - resolution: {integrity: sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==} - '@types/ms@0.7.34': resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} @@ -2158,6 +2140,35 @@ packages: vitest: optional: true + '@vitest/expect@2.1.8': + resolution: {integrity: sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw==} + + '@vitest/mocker@2.1.8': + resolution: {integrity: sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@2.1.8': + resolution: {integrity: sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ==} + + '@vitest/runner@2.1.8': + resolution: {integrity: sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg==} + + '@vitest/snapshot@2.1.8': + resolution: {integrity: sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg==} + + '@vitest/spy@2.1.8': + resolution: {integrity: sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==} + + '@vitest/utils@2.1.8': + resolution: {integrity: sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==} + '@volar/language-core@2.4.10': resolution: {integrity: sha512-hG3Z13+nJmGaT+fnQzAkS0hjJRa2FCeqZt6Bd+oGNhUkQ+mTFsDETg5rqUTxyzIh5pSOGY7FHCWUS8G82AzLCA==} @@ -2406,6 +2417,10 @@ packages: argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + ast-kit@1.1.0: resolution: {integrity: sha512-RlNqd4u6c/rJ5R+tN/ZTtyNrH8X0NHCvyt6gD8RHa3JjzxxHWoyaU0Ujk3Zjbh7IZqrYl1Sxm6XzZifmVxXxHQ==} engines: {node: '>=16.14.0'} @@ -2459,9 +2474,6 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} - browser-stdout@1.3.1: - resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} - browserslist@4.24.2: resolution: {integrity: sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -2511,10 +2523,6 @@ packages: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} - camelcase@6.3.0: - resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} - engines: {node: '>=10'} - caniuse-api@3.0.0: resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==} @@ -2524,6 +2532,10 @@ packages: ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} + chai@5.1.2: + resolution: {integrity: sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==} + engines: {node: '>=12'} + chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -2541,6 +2553,10 @@ packages: character-entities@2.0.2: resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==} + check-error@2.1.1: + resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} + engines: {node: '>= 16'} + chokidar@3.6.0: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} @@ -2583,9 +2599,6 @@ packages: resolution: {integrity: sha512-5mOlNS0mhX0707P2I0aZ2V/cmHUEO/fL7VFLqszkhUsxt7RwnmrInf/eEQKlf5GzvYeHIjT+Ov1HRfNmymlG0w==} engines: {node: '>=18'} - cliui@7.0.4: - resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} - cliui@8.0.1: resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} engines: {node: '>=12'} @@ -2783,13 +2796,13 @@ packages: supports-color: optional: true - decamelize@4.0.0: - resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} - engines: {node: '>=10'} - decode-named-character-reference@1.0.2: resolution: {integrity: sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==} + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -2853,10 +2866,6 @@ packages: devlop@1.1.0: resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==} - diff@5.2.0: - resolution: {integrity: sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==} - engines: {node: '>=0.3.1'} - diff@7.0.0: resolution: {integrity: sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==} engines: {node: '>=0.3.1'} @@ -3213,6 +3222,10 @@ packages: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} + expect-type@1.1.0: + resolution: {integrity: sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==} + engines: {node: '>=12.0.0'} + externality@1.0.2: resolution: {integrity: sha512-LyExtJWKxtgVzmgtEHyQtLFpw1KFhQphF9nTG8TpAIVkiI/xQ3FJh75tRFLYl4hkn7BNIIdLJInuDAavX35pMw==} @@ -3277,10 +3290,6 @@ packages: resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} engines: {node: '>=16'} - flat@5.0.2: - resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} - hasBin: true - flatted@3.3.2: resolution: {integrity: sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==} @@ -3614,10 +3623,6 @@ packages: resolution: {integrity: sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==} engines: {node: '>=12'} - is-plain-obj@2.1.0: - resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} - engines: {node: '>=8'} - is-primitive@3.0.1: resolution: {integrity: sha512-GljRxhWvlCNRfZyORiH77FwdFwGcMO620o37EOYC0ORWdq+WYNVqW0w2Juzew4M+L81l6/QS3t5gkkihyRqv9w==} engines: {node: '>=0.10.0'} @@ -3632,10 +3637,6 @@ packages: resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - is-unicode-supported@0.1.0: - resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} - engines: {node: '>=10'} - is-what@4.1.16: resolution: {integrity: sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==} engines: {node: '>=12.13'} @@ -3814,10 +3815,6 @@ packages: lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} - log-symbols@4.1.0: - resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} - engines: {node: '>=10'} - log-update@6.1.0: resolution: {integrity: sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==} engines: {node: '>=18'} @@ -3825,6 +3822,9 @@ packages: longest-streak@3.1.0: resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==} + loupe@3.1.2: + resolution: {integrity: sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==} + lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} @@ -4063,11 +4063,6 @@ packages: mlly@1.7.3: resolution: {integrity: sha512-xUsx5n/mN0uQf4V548PKQ+YShA4/IW0KI1dZhrNrPCLG+xizETbHTkOa1f8/xut9JRPp8kQuMnz0oqwkTiLo/A==} - mocha@10.8.2: - resolution: {integrity: sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==} - engines: {node: '>= 14.0.0'} - hasBin: true - mri@1.2.0: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} @@ -4348,6 +4343,10 @@ packages: pathe@1.1.2: resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + pathval@2.0.0: + resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} + engines: {node: '>= 14.16'} + perfect-debounce@1.0.0: resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} @@ -4792,6 +4791,9 @@ packages: shiki@1.24.2: resolution: {integrity: sha512-TR1fi6mkRrzW+SKT5G6uKuc32Dj2EEa7Kj0k8kGqiBINb+C1TiflVOiT9ta6GqOJtC4fraxO5SLUaKBcSY38Fg==} + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} @@ -4879,6 +4881,9 @@ packages: stable-hash@0.0.4: resolution: {integrity: sha512-LjdcbuBeLcdETCrPn9i8AYAZ1eCtu4ECAWtP7UleOiZ9LzVxRzzUZEoZ8zB24nhkQnDWyET0I+3sWokSDS3E7g==} + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + standard-as-callback@2.1.0: resolution: {integrity: sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A==} @@ -5023,6 +5028,9 @@ packages: tiny-invariant@1.3.3: resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==} + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + tinyexec@0.3.1: resolution: {integrity: sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==} @@ -5030,6 +5038,18 @@ packages: resolution: {integrity: sha512-Zc+8eJlFMvgatPZTl6A9L/yht8QqdmUNtURHaKZLmKBE12hNPSrqNkUp2cs3M/UKmNVVAMFQYSjYIVHDjW5zew==} engines: {node: '>=12.0.0'} + tinypool@1.0.2: + resolution: {integrity: sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@1.2.0: + resolution: {integrity: sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==} + engines: {node: '>=14.0.0'} + + tinyspy@3.0.2: + resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} + engines: {node: '>=14.0.0'} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -5351,6 +5371,31 @@ packages: terser: optional: true + vitest@2.1.8: + resolution: {integrity: sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/node': ^18.0.0 || >=20.0.0 + '@vitest/browser': 2.1.8 + '@vitest/ui': 2.1.8 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + vscode-jsonrpc@6.0.0: resolution: {integrity: sha512-wnJA4BnEjOSyFMvjZdpiOwhSq9uDoK8e/kpRJDTaMYzwlkrhG1fwDIZI94CLsLzlCK5cIbMMtFlJlfR57Lavmg==} engines: {node: '>=8.0.0 || >=10.0.0'} @@ -5453,6 +5498,11 @@ packages: engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} hasBin: true + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + wide-align@1.1.5: resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} @@ -5460,9 +5510,6 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} - workerpool@6.5.1: - resolution: {integrity: sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==} - wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -5509,22 +5556,10 @@ packages: engines: {node: '>= 14'} hasBin: true - yargs-parser@20.2.9: - resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} - engines: {node: '>=10'} - yargs-parser@21.1.1: resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} engines: {node: '>=12'} - yargs-unparser@2.0.0: - resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} - engines: {node: '>=10'} - - yargs@16.2.0: - resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} - engines: {node: '>=10'} - yargs@17.7.2: resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==} engines: {node: '>=12'} @@ -5554,7 +5589,7 @@ snapshots: '@jridgewell/gen-mapping': 0.3.5 '@jridgewell/trace-mapping': 0.3.25 - '@antfu/eslint-config@3.11.2(@typescript-eslint/utils@8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(@unocss/eslint-plugin@0.65.1(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(@vue/compiler-sfc@3.5.13)(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3)': + '@antfu/eslint-config@3.11.2(@typescript-eslint/utils@8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(@unocss/eslint-plugin@0.65.1(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(@vue/compiler-sfc@3.5.13)(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3)(vitest@2.1.8(@types/node@20.12.11)(terser@5.31.0))': dependencies: '@antfu/install-pkg': 0.5.0 '@clack/prompts': 0.8.2 @@ -5563,7 +5598,7 @@ snapshots: '@stylistic/eslint-plugin': 2.11.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) '@typescript-eslint/eslint-plugin': 8.17.0(@typescript-eslint/parser@8.17.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) '@typescript-eslint/parser': 8.17.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) - '@vitest/eslint-plugin': 1.1.14(@typescript-eslint/utils@8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) + '@vitest/eslint-plugin': 1.1.14(@typescript-eslint/utils@8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3)(vitest@2.1.8(@types/node@20.12.11)(terser@5.31.0)) eslint: 9.16.0(jiti@2.4.1) eslint-config-flat-gitignore: 0.3.0(eslint@9.16.0(jiti@2.4.1)) eslint-flat-config-utils: 0.4.0 @@ -5641,7 +5676,7 @@ snapshots: '@babel/traverse': 7.26.4 '@babel/types': 7.26.3 convert-source-map: 2.0.0 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -5801,7 +5836,7 @@ snapshots: '@babel/parser': 7.26.3 '@babel/template': 7.25.9 '@babel/types': 7.26.3 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -6207,7 +6242,7 @@ snapshots: '@eslint/config-array@0.18.0': dependencies: '@eslint/object-schema': 2.1.5 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -6215,7 +6250,7 @@ snapshots: '@eslint/config-array@0.19.1(patch_hash=x7vaku5tfstwhfkemiablef5bi)': dependencies: '@eslint/object-schema': 2.1.5 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -6250,7 +6285,7 @@ snapshots: '@eslint/eslintrc@3.2.0': dependencies: ajv: 6.12.6 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 espree: 10.3.0 globals: 14.0.0 ignore: 5.3.2 @@ -6342,7 +6377,7 @@ snapshots: '@antfu/install-pkg': 0.4.1 '@antfu/utils': 0.7.10 '@iconify/types': 2.0.0 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 kolorist: 1.8.0 local-pkg: 0.5.1 mlly: 1.7.3 @@ -6378,7 +6413,7 @@ snapshots: '@kwsites/file-exists@1.1.1': dependencies: - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 transitivePeerDependencies: - supports-color @@ -7130,8 +7165,6 @@ snapshots: dependencies: '@types/unist': 3.0.3 - '@types/mocha@10.0.10': {} - '@types/ms@0.7.34': {} '@types/node@20.12.11': @@ -7174,7 +7207,7 @@ snapshots: '@typescript-eslint/types': 8.17.0 '@typescript-eslint/typescript-estree': 8.17.0(typescript@5.6.3) '@typescript-eslint/visitor-keys': 8.17.0 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 eslint: 9.16.0(jiti@2.4.1) optionalDependencies: typescript: 5.6.3 @@ -7195,7 +7228,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 8.17.0(typescript@5.6.3) '@typescript-eslint/utils': 8.17.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 eslint: 9.16.0(jiti@2.4.1) ts-api-utils: 1.3.0(typescript@5.6.3) optionalDependencies: @@ -7211,7 +7244,7 @@ snapshots: dependencies: '@typescript-eslint/types': 8.17.0 '@typescript-eslint/visitor-keys': 8.17.0 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 @@ -7226,7 +7259,7 @@ snapshots: dependencies: '@typescript-eslint/types': 8.18.0 '@typescript-eslint/visitor-keys': 8.18.0 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 @@ -7543,12 +7576,53 @@ snapshots: vite: 5.4.11(@types/node@20.12.11)(terser@5.31.0) vue: 3.5.13(typescript@5.6.3) - '@vitest/eslint-plugin@1.1.14(@typescript-eslint/utils@8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3)': + '@vitest/eslint-plugin@1.1.14(@typescript-eslint/utils@8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3))(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3)(vitest@2.1.8(@types/node@20.12.11)(terser@5.31.0))': dependencies: '@typescript-eslint/utils': 8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) eslint: 9.16.0(jiti@2.4.1) optionalDependencies: typescript: 5.6.3 + vitest: 2.1.8(@types/node@20.12.11)(terser@5.31.0) + + '@vitest/expect@2.1.8': + dependencies: + '@vitest/spy': 2.1.8 + '@vitest/utils': 2.1.8 + chai: 5.1.2 + tinyrainbow: 1.2.0 + + '@vitest/mocker@2.1.8(vite@5.4.11(@types/node@20.12.11)(terser@5.31.0))': + dependencies: + '@vitest/spy': 2.1.8 + estree-walker: 3.0.3 + magic-string: 0.30.14 + optionalDependencies: + vite: 5.4.11(@types/node@20.12.11)(terser@5.31.0) + + '@vitest/pretty-format@2.1.8': + dependencies: + tinyrainbow: 1.2.0 + + '@vitest/runner@2.1.8': + dependencies: + '@vitest/utils': 2.1.8 + pathe: 1.1.2 + + '@vitest/snapshot@2.1.8': + dependencies: + '@vitest/pretty-format': 2.1.8 + magic-string: 0.30.14 + pathe: 1.1.2 + + '@vitest/spy@2.1.8': + dependencies: + tinyspy: 3.0.2 + + '@vitest/utils@2.1.8': + dependencies: + '@vitest/pretty-format': 2.1.8 + loupe: 3.1.2 + tinyrainbow: 1.2.0 '@volar/language-core@2.4.10': dependencies: @@ -7840,7 +7914,7 @@ snapshots: agent-base@6.0.2: dependencies: - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 transitivePeerDependencies: - supports-color @@ -7912,6 +7986,8 @@ snapshots: argparse@2.0.1: {} + assertion-error@2.0.1: {} + ast-kit@1.1.0: dependencies: '@babel/parser': 7.26.3 @@ -7966,8 +8042,6 @@ snapshots: dependencies: fill-range: 7.1.1 - browser-stdout@1.3.1: {} - browserslist@4.24.2: dependencies: caniuse-lite: 1.0.30001687 @@ -8033,8 +8107,6 @@ snapshots: callsites@3.1.0: {} - camelcase@6.3.0: {} - caniuse-api@3.0.0: dependencies: browserslist: 4.24.2 @@ -8046,6 +8118,14 @@ snapshots: ccount@2.0.1: {} + chai@5.1.2: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.1 + deep-eql: 5.0.2 + loupe: 3.1.2 + pathval: 2.0.0 + chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -8059,6 +8139,8 @@ snapshots: character-entities@2.0.2: {} + check-error@2.1.1: {} + chokidar@3.6.0: dependencies: anymatch: 3.1.3 @@ -8106,12 +8188,6 @@ snapshots: is-wsl: 3.1.0 is64bit: 2.0.0 - cliui@7.0.4: - dependencies: - string-width: 4.2.3 - strip-ansi: 6.0.1 - wrap-ansi: 7.0.0 - cliui@8.0.1: dependencies: string-width: 4.2.3 @@ -8288,18 +8364,16 @@ snapshots: dependencies: ms: 2.1.3 - debug@4.3.7(supports-color@8.1.1): + debug@4.3.7: dependencies: ms: 2.1.3 - optionalDependencies: - supports-color: 8.1.1 - - decamelize@4.0.0: {} decode-named-character-reference@1.0.2: dependencies: character-entities: 2.0.2 + deep-eql@5.0.2: {} + deep-is@0.1.4: {} deepmerge@4.3.1: {} @@ -8340,8 +8414,6 @@ snapshots: dependencies: dequal: 2.0.3 - diff@5.2.0: {} - diff@7.0.0: {} dir-glob@3.0.1: @@ -8620,7 +8692,7 @@ snapshots: dependencies: '@typescript-eslint/scope-manager': 8.18.0 '@typescript-eslint/utils': 8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 doctrine: 3.0.0 eslint: 9.16.0(jiti@2.4.1) eslint-import-resolver-node: 0.3.9 @@ -8639,7 +8711,7 @@ snapshots: '@es-joy/jsdoccomment': 0.49.0 are-docs-informative: 0.0.2 comment-parser: 1.4.1 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 escape-string-regexp: 4.0.0 eslint: 9.16.0(jiti@2.4.1) espree: 10.3.0 @@ -8702,7 +8774,7 @@ snapshots: eslint-plugin-toml@0.11.1(eslint@9.16.0(jiti@2.4.1)): dependencies: - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 eslint: 9.16.0(jiti@2.4.1) eslint-compat-utils: 0.5.1(eslint@9.16.0(jiti@2.4.1)) lodash: 4.17.21 @@ -8734,7 +8806,7 @@ snapshots: dependencies: '@typescript-eslint/scope-manager': 8.18.0 '@typescript-eslint/utils': 8.18.0(eslint@9.16.0(jiti@2.4.1))(typescript@5.6.3) - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 eslint: 9.16.0(jiti@2.4.1) pathe: 1.1.2 unimport: 3.14.5(rollup@3.29.4) @@ -8765,7 +8837,7 @@ snapshots: eslint-plugin-yml@1.16.0(eslint@9.16.0(jiti@2.4.1)): dependencies: - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 eslint: 9.16.0(jiti@2.4.1) eslint-compat-utils: 0.6.4(eslint@9.16.0(jiti@2.4.1)) lodash: 4.17.21 @@ -8821,7 +8893,7 @@ snapshots: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.6 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 escape-string-regexp: 4.0.0 eslint-scope: 8.2.0 eslint-visitor-keys: 4.2.0 @@ -8907,6 +8979,8 @@ snapshots: signal-exit: 4.1.0 strip-final-newline: 3.0.0 + expect-type@1.1.0: {} + externality@1.0.2: dependencies: enhanced-resolve: 5.17.1 @@ -8973,8 +9047,6 @@ snapshots: flatted: 3.3.2 keyv: 4.5.4 - flat@5.0.2: {} - flatted@3.3.2: {} floating-vue@5.2.2(@nuxt/kit@3.14.1592(magicast@0.3.5)(rollup@3.29.4))(vue@3.5.13(typescript@5.6.3)): @@ -9194,7 +9266,7 @@ snapshots: https-proxy-agent@5.0.1: dependencies: agent-base: 6.0.2 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 transitivePeerDependencies: - supports-color @@ -9223,7 +9295,7 @@ snapshots: importx@0.4.3: dependencies: bundle-require: 5.0.0(esbuild@0.23.1) - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 esbuild: 0.23.1 jiti: 2.0.0-beta.2 jiti-v1: jiti@1.21.6 @@ -9262,7 +9334,7 @@ snapshots: dependencies: '@ioredis/commands': 1.2.0 cluster-key-slot: 1.1.2 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 denque: 2.1.0 lodash.defaults: 4.2.0 lodash.isarguments: 3.1.0 @@ -9324,8 +9396,6 @@ snapshots: is-path-inside@4.0.0: {} - is-plain-obj@2.1.0: {} - is-primitive@3.0.1: {} is-reference@1.2.1: @@ -9338,8 +9408,6 @@ snapshots: is-stream@3.0.0: {} - is-unicode-supported@0.1.0: {} - is-what@4.1.16: {} is-wsl@2.2.0: @@ -9446,7 +9514,7 @@ snapshots: dependencies: chalk: 5.3.0 commander: 12.1.0 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 execa: 8.0.1 lilconfig: 3.1.2 listr2: 8.2.4 @@ -9524,11 +9592,6 @@ snapshots: lodash@4.17.21: {} - log-symbols@4.1.0: - dependencies: - chalk: 4.1.2 - is-unicode-supported: 0.1.0 - log-update@6.1.0: dependencies: ansi-escapes: 7.0.0 @@ -9539,6 +9602,8 @@ snapshots: longest-streak@3.1.0: {} + loupe@3.1.2: {} + lru-cache@10.4.3: {} lru-cache@5.1.1: @@ -9860,7 +9925,7 @@ snapshots: micromark@4.0.0: dependencies: '@types/debug': 4.1.12 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 decode-named-character-reference: 1.0.2 devlop: 1.1.0 micromark-core-commonmark: 2.0.1 @@ -9953,29 +10018,6 @@ snapshots: pkg-types: 1.2.1 ufo: 1.5.4 - mocha@10.8.2: - dependencies: - ansi-colors: 4.1.3 - browser-stdout: 1.3.1 - chokidar: 3.6.0 - debug: 4.3.7(supports-color@8.1.1) - diff: 5.2.0 - escape-string-regexp: 4.0.0 - find-up: 5.0.0 - glob: 8.1.0 - he: 1.2.0 - js-yaml: 4.1.0 - log-symbols: 4.1.0 - minimatch: 5.1.6 - ms: 2.1.3 - serialize-javascript: 6.0.2 - strip-json-comments: 3.1.1 - supports-color: 8.1.1 - workerpool: 6.5.1 - yargs: 16.2.0 - yargs-parser: 20.2.9 - yargs-unparser: 2.0.0 - mri@1.2.0: {} mrmime@2.0.0: {} @@ -10417,6 +10459,8 @@ snapshots: pathe@1.1.2: {} + pathval@2.0.0: {} + perfect-debounce@1.0.0: {} picocolors@1.1.1: {} @@ -10876,6 +10920,8 @@ snapshots: '@shikijs/vscode-textmate': 9.3.0 '@types/hast': 3.0.4 + siginfo@2.0.0: {} + signal-exit@3.0.7: {} signal-exit@4.1.0: {} @@ -10886,7 +10932,7 @@ snapshots: dependencies: '@kwsites/file-exists': 1.1.1 '@kwsites/promise-deferred': 1.1.1 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 transitivePeerDependencies: - supports-color @@ -10958,6 +11004,8 @@ snapshots: stable-hash@0.0.4: {} + stackback@0.0.2: {} + standard-as-callback@2.1.0: optional: true @@ -11105,6 +11153,8 @@ snapshots: tiny-invariant@1.3.3: {} + tinybench@2.9.0: {} + tinyexec@0.3.1: {} tinyglobby@0.2.10: @@ -11112,6 +11162,12 @@ snapshots: fdir: 6.4.2(picomatch@4.0.2) picomatch: 4.0.2 + tinypool@1.0.2: {} + + tinyrainbow@1.2.0: {} + + tinyspy@3.0.2: {} + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 @@ -11425,7 +11481,7 @@ snapshots: vite-node@2.1.8(@types/node@20.12.11)(terser@5.31.0): dependencies: cac: 6.7.14 - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 es-module-lexer: 1.5.4 pathe: 1.1.2 vite: 5.4.11(@types/node@20.12.11)(terser@5.31.0) @@ -11467,7 +11523,7 @@ snapshots: dependencies: '@antfu/utils': 0.7.10 '@rollup/pluginutils': 5.1.3(rollup@3.29.4) - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 error-stack-parser-es: 0.1.5 fs-extra: 11.2.0 open: 10.1.0 @@ -11506,6 +11562,41 @@ snapshots: fsevents: 2.3.3 terser: 5.31.0 + vitest@2.1.8(@types/node@20.12.11)(terser@5.31.0): + dependencies: + '@vitest/expect': 2.1.8 + '@vitest/mocker': 2.1.8(vite@5.4.11(@types/node@20.12.11)(terser@5.31.0)) + '@vitest/pretty-format': 2.1.8 + '@vitest/runner': 2.1.8 + '@vitest/snapshot': 2.1.8 + '@vitest/spy': 2.1.8 + '@vitest/utils': 2.1.8 + chai: 5.1.2 + debug: 4.3.7 + expect-type: 1.1.0 + magic-string: 0.30.14 + pathe: 1.1.2 + std-env: 3.8.0 + tinybench: 2.9.0 + tinyexec: 0.3.1 + tinypool: 1.0.2 + tinyrainbow: 1.2.0 + vite: 5.4.11(@types/node@20.12.11)(terser@5.31.0) + vite-node: 2.1.8(@types/node@20.12.11)(terser@5.31.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 20.12.11 + transitivePeerDependencies: + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vscode-jsonrpc@6.0.0: {} vscode-languageclient@7.0.0: @@ -11537,7 +11628,7 @@ snapshots: vue-eslint-parser@9.4.3(eslint@9.16.0(jiti@2.4.1)): dependencies: - debug: 4.3.7(supports-color@8.1.1) + debug: 4.3.7 eslint: 9.16.0(jiti@2.4.1) eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 @@ -11633,14 +11724,17 @@ snapshots: dependencies: isexe: 2.0.0 + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + wide-align@1.1.5: dependencies: string-width: 4.2.3 word-wrap@1.2.5: {} - workerpool@6.5.1: {} - wrap-ansi@7.0.0: dependencies: ansi-styles: 4.3.0 @@ -11673,27 +11767,8 @@ snapshots: yaml@2.5.0: {} - yargs-parser@20.2.9: {} - yargs-parser@21.1.1: {} - yargs-unparser@2.0.0: - dependencies: - camelcase: 6.3.0 - decamelize: 4.0.0 - flat: 5.0.2 - is-plain-obj: 2.1.0 - - yargs@16.2.0: - dependencies: - cliui: 7.0.4 - escalade: 3.2.0 - get-caller-file: 2.0.5 - require-directory: 2.1.1 - string-width: 4.2.3 - y18n: 5.0.8 - yargs-parser: 20.2.9 - yargs@17.7.2: dependencies: cliui: 8.0.1 diff --git a/tests/shared_configs.test.ts b/tests/shared_configs.test.ts index 7c28d2a..ec1b073 100644 --- a/tests/shared_configs.test.ts +++ b/tests/shared_configs.test.ts @@ -1,5 +1,5 @@ -import assert from 'node:assert' -import { matchFile } from '../shared/configs.js' +import { describe, expect, it } from 'vitest' +import { matchFile } from '../shared/configs' describe('matchFile', () => { describe('global ignored', () => { @@ -9,7 +9,7 @@ describe('matchFile', () => { } it('should match no configs', () => { const result = testGlobalIgnores(['tests/**']) - assert.deepEqual(result, { + expect(result).toEqual({ filepath: 'tests/folder/foo.test.ts', globs: ['tests/**'], configs: [], @@ -18,7 +18,7 @@ describe('matchFile', () => { it('should match when final matched glob is not an unignore', () => { const result = testGlobalIgnores(['tests/**', '!tests/folder/**', 'tests/**/*.test.ts']) - assert.deepEqual(result, { + expect(result).toEqual({ filepath: 'tests/folder/foo.test.ts', globs: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'], configs: [], @@ -27,7 +27,7 @@ describe('matchFile', () => { it('should match when irrelevant unignores included', () => { const result = testGlobalIgnores(['tests/**', '!tests/other/**', '!tests/*.test.ts']) - assert.deepEqual(result, { + expect(result).toEqual({ filepath: 'tests/folder/foo.test.ts', globs: ['tests/**'], configs: [], @@ -36,7 +36,7 @@ describe('matchFile', () => { it('should match when file is unignored but directory is ignored', () => { const result = testGlobalIgnores(['tests/**', '!tests/**/*.test.ts', 'tests/other/**']) - assert.deepEqual(result, { + expect(result).toEqual({ filepath: 'tests/folder/foo.test.ts', globs: ['tests/**', '!tests/**/*.test.ts'], configs: [], @@ -45,7 +45,7 @@ describe('matchFile', () => { it('should not match when file is unignored and directory is ignored but sub directory is unignored', () => { const result = testGlobalIgnores(['tests/**/*', '!tests/**/*/', '!tests/**/*.test.ts', 'tests/other/**']) - assert.deepEqual(result, { + expect(result).toEqual({ filepath: 'tests/folder/foo.test.ts', globs: ['tests/folder/foo.test.ts', 'tests/**/*', '!tests/**/*.test.ts'], configs: [0], @@ -56,7 +56,7 @@ describe('matchFile', () => { describe('config matching', () => { it('should match a basic config', () => { const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: [] }], process.cwd()) - assert.deepEqual(result, { + expect(result).toEqual({ filepath: 'tests/folder/foo.test.ts', globs: ['**'], configs: [0], @@ -65,7 +65,7 @@ describe('matchFile', () => { it('should be ignored when final matched glob is not an unignore', () => { const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'] }], process.cwd()) - assert.deepEqual(result, { + expect(result).toEqual({ filepath: 'tests/folder/foo.test.ts', globs: ['tests/**', '!tests/folder/**', 'tests/**/*.test.ts'], configs: [], @@ -74,7 +74,7 @@ describe('matchFile', () => { it('should match when last matching glob is an unignore', () => { const result = matchFile('tests/folder/foo.test.ts', [{ index: 0, files: ['**'], ignores: ['tests/**', '!tests/folder/**', 'tests/other/**'] }], process.cwd()) - assert.deepEqual(result, { + expect(result).toEqual({ filepath: 'tests/folder/foo.test.ts', globs: ['**', 'tests/**', '!tests/folder/**'], configs: [0], @@ -92,7 +92,7 @@ describe('matchFile', () => { { index: 6, files: ['**'], ignores: ['tests/**', '!tests/*.test.ts', 'tests/folder/*'] }, { index: 7, files: ['**'], ignores: ['tests/**', '!tests/*.test.ts', 'tests/folder/*', '!tests/folder/*.ts', 'tests/other/**'] }, ], process.cwd()) - assert.deepEqual(result.configs, [0, 3, 4, 7]) + expect(result.configs).toEqual([0, 3, 4, 7]) }) }) }) diff --git a/tsconfig.json b/tsconfig.json index df65d10..e5fea14 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "moduleResolution": "Bundler", "resolveJsonModule": true, - "types": ["mocha"], "noEmit": true } }