36223f663e
* feat: add astro/compat entrypoint for vitest * chore: add with-vitest example * chore: add vitest as optional peer dependency * chore: update lockfile * refactor: remove astro/compat, use astro/config * feat: allow arbitrary modes for `create-vite` * feat: pass vite mode and command when using `getViteConfig` * chore: remove vitest from peer deps * chore: add changeset * chore: update lockfile Co-authored-by: Nate Moore <nate@astro.build>
21 lines
478 B
TypeScript
21 lines
478 B
TypeScript
import { assert, expect, test } from 'vitest'
|
|
|
|
// Edit an assertion and save to see HMR in action
|
|
|
|
test('Math.sqrt()', () => {
|
|
expect(Math.sqrt(4)).toBe(2)
|
|
expect(Math.sqrt(144)).toBe(12)
|
|
expect(Math.sqrt(2)).toBe(Math.SQRT2)
|
|
})
|
|
|
|
test('JSON', () => {
|
|
const input = {
|
|
foo: 'hello',
|
|
bar: 'world',
|
|
}
|
|
|
|
const output = JSON.stringify(input)
|
|
|
|
expect(output).eq('{"foo":"hello","bar":"world"}')
|
|
assert.deepEqual(JSON.parse(output), input, 'matches original')
|
|
})
|