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

Expression statements do not work with trailing semicolons #27

Closed
mjbcopland opened this issue Apr 28, 2019 · 1 comment
Closed

Expression statements do not work with trailing semicolons #27

mjbcopland opened this issue Apr 28, 2019 · 1 comment

Comments

@mjbcopland
Copy link

const assert = require("assert");
const { gqlPluckFromCodeString } = require("graphql-tag-pluck");

assert.equal(gqlPluckFromCodeString("/* GraphQL */ `{}`"), "{}");
assert.equal(gqlPluckFromCodeString("/* GraphQL */ `{}`;"), "{}");
assert.equal(gqlPluckFromCodeString("/* GraphQL */ `{}`;"), "{}");
       ^
AssertionError [ERR_ASSERTION]: '{}`' == '{}'

 

The whole expression statement node is passed to pluckStringFromFile() so when we go to trim the quotes here, we actually trim the opening quote and trailing semicolon, leaving the closing quote in the output.

@ardatan
Copy link
Collaborator

ardatan commented Jul 2, 2019

Fixed in 0.8.3!

@ardatan ardatan closed this as completed Jul 2, 2019
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 a pull request may close this issue.

2 participants