-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
"SyntaxError: Unexpected string" when implementing unit testing guide on stock blog starter #9614
Labels
type: question or discussion
Issue discussing or asking a question about Gatsby
Comments
This commit implements babel-preset-gatsby, which does the same thing as below: const babelOptions = {
presets: ["@babel/react", "@babel/env"],
plugins: [
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-class-properties",
],
}; I'm able to reproduce this issue, but I'm not sure why this is causing the problem. @pieh any ideas regarding this? |
@ebello @kakadiadarpan I'll check this out right now! |
DSchau
added a commit
to DSchau/gatsby
that referenced
this issue
Nov 1, 2018
This PR does a few things, namely: - Fixes a few things with the test stage, e.g. uses commonjs modules for test running, uses the current node version for @babel/preset-env, etc. - Fixes up docs slightly for the unit testing guide - Fixes gatsbyjs#9614
Excellent, thank you @DSchau! |
pieh
pushed a commit
that referenced
this issue
Nov 5, 2018
This PR does a few things, namely: - Fixes a few things with the test stage, e.g. uses commonjs modules for test running, uses the current node version for @babel/preset-env, etc. - Fixes up docs slightly for the unit testing guide - Fixes #9614 <!-- Q. Which branch should I use for my pull request? A. Use `master` branch (probably). Q. Which branch if my change is a bug fix for Gatsby v1? A. In this case, you should use the `v1` branch Q. Which branch if I'm still not sure? A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :) Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2. Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/ -->
gpetrioli
pushed a commit
to gpetrioli/gatsby
that referenced
this issue
Jan 22, 2019
…#9629) This PR does a few things, namely: - Fixes a few things with the test stage, e.g. uses commonjs modules for test running, uses the current node version for @babel/preset-env, etc. - Fixes up docs slightly for the unit testing guide - Fixes gatsbyjs#9614 <!-- Q. Which branch should I use for my pull request? A. Use `master` branch (probably). Q. Which branch if my change is a bug fix for Gatsby v1? A. In this case, you should use the `v1` branch Q. Which branch if I'm still not sure? A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :) Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2. Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/ -->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
I am receiving an error when running
yarn test
after installing the gatsby-starter-blog and going through the Unit testing guide. The error I receive is:Steps to reproduce
I have a demo repo here: gatsby-starter-blog-jest-error
yarn
yarn test
Expected result
I should receive the
SyntaxError: Invalid or unexpected token
forimport 'typeface-montserrat'
as referenced in the guide.Actual result
I receive an error relating to babel not being able to transform the test file. It seems to be a regression from this commit: 2788f93. If I revert the
babelOptions
back to the following, I get the expected result above.Environment
The text was updated successfully, but these errors were encountered: