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: use non deprecated custom inspect #1198

Merged
merged 2 commits into from
Jun 25, 2018

Conversation

BridgeAR
Copy link
Contributor

Custom inspection with the inspect property is deprecated and will
not work in Node.js 11 anymore. This fixes it by using the custom
inspect symbol where existent and falls back to the old style in case
it does not exist.

@codecov
Copy link

codecov bot commented May 27, 2018

Codecov Report

Merging #1198 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1198      +/-   ##
==========================================
+ Coverage   99.73%   99.73%   +<.01%     
==========================================
  Files           5        5              
  Lines         373      383      +10     
==========================================
+ Hits          372      382      +10     
  Misses          1        1
Impacted Files Coverage Δ
lib/request.js 100% <100%> (ø) ⬆️
lib/application.js 100% <100%> (ø) ⬆️
lib/response.js 100% <100%> (ø) ⬆️
lib/context.js 97.14% <100%> (+0.17%) ⬆️

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 77a4cfb...53daa01. Read the comment docs.

lib/response.js Outdated
module.exports[util.inspect.custom] = function() {
if (!this.res) return;
const o = this.toJSON();
o.body = this.body;
Copy link
Member

Choose a reason for hiding this comment

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

can we move this line to this.toJSON() ?

@BridgeAR
Copy link
Contributor Author

BridgeAR commented Jun 5, 2018

I just pushed another commit to simplify it. That way it is always aligned, no matter if there are any changes to the actual inspection function.

@@ -23,6 +23,7 @@ const http = require('http');
const only = require('only');
const convert = require('koa-convert');
const deprecate = require('depd')('koa');
const util = require('util');
Copy link
Member

Choose a reason for hiding this comment

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

    /home/travis/build/koajs/koa/lib/application.js: Duplicate declaration "util"
        24 | const convert = require('koa-convert');
        25 | const deprecate = require('depd')('koa');
      > 26 | const util = require('util');

please fix this and good to merge. 👍

Custom inspection with the `inspect` property is deprecated and will
not work in Node.js 11 anymore. This fixes it by using the custom
inspect symbol where existent and falls back to the old style in case
it does not exist.
@BridgeAR
Copy link
Contributor Author

Rebased and force pushed.

@BridgeAR
Copy link
Contributor Author

Ping @dead-horse

@dead-horse dead-horse merged commit 8f047dd into koajs:master Jun 25, 2018
@fl0w
Copy link
Contributor

fl0w commented Jun 25, 2018

Should we backport this to 1.x as well perhaps?

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.

None yet

3 participants