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
feat: webpack test stack #3240
Merged
Merged
feat: webpack test stack #3240
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6b411f9
feat: add webpack test stack
zekth d0d7ac1
feat: add bundler test version
zekth 05d5a8b
fix: set minimum version
zekth bc636f5
docs: add bundler test doc
zekth 924b9b4
fix: review
zekth 08010f0
Merge branch 'main' into webpack_package
mcollina File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict' | ||
|
||
const t = require('tap') | ||
const test = t.test | ||
const fastifySuccess = require('./dist/success') | ||
const fastifyFailPlugin = require('./dist/failPlugin') | ||
|
||
test('Bundler should work', t => { | ||
t.plan(1) | ||
fastifySuccess.ready((err) => { | ||
t.error(err) | ||
}) | ||
}) | ||
|
||
// Untill there is no proper solution for bundlers, the fastify version | ||
// is set to undefined for this context | ||
test('Bundler should work with bad plugin version, undefined version', t => { | ||
t.plan(1) | ||
fastifyFailPlugin.ready((err) => { | ||
t.error(err) | ||
}) | ||
}) |
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,11 @@ | ||
{ | ||
"version":"0.0.1", | ||
"scripts": { | ||
"bundle": "webpack", | ||
"test": "npm run bundle && node bundler-test.js" | ||
}, | ||
"devDependencies": { | ||
"webpack": "^5.49.0", | ||
"webpack-cli": "^4.7.2" | ||
} | ||
} |
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 @@ | ||
const fp = require('fastify-plugin') | ||
const fastify = require('../../../../')({ | ||
logger: true | ||
}) | ||
|
||
fastify.get('/', function (request, reply) { | ||
reply.send({ hello: 'world' }) | ||
}) | ||
|
||
fastify.register(fp((instance, opts, done) => { | ||
done() | ||
}, { fastify: '9.x' })) | ||
|
||
module.exports = fastify |
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,9 @@ | ||
const fastify = require('../../../../')({ | ||
logger: true | ||
}) | ||
// Declare a route | ||
fastify.get('/', function (request, reply) { | ||
reply.send({ hello: 'world' }) | ||
}) | ||
|
||
module.exports = fastify |
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,13 @@ | ||
const path = require('path') | ||
|
||
module.exports = { | ||
entry: { success: './src/index.js', failPlugin: './src/fail-plugin-version.js' }, | ||
target: 'node', | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: '[name].js', | ||
library: { | ||
type: 'commonjs2' | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this test going to pass or not? I'm not sure it would. Maybe we should skip it in case - I want all the CI to stay green.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So theorically on a non bundled environment it would fail, but on bundled environment because of the fallback in here:
fastify/fastify.js
Line 688 in a90c68b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify the comment so that it's clear what we should change here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure