-
Notifications
You must be signed in to change notification settings - Fork 993
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(internal): switch to vitest (#10162)
This PR switches out the `@redwoodjs/internal` package to use vitest over jest for its tests. There are two points to note here: 1. I had to add a `resolve.alias` to the `vitest.config.mts` in order to only have one copy of `graphql` load. Without this change a copy from their `index.js` and another copy from their `index.mjs` would load and `graphql` forbids two instances running at the same time. There are additional comments within the config file which include links for more details. 2. We have to avoid the `require('@prisma/client')` call and so it became a dynamic import. This required the function to be async and that cascaded to other functions. Namely; `getPrismaModels`, `getPluginConfig`, and `getPrismaClient`. From what I can see there is no usage of these functions outside this internal package and the additional asyncs added here are sufficient.
- Loading branch information
1 parent
7e3ec43
commit bec7b02
Showing
32 changed files
with
199 additions
and
133 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
packages/internal/src/__tests__/__snapshots__/graphqlCodeGen.test.ts.snap
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
2 changes: 1 addition & 1 deletion
2
packages/internal/src/__tests__/__snapshots__/graphqlSchema.test.ts.snap
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
4 changes: 2 additions & 2 deletions
4
packages/internal/src/__tests__/__snapshots__/possibleTypes.test.ts.snap
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
2 changes: 1 addition & 1 deletion
2
packages/internal/src/__tests__/__snapshots__/typeDefinitions.test.ts.snap
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
20 changes: 10 additions & 10 deletions
20
packages/internal/src/__tests__/__snapshots__/validateSchemaForReservedNames.test.ts.snap
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,19 +1,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`SDL with no reserved names used SDL is invalid because uses a reserved name as a type 1`] = ` | ||
"The type named 'Float' is a reserved GraphQL name. | ||
exports[`SDL with no reserved names used > SDL is invalid > because uses a reserved name as a type 1`] = ` | ||
[TypeError: The type named 'Float' is a reserved GraphQL name. | ||
Please rename it to something more specific, like: ApplicationFloat. | ||
" | ||
] | ||
`; | ||
|
||
exports[`SDL with no reserved names used because uses a reserved name as an input 1`] = ` | ||
"The input type named 'Float' is a reserved GraphQL name. | ||
exports[`SDL with no reserved names used > because uses a reserved name as an input 1`] = ` | ||
[TypeError: The input type named 'Float' is a reserved GraphQL name. | ||
Please rename it to something more specific, like: ApplicationFloat. | ||
" | ||
] | ||
`; | ||
|
||
exports[`SDL with no reserved names used because uses a reserved name as an interface 1`] = ` | ||
"The interface named 'Float' is a reserved GraphQL name. | ||
exports[`SDL with no reserved names used > because uses a reserved name as an interface 1`] = ` | ||
[TypeError: The interface named 'Float' is a reserved GraphQL name. | ||
Please rename it to something more specific, like: ApplicationFloat. | ||
" | ||
] | ||
`; |
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
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
Oops, something went wrong.