env: nodejs 8.1.5, also tested on jscomplete with same results
const error = new Error("message");
const { message, ...rest } = error;
const keys = Object.keys(error);
const hasStack = error.hasOwnProperty("stack");
The rest object turns out to not include the stack property because Object.keys does not return it and a "for in" will not pick it up. It is, however, an own property of the error object (hasStack is true above).
What gives? I couldn't find anything about special-casing this property in the documentation or the polyfill on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys