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): test plugin name to handle symlinks, rather than path #10835

Merged
merged 1 commit into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ describe(`resolveThemes`, () => {
it(`returns empty array if zero themes detected`, () => {
;[
[],
[{ resolve: path.join(base, `gatsby-plugin-whatever`) }],
[
{
name: `gatsby-plugin-whatever`,
resolve: path.join(base, `gatsby-plugin-whatever`),
},
],
undefined,
].forEach(testRun => {
expect(resolveThemes(testRun)).toEqual([])
Expand All @@ -80,6 +85,7 @@ describe(`resolveThemes`, () => {
expect(
resolveThemes([
{
name: theme,
resolve: path.join(base, `gatsby-theme-example`),
},
])
Expand All @@ -92,6 +98,7 @@ describe(`resolveThemes`, () => {
expect(
resolveThemes([
{
name: theme,
resolve: path.join(base, theme),
},
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const overlayErrorID = `graphql-compiler`

const resolveThemes = (plugins = []) =>
plugins.reduce((merged, plugin) => {
if (plugin.resolve.includes(`gatsby-theme-`)) {
if (plugin.name.includes(`gatsby-theme-`)) {
Copy link
Contributor Author

@DSchau DSchau Jan 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plugin.resolve is the symlinked path when running yarn link or npm link. This change will work with symlinked modules and "regular" (e.g. modules in node_modules) alike.

merged.push(plugin.resolve)
}
return merged
Expand Down