forked from redwoodjs/redwood
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(vite): switch to vitest (redwoodjs#9868)
- Loading branch information
1 parent
8467a7c
commit 1a1e758
Showing
6 changed files
with
35 additions
and
64 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
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
18 changes: 7 additions & 11 deletions
18
packages/vite/src/plugins/__tests__/swap-apollo-provider.test.mts
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 |
---|---|---|
@@ -1,18 +1,14 @@ | ||
import assert from 'node:assert/strict' | ||
import { describe, it } from 'node:test' | ||
|
||
import plugin from '../vite-plugin-swap-apollo-provider.js' | ||
|
||
// @ts-expect-error node test not configured correctly | ||
const swapApolloProvider = plugin.default | ||
|
||
import swapApolloProvider from '../vite-plugin-swap-apollo-provider' | ||
import { describe, it, expect } from 'vitest' | ||
|
||
describe('excludeModule', () => { | ||
it('should swap the import', async() => { | ||
it('should swap the import', async () => { | ||
const plugin = swapApolloProvider() | ||
|
||
const output = await plugin.transform(`import ApolloProvider from '@redwoodjs/web/apollo'`, '/Users/dac09/Experiments/ssr-2354/web/src/App.tsx') | ||
// @ts-expect-error The PluginOption type is 'false | Plugin_2 | PluginOption[] | Promise<false | Plugin_2 | PluginOption[] | null | undefined>' which does not gaurentee that the transform method exists. | ||
const output = await plugin.transform(`import ApolloProvider from '@redwoodjs/web/apollo'`, '/Users/dac09/Experiments/ssr-2354/web/src/App.tsx') | ||
|
||
assert.strictEqual(output, "import ApolloProvider from '@redwoodjs/web/dist/apollo/suspense'") | ||
}) | ||
expect(output).toEqual("import ApolloProvider from '@redwoodjs/web/dist/apollo/suspense'") | ||
}) | ||
}) |
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 @@ | ||
import { defineConfig, configDefaults } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
exclude: [...configDefaults.exclude, '**/fixtures'], | ||
}, | ||
}) |
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