-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix vitest in Astro 5 * Add a changeset
- Loading branch information
Showing
11 changed files
with
254 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Fixes use of Vitest with Astro 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineConfig } from 'astro/config'; | ||
|
||
export default defineConfig({ | ||
output: "static", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "@test/vitest", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"test": "vitest run" | ||
}, | ||
"dependencies": { | ||
"astro": "workspace:*", | ||
"vitest": "^2.1.1" | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/astro/test/fixtures/vitest/src/components/hello.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { expect, test } from 'vitest'; | ||
|
||
test('sup', () => { | ||
expect(true).toBeTruthy(); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<html> | ||
<head> | ||
<title>testing</title> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/// <reference types="vitest" /> | ||
import { getViteConfig } from 'astro/config'; | ||
|
||
export default getViteConfig({ | ||
test: { | ||
// Vitest configuration options | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
import assert from 'node:assert/strict'; | ||
import { describe, it } from 'node:test'; | ||
import { fileURLToPath } from 'node:url'; | ||
import { createVitest } from 'vitest/node' | ||
|
||
describe('vitest', () => { | ||
it('basics', async () => { | ||
const config = new URL('./fixtures/vitest/vitest.config.js', import.meta.url); | ||
|
||
const vitest = await createVitest('test', { | ||
config: fileURLToPath(config), | ||
root: fileURLToPath(new URL('./fixtures/vitest/', import.meta.url)), | ||
watch: false | ||
}); | ||
|
||
try { | ||
await vitest.start(); | ||
} catch(_) { | ||
assert.ok(false, 'test failed'); | ||
} finally { | ||
await vitest.close(); | ||
} | ||
}); | ||
}); |
Oops, something went wrong.