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

fix(gatsby-plugin-mdx): Fix not passing file path to remark plugins #26914

Merged
merged 2 commits into from Sep 23, 2020

Conversation

kevin940726
Copy link
Contributor

@kevin940726 kevin940726 commented Sep 16, 2020

Description

Fix a regression where gatsby-plugin-mdx fails to pass the file path to remark plugins.

Tested both manually and using the added e2e test.

Documentation

https://www.gatsbyjs.com/plugins/gatsby-plugin-mdx/#remark-plugins

Related Issues

Related to #21489

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 16, 2020
@kevin940726 kevin940726 changed the title Fix gatsby-plugin-mdx not passing file path to remark plugins fix(gatsby-plugin-mdx): Fix not passing file path to remark plugins Sep 16, 2020
@LekoArts LekoArts added topic: MDX and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Sep 21, 2020
@laurieontech
Copy link
Contributor

Thanks for the PR! It looks like you've added a function that will throw an error to the test site but no corresponding tests? Can we add something that specifies this behavior, or maybe some comments for context?

In general, I think the code change should be fine.

@kevin940726
Copy link
Contributor Author

kevin940726 commented Sep 21, 2020

I thought that the e2e-test site IS the test? If we revert the changes, then the test will fail. Adding some comments sounds nice! Though I also think that the error message is the context? I can still add it though if you think it'd be better :).

@laurieontech
Copy link
Contributor

Inside the cypress folder is the set of tests that run against that site. And by the comments I was thinking a note about the fact that the message appears if file paths aren't passed correctly.

@kevin940726
Copy link
Contributor Author

@laurieontech Got it! However though, if I understand correctly, the cypress tests are for testing the page but not the setup. The added test plugin is trying to test the setup to make sure it can read the file argument correctly as expected during build time. I'm starting to wonder if it's the right place to add the test there 🤔 ?

The error message "No directory name for this markdown file!" will appear if the file paths aren't passed correctly though, just that it's not in the same format as other existing cypress tests.

@laurieontech
Copy link
Contributor

Ya, the challenge here is this is arguably an e2e test that is also an integration test. It impacts the build rather than the render. I think we're ok to leave it where it is but would love to add a comment in the gatsby-config file near the function explaining what the test is for. If the error message doesn't appear, or even if it does, some additional context is needed.

@kevin940726
Copy link
Contributor Author

@laurieontech sounds good! Just added the comments. Please have a look :)

@laurieontech
Copy link
Contributor

Thanks @kevin940726! Appreciate the fix and additional clarity.

@laurieontech laurieontech merged commit 5d39594 into gatsbyjs:master Sep 23, 2020
@kevin940726 kevin940726 deleted the fix-mdx-file-path branch September 23, 2020 15:38
pragmaticpat pushed a commit to pragmaticpat/gatsby that referenced this pull request Apr 28, 2022
…atsbyjs#26914)

* Fix gatsby-plugin-mdx not passing file path to remark plugins

* Add comments for the test
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.

None yet

3 participants