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

adapt plugin to hapi v17 #16

Merged
merged 5 commits into from
Jun 27, 2018
Merged

adapt plugin to hapi v17 #16

merged 5 commits into from
Jun 27, 2018

Conversation

maoeye18
Copy link
Contributor

hapi v17 release notes: hapijs/hapi#3658

@codecov
Copy link

codecov bot commented Jun 20, 2018

Codecov Report

Merging #16 into master will decrease coverage by 4.21%.
The diff coverage is 67.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #16      +/-   ##
==========================================
- Coverage    86.6%   82.38%   -4.22%     
==========================================
  Files           9       11       +2     
  Lines         321      352      +31     
  Branches       41       47       +6     
==========================================
+ Hits          278      290      +12     
- Misses         43       62      +19
Impacted Files Coverage Δ
src/adapter/console.js 87.5% <100%> (ø) ⬆️
src/helpers.js 100% <100%> (ø) ⬆️
src/plugin/hapi.js 19.04% <100%> (-39.49%) ⬇️
src/plugin/express.js 68.75% <100%> (ø) ⬆️
src/logger.js 97.61% <100%> (ø) ⬆️
src/plugin/hapi-plugin.js 100% <100%> (ø)
src/plugin/hapi-17.js 22.72% <22.72%> (ø)
src/index.js 83.33% <63.63%> (-1.75%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb26a6e...59438f5. Read the comment docs.

@@ -158,19 +161,26 @@ exports.SEVERITY_CODE = SEVERITY_CODE;
exports.SEVERITY_NAME = SEVERITY_NAME;

// Hapi.js plugin registration
exports.register = (server, options, next) => {
exports.register = async (server, options, next) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

async без await'ов.

Copy link
Contributor

Choose a reason for hiding this comment

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

И, кстати, как hapi < 17 отреагирует на то, что register вернёт промис?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hapi < 17 нормально это воспринимает. А для 17+ это может быть критично, он await-ит регистрацию плагина.

src/index.js Outdated
// Hapi plugin metadata
exports.register.attributes = {
pkg: require('../package.json')
exports.plugin = {
Copy link
Contributor

Choose a reason for hiding this comment

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

А может лучше назвать не plugin, а hapi17?

* HapiPlugin
*
*/
export class HapiPlugin {
Copy link
Contributor

Choose a reason for hiding this comment

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

Этот класс можно сделать общим для обоих hapi. В hapi<17 просто event.error всегда будет undefined

@The-o The-o merged commit 11c9514 into master Jun 27, 2018
@ns3777k ns3777k deleted the hapi-17 branch June 27, 2018 14:26
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.

3 participants