Skip to content

Commit

Permalink
Merge d57267a into a1c2e82
Browse files Browse the repository at this point in the history
  • Loading branch information
BridgeAR committed May 28, 2018
2 parents a1c2e82 + d57267a commit c8a9b13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

var path = require('path');
var util = require('util');
var isBuffer = require('buffer').Buffer.isBuffer;

var clone = require('clone');
Expand Down Expand Up @@ -157,6 +158,11 @@ File.prototype.inspect = function() {
return '<File ' + inspect.join(' ') + '>';
};

// Newer Node.js versions use this symbol for custom inspection.
if (util.inspect.custom) {
File.prototype[util.inspect.custom] = File.prototype.inspect;
}

File.isCustomProp = function(key) {
return builtInFields.indexOf(key) === -1;
};
Expand Down
6 changes: 5 additions & 1 deletion test/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

var fs = require('fs');
var path = require('path');
var util = require('util');
var expect = require('expect');
var miss = require('mississippi');
var cloneable = require('cloneable-readable');
Expand Down Expand Up @@ -746,7 +747,10 @@ describe('File', function() {

it('returns correct format when no contents and no path', function(done) {
var file = new File();
expect(file.inspect()).toEqual('<File >');
var expectation = '<File >';
expect(file.inspect()).toEqual(expectation);
expect(file[util.inspect.custom]()).toEqual(expectation);
expect(util.inspect(file)).toEqual(expectation);
done();
});

Expand Down

0 comments on commit c8a9b13

Please sign in to comment.