Open 43081j opened 7 months ago
In much of this library, we use functions as constructors and add methods to the prototype, using util.inherits for inheritance
util.inherits
We should probably rework this to use classes now that they're widely available.
For example: https://github.com/chaijs/chai-http/blob/cc58a4b67920b70131969ffa450f53810a2c92dd/lib/request.js#L307-L318
Could be:
class TestAgent extends (Agent || Request) { constructor(app) { super(); if (typeof app === 'function') app = http.createServer(app); this.app = app; if (typeof app !== 'string' && app && app.listen && app.address && !app.address()) { this.app = app.listen(0) } } close(callback) { // ... } }
In much of this library, we use functions as constructors and add methods to the prototype, using
util.inherits
for inheritanceWe should probably rework this to use classes now that they're widely available.
For example: https://github.com/chaijs/chai-http/blob/cc58a4b67920b70131969ffa450f53810a2c92dd/lib/request.js#L307-L318
Could be: