generated from netlify/build-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: skip work when gatsby version supports adapters (#639)
* feat: skip work when gatsby version supports adapters * fix: unit tests * feat: log that work is skipped when adapters are used * test: add e2e test * test: add unit test for shouldSkip * test: log version * test: check both stdout and stderr for logs * test: bump timeout * test: bump canary version --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
25ca2ca
commit 1e9ba48
Showing
45 changed files
with
1,091 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pickle=word |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
node_modules/ | ||
.cache/ | ||
public | ||
|
||
# Local Netlify folder | ||
.netlify | ||
netlify/functions/gatsby/functions | ||
deployment.json | ||
|
||
# @netlify/plugin-gatsby ignores start | ||
netlify/functions/gatsby | ||
# @netlify/plugin-gatsby ignores end | ||
|
||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v14.17.0 |
41 changes: 41 additions & 0 deletions
41
plugin/test/fixtures/v5/with-adapters/e2e-tests/__snapshots__/functions.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Local functions can parse different ways of sending data file in multipart/form 1`] = ` | ||
Object { | ||
"body": Object { | ||
"something": "here", | ||
}, | ||
"files": Array [ | ||
Object { | ||
"buffer": Object { | ||
"data": Array [ | ||
104, | ||
105, | ||
], | ||
"type": "Buffer", | ||
}, | ||
"encoding": "7bit", | ||
"fieldname": "file", | ||
"mimetype": "text/plain", | ||
"originalname": "test.txt", | ||
"size": 2, | ||
}, | ||
], | ||
} | ||
`; | ||
|
||
exports[`Local routing dynamic routes 1`] = ` | ||
Object { | ||
"super": "additional", | ||
"userId": "23", | ||
} | ||
`; | ||
|
||
exports[`Local routing dynamic routes 2`] = ` | ||
Object { | ||
"*": "super", | ||
"0": "super", | ||
} | ||
`; | ||
|
||
exports[`Local routing routes with special characters 1`] = `"I-Am-Capitalized.js"`; |
33 changes: 33 additions & 0 deletions
33
plugin/test/fixtures/v5/with-adapters/e2e-tests/build.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// eslint-disable-next-line node/no-unpublished-require | ||
const { buildSite } = require('../../../../helpers') | ||
const { readFileSync } = require('fs') | ||
|
||
jest.setTimeout(240_000) | ||
describe('A site using gatsby version with adapters', () => { | ||
it('successfully builds and disables @netlify/plugin-gatsby and gatsby-plugin-netlify', async () => { | ||
const { | ||
success, | ||
logs: { stdout, stderr }, | ||
} = await buildSite() | ||
|
||
// in CI warnings are outputted to stderr (yikes) | ||
const fullOutput = stdout + stderr | ||
|
||
expect(success).toBeTruthy() | ||
|
||
expect(fullOutput).toContain( | ||
'Skipping @netlify/plugin-gatsby work, because used Gatsby version supports adapters.', | ||
) | ||
expect(fullOutput).toContain('Disabling plugin "gatsby-plugin-netlify"') | ||
|
||
const _redirectsContent = readFileSync('public/_redirects', 'utf8') | ||
|
||
expect(_redirectsContent).not.toContain( | ||
'# @netlify/plugin-gatsby redirects start', | ||
) | ||
expect(_redirectsContent).not.toContain( | ||
'## Created with gatsby-plugin-netlify', | ||
) | ||
expect(_redirectsContent).toContain('# gatsby-adapter-netlify start') | ||
}) | ||
}) |
1 change: 1 addition & 0 deletions
1
plugin/test/fixtures/v5/with-adapters/e2e-tests/fixtures/test.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hi |
8 changes: 8 additions & 0 deletions
8
plugin/test/fixtures/v5/with-adapters/e2e-tests/functions.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const { runTests } = require('./test-helpers') | ||
|
||
if (process.env.TEST_ENV === 'netlify') { | ||
const { deploy_url } = require('../deployment.json') | ||
runTests('Netlify', deploy_url) | ||
} else { | ||
runTests('Local', 'http://localhost:8888') | ||
} |
Oops, something went wrong.