test: remove this.parse test

This commit is contained in:
Kevin Deng 2025-11-04 15:17:15 +08:00
parent f4cf1c59fc
commit 37a74bd133
No known key found for this signature in database
2 changed files with 0 additions and 45 deletions

View File

@ -189,29 +189,6 @@ describe('bun utils', () => {
expect(mockWriteFileSync).not.toHaveBeenCalled()
})
it('should parse code with acorn', () => {
const mockBuild = { config: { outdir: '/path/to/outdir' } }
const context = createBuildContext(mockBuild as PluginBuilder)
const ast = context.parse('const x = 1')
expect(ast).toBeDefined()
expect(ast.type).toBe('Program')
expect((ast as any).body).toHaveLength(1)
expect((ast as any).body[0].type).toBe('VariableDeclaration')
})
it('should parse code with custom options', () => {
const mockBuild = { config: { outdir: '/path/to/outdir' } }
const context = createBuildContext(mockBuild as PluginBuilder)
const ast = context.parse('const x = 1', {
sourceType: 'script',
ecmaVersion: 2015,
})
expect(ast).toBeDefined()
expect(ast.type).toBe('Program')
})
it('should return native build context', () => {
const mockBuild = { config: { outdir: '/path/to/outdir' } }
const context = createBuildContext(mockBuild as PluginBuilder)

View File

@ -1,22 +0,0 @@
import { describe, expect, it } from 'vitest'
import { parse } from '../../../src/utils/parse'
describe('parse', () => {
it('should parse valid JavaScript code', () => {
const code = 'const x = 42;'
const result = parse(code)
expect(result).toBeDefined()
})
it('should throw an error for invalid JavaScript code', () => {
const code = 'const x = ;'
expect(() => parse(code)).toThrow()
})
it('should accept custom options', () => {
const code = 'const x = 42;'
const opts = { ecmaVersion: 2020 }
const result = parse(code, opts)
expect(result).toBeDefined()
})
})