Skip to content

Commit 1e7760e

Browse files
authored
test: correct esbuild useDefineForClassFields test (#206)
1 parent a6ea3f8 commit 1e7760e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/vite/src/node/__tests__/plugins/esbuild.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import path from 'node:path'
12
import { describe, expect, test } from 'vitest'
23
import type { ResolvedConfig, UserConfig } from '../../config'
34
import {
45
resolveEsbuildTranspileOptions,
56
transformWithEsbuild,
67
} from '../../plugins/esbuild'
8+
import { normalizePath } from '../../utils'
79

810
describe('resolveEsbuildTranspileOptions', () => {
911
test('resolve default', () => {
@@ -326,7 +328,7 @@ describe('transformWithEsbuild', () => {
326328
bar = 'bar'
327329
}
328330
`,
329-
'bar.ts',
331+
normalizePath(path.resolve(import.meta.dirname, 'bar.ts')),
330332
{
331333
target,
332334
tsconfigRaw: { compilerOptions: tsconfigCompilerOptions },
@@ -387,7 +389,9 @@ describe('transformWithEsbuild', () => {
387389
})
388390

389391
test('target: es2022 and tsconfig.target: undefined => false', async () => {
390-
const actual = await transformClassCode('es2022', {})
392+
const actual = await transformClassCode('es2022', {
393+
target: undefined,
394+
})
391395
expect(actual).toBe(defineForClassFieldsFalseTransformedCode)
392396
})
393397
})

0 commit comments

Comments
 (0)