uber / tchannel-node

MIT License
203 stars 40 forks source link

Fix the build for 2020 #359

Closed kriskowal closed 4 years ago

kriskowal commented 4 years ago

This change restores a build passing in CI for Node.js version 0.10 through 12.0. The change requires moving binary dependencies farhmhash and sse4_crc out of the static dependencies and into a postinstall hook that chooses different versions depending on the Node.js runtime.

To get the build to pass, some other dust had to be cleared off. I’ve taken the expedient route of disabling all flakey tests.

Node.js changed its console representation of objects along the way, so some tests that used standard output needed to be relaxed.

I removed a dev dependency on child_pty. There are some examples that require this dependency. I’ve decided to leave them alone. If someone wants to run them, the solution is self-evident.

Node.js deprecated the Buffer constructor in favor of Buffer.alloc and Buffer.from and more recent versions log a warning the first time the Buffer constructor gets used. This in turn broke some tests that pass only on empty child process output. These constructors have been changed to handle both the old and new forms depending on the present runtime.

Node.js changed the HTTP header behavior. I’ve altered a few tests that depended on multi-line headers for cookies.

I converted the Travis CI hacks to a proper build matrix since that feature of Travis has been fleshed out since we last played this game.

Of course, this change was everything we needed to land a diff that fixes the copyright header, and incidentally produces a build that will work in both legacy and modern builds of Node.js.

Raynos commented 4 years ago

Nice test fix.