Skip to content
New issue

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

Add test scaffolding for vscode-graphql-syntax #3267

Closed
wants to merge 1 commit into from
Closed

Add test scaffolding for vscode-graphql-syntax #3267

wants to merge 1 commit into from

Conversation

AaronMoat
Copy link
Contributor

@AaronMoat AaronMoat commented Jun 24, 2023

Resolves: #2343

Saw the discussion in #3217 and wanted to revive the older discussion in #2343. Main question - do we think this approach will be helpful, or should we look into something more style/visual based?

@changeset-bot
Copy link

changeset-bot bot commented Jun 24, 2023

⚠️ No Changeset found

Latest commit: f252d51

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets
Name Type
cm6-graphql Patch
codemirror-graphql Patch
@graphiql/plugin-code-exporter Patch
@graphiql/plugin-explorer Patch
@graphiql/react Patch
graphiql Patch
graphql-language-service-cli Patch
graphql-language-service-server Patch
graphql-language-service Patch
monaco-graphql Patch
vscode-graphql-execution Patch
vscode-graphql-syntax Patch
vscode-graphql Patch

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@AaronMoat
Copy link
Contributor Author

AaronMoat commented Jun 24, 2023

Ok, immediate problem, prettier autoformatting indents comments, whereas the package doesn't support unit tests unless the line literally starts with #. I'm thinking we need something more manual OR something visual. (at least as well as this)

@acao
Copy link
Member

acao commented Jun 24, 2023

@AaronMoat this is awesome! I find it visual enough for our needs. and also, prettier should not be formatting snapshots anyways!

just add this to .prettierignore:

**/*.snap

@AaronMoat
Copy link
Contributor Author

Hi @acao, I was actually talking about the unit tests. You can do stuff like...

query {
  something
# ^ do some assertions here
}

But prettier adds two spaces before the # and the "unit test" assertion no longer runs. I suppose we could ignore just the plain .graphql files too 🤔

I'm tempted to see what this stuff looks by-hand with jest, etc, anyway, I'll have a play and put an alternate PR up (if I get something sensible)

@acao
Copy link
Member

acao commented Jun 24, 2023

we shouldn't ignore all plain .graphql files, but if you need them for this, you can set specific ignore rules for these unit tests. this is the only syntax extension so it would make sense.

sure, jest sounds nice! @B2o5T wants to move to vitest. I just made it so that jest doesn't need a build step anymore, except for cm6-graphql, so you can run yarn test for the whole monorepo without any build steps being necessary, enjoy!

@AaronMoat
Copy link
Contributor Author

Have put an alternative in #3273 😄

@AaronMoat
Copy link
Contributor Author

Closing in favour of #3273

@AaronMoat AaronMoat closed this Jun 28, 2023
@AaronMoat AaronMoat deleted the vscode-graphql-syntax-test branch June 28, 2023 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

proposal: introduce VSCode Textmate grammar test for testing grammar
2 participants