Skip to content

Commit

Permalink
test: native typescript loader
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Feb 7, 2025
1 parent 27ac983 commit d708e42
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/__snapshots__/built-in.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`built-in typescript 1`] = `
{
"foo": "bar",
}
`;
14 changes: 14 additions & 0 deletions test/built-in.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { resolve } from 'node:path'
import { expect, it } from 'vitest'
import { loadConfig } from '../src'

const fixtureDir = resolve(__dirname, 'fixtures')

it.skipIf(!process.features.typescript && !process.versions.bun)('built-in typescript', async () => {
const cwd = resolve(fixtureDir, 'builtin')
const result = await loadConfig({
sources: [{ files: 'un.config' }],
cwd,
})
expect(result.config).toMatchSnapshot()
})
5 changes: 5 additions & 0 deletions test/fixtures/builtin/un.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let foo: string = 'bar'

Check failure on line 1 in test/fixtures/builtin/un.config.ts

View workflow job for this annotation

GitHub Actions / build (lts/*, ubuntu-latest)

'foo' is never reassigned. Use 'const' instead

export default {
foo,
}

0 comments on commit d708e42

Please sign in to comment.