We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If your application code imports a graphql query which itself imports a fragment, then vitest will crash:
App.tsx:
import QUERY from "./Query.gql" console.log(QUERY)
Query.gql
#import "./Fragment.gql" query Foo { currentUser { ...CurrentUserFields } }
Fragment.gql:
fragment CurrentUserFields on User { id }
yarn test:
FAIL src/App.test.tsx [ src/App.test.tsx ] Error: Parse failure: Unexpected token (1:9) Contents of line 1: fragment CurrentUserFields on User {
However, the code works correctly in the vite dev environment:
yarn dev:
Reproduction here: maxsalven/vitest-gql-bug@9b0ee6e
(Based off of https://github.com/vitest-dev/vitest/tree/main/examples/react-storybook-testing but it's not Storybook specific)
System: OS: macOS 12.1 CPU: (10) arm64 Apple M1 Max Memory: 107.22 MB / 64.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.13.1 - /var/folders/0c/63_dh8t91pg75b9w6sktbpw80000gn/T/fnm_multishells/90199_1645152149094/bin/node Yarn: 1.22.17 - /opt/homebrew/bin/yarn npm: 8.1.2 - /var/folders/0c/63_dh8t91pg75b9w6sktbpw80000gn/T/fnm_multishells/90199_1645152149094/bin/npm Browsers: Chrome: 98.0.4758.102 Safari: 15.2 npmPackages: @vitejs/plugin-react: ^1.2.0 => 1.2.0 vite: latest => 2.8.3 vitest: latest => 0.3.6
yarn
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Describe the bug
If your application code imports a graphql query which itself imports a fragment, then vitest will crash:
App.tsx:
Query.gql
Fragment.gql:
yarn test:
However, the code works correctly in the vite dev environment:
yarn dev:
Reproduction
Reproduction here:
maxsalven/vitest-gql-bug@9b0ee6e
(Based off of https://github.com/vitest-dev/vitest/tree/main/examples/react-storybook-testing but it's not Storybook specific)
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: