Skip to content

Commit

Permalink
fix(gatsby): test plugin name to handle symlinks, rather than path
Browse files Browse the repository at this point in the history
This simple PR augments the behavior to test the plugin's name, rather
than the plugin's resolved path, in the case that it could be
symlinked/linked. This seems to match the behavior we're expecting, and
_again_ will be cleaned up when gatsbyjs#10787 lands.
  • Loading branch information
DSchau committed Jan 4, 2019
1 parent d21fd99 commit 0624e4d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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
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-`)) {
merged.push(plugin.resolve)
}
return merged
Expand Down

0 comments on commit 0624e4d

Please sign in to comment.