snippets.spec.ts — vite Source File
Architecture documentation for snippets.spec.ts, a typescript file in the vite codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 91faf3c1_99a4_1091_6836_b828c5b773b5["snippets.spec.ts"] ce349c09_3cd5_548b_1a03_c4108351206c["snippets.ts"] 91faf3c1_99a4_1091_6836_b828c5b773b5 --> ce349c09_3cd5_548b_1a03_c4108351206c a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"] 91faf3c1_99a4_1091_6836_b828c5b773b5 --> a340ba46_b2b7_3048_3bb3_6907a74c8464 eb36dc59_cf42_f93f_d835_cb822a39e8a6["acorn"] 91faf3c1_99a4_1091_6836_b828c5b773b5 --> eb36dc59_cf42_f93f_d835_cb822a39e8a6 style 91faf3c1_99a4_1091_6836_b828c5b773b5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { describe, expect, test } from 'vitest'
import type { ecmaVersion } from 'acorn'
import { parse } from 'acorn'
import {
detectModernBrowserCode,
detectModernBrowserDetector,
dynamicFallbackInlineCode,
safari10NoModuleFix,
systemJSInlineCode,
} from '../snippets'
const shouldFailVersions: ecmaVersion[] = []
for (let v = 2015; v <= 2019; v++) {
shouldFailVersions.push(v as ecmaVersion)
}
const shouldPassVersions: ecmaVersion[] = []
for (let v = 2020; v <= 2024; v++) {
shouldPassVersions.push(v as ecmaVersion)
}
for (const version of shouldFailVersions) {
test(`detect code should not be able to be parsed with ES${version}`, () => {
expect(() => {
parse(detectModernBrowserDetector, {
ecmaVersion: version,
sourceType: 'module',
})
}).toThrow()
})
}
for (const version of shouldPassVersions) {
test(`detect code should be able to be parsed with ES${version}`, () => {
expect(() => {
parse(detectModernBrowserDetector, {
ecmaVersion: version,
sourceType: 'module',
})
}).not.toThrow()
})
}
describe('snippets are valid', () => {
const codes = {
safari10NoModuleFix,
systemJSInlineCode,
detectModernBrowserCode,
dynamicFallbackInlineCode,
}
for (const [name, value] of Object.entries(codes)) {
test(`${name} is valid JS`, () => {
expect(() => {
parse(value, {
ecmaVersion: 'latest',
sourceType: 'module',
})
}).not.toThrow()
})
}
})
Domain
Dependencies
- acorn
- snippets.ts
- vitest
Source
Frequently Asked Questions
What does snippets.spec.ts do?
snippets.spec.ts is a source file in the vite codebase, written in typescript. It belongs to the PluginSystem domain.
What does snippets.spec.ts depend on?
snippets.spec.ts imports 3 module(s): acorn, snippets.ts, vitest.
Where is snippets.spec.ts in the architecture?
snippets.spec.ts is located at packages/plugin-legacy/src/__tests__/snippets.spec.ts (domain: PluginSystem, directory: packages/plugin-legacy/src/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free