1
0
mirror of synced 2025-12-19 09:57:42 -05:00

Bump vitest from 3.1.2 to 4.0.4 (#58241)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
This commit is contained in:
dependabot[bot]
2025-11-03 15:57:12 +00:00
committed by GitHub
parent e102fb874d
commit 5770366ade
5 changed files with 355 additions and 329 deletions

634
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -316,7 +316,7 @@
"typescript": "^5.8.3",
"unist-util-remove": "^4.0.0",
"unist-util-visit-parents": "6.0.1",
"vitest": "^3.1.2",
"vitest": "^4.0.4",
"website-scraper": "^5.3.1"
},
"overrides": {

View File

@@ -22,7 +22,8 @@ function loadTableSchemas(): DataSchemas {
const schemaPath = path.join(schemasDir, `${name}.ts`)
if (fs.existsSync(schemaPath)) {
tableSchemas[`data/tables/${yamlFile}`] = `@/data-directory/lib/data-schemas/tables/${name}`
// Use relative path from test file for vitest 4.x compatibility with dynamic imports
tableSchemas[`data/tables/${yamlFile}`] = `../lib/data-schemas/tables/${name}.ts`
}
}
}
@@ -31,14 +32,15 @@ function loadTableSchemas(): DataSchemas {
}
// Manual schema registrations for non-table data
// Use relative paths from the test file for vitest 4.x compatibility with dynamic imports
const manualSchemas: DataSchemas = {
'data/features': '@/data-directory/lib/data-schemas/features',
'data/variables': '@/data-directory/lib/data-schemas/variables',
'data/learning-tracks': '@/data-directory/lib/data-schemas/learning-tracks',
'data/release-notes': '@/data-directory/lib/data-schemas/release-notes',
'data/code-languages.yml': '@/data-directory/lib/data-schemas/code-languages',
'data/glossaries/candidates.yml': '@/data-directory/lib/data-schemas/glossaries-candidates',
'data/glossaries/external.yml': '@/data-directory/lib/data-schemas/glossaries-external',
'data/features': '../lib/data-schemas/features.ts',
'data/variables': '../lib/data-schemas/variables.ts',
'data/learning-tracks': '../lib/data-schemas/learning-tracks.ts',
'data/release-notes': '../lib/data-schemas/release-notes.ts',
'data/code-languages.yml': '../lib/data-schemas/code-languages.ts',
'data/glossaries/candidates.yml': '../lib/data-schemas/glossaries-candidates.ts',
'data/glossaries/external.yml': '../lib/data-schemas/glossaries-external.ts',
}
// Combine manual registrations with auto-discovered table schemas

View File

@@ -4,9 +4,15 @@ import { cuss } from 'cuss'
import { cuss as cussPt } from 'cuss/pt'
import { cuss as cussFr } from 'cuss/fr'
import { cuss as cussEs } from 'cuss/es'
import { Language } from '@horizon-rs/language-guesser'
let language: any = null
const language = new Language()
async function getLanguageInstance() {
if (!language) {
const { Language } = await import('@horizon-rs/language-guesser')
language = new Language()
}
return language
}
// Exported for the debugging CLI script
export const SIGNAL_RATINGS = [
@@ -48,8 +54,8 @@ export const SIGNAL_RATINGS = [
{
reduction: 0.2,
name: 'not-language',
validator: (comment: string, commentLanguage: string) =>
isNotLanguage(comment, commentLanguage),
validator: async (comment: string, commentLanguage: string) =>
await isNotLanguage(comment, commentLanguage),
},
{
reduction: 0.3,
@@ -80,7 +86,8 @@ export async function getGuessedLanguage(comment: string) {
return
}
const bestGuess = language.guessBest(comment.trim(), [])
const lang = await getLanguageInstance()
const bestGuess = lang.guessBest(comment.trim(), [])
if (!bestGuess) return // Can happen if the text is just whitespace
// // @horizon-rs/language-guesser is based on tri-grams and can lead
// // to false positives. For example, it thinks that 'Thamk you ❤️🙏' is
@@ -98,7 +105,7 @@ export async function analyzeComment(text: string, commentLanguage = 'en') {
const signals = []
let rating = 1.0
for (const { reduction, name, validator } of SIGNAL_RATINGS) {
if (validator(text, commentLanguage)) {
if (await validator(text, commentLanguage)) {
signals.push(name)
rating -= reduction
}
@@ -153,8 +160,9 @@ function isSingleWord(text: string) {
return whitespaceSplit.length === 1
}
function isNotLanguage(text: string, language_: string) {
const bestGuess = language.guessBest(text.trim(), [])
async function isNotLanguage(text: string, language_: string) {
const lang = await getLanguageInstance()
const bestGuess = lang.guessBest(text.trim(), [])
if (!bestGuess) return true // Can happen if the text is just whitespace
// @horizon-rs/language-guesser is based on tri-grams and can lead
// to false positives. For example, it thinks that 'Thamk you ❤️🙏' is

View File

@@ -14,4 +14,10 @@ export default {
globalSetup: './src/tests/vitest.setup.ts',
teardownTimeout: 500,
},
server: {
deps: {
// Externalize @horizon-rs/language-guesser to avoid import assertion issues with vitest 4
external: ['@horizon-rs/language-guesser'],
},
},
}