I have a project that runs tests on Node.js 12, it has been erroring on Travis since the start of this week.
The error is npm ERR! Cannot read property 'toString' of null when running npm ci
I have been unable to reproduce this locally and, without access to the npm debug log, cannot debug this further.
after_failure does not fire because the error is happening in install, which results in an error, which is different from a failure. I suggest overriding install with npm cli || cat … for now.
Coincidentally, I advise against splitting your deployment to a separate job if you have only one Test job to run. It is much simpler and much more efficient to rely on your single Test job to run the test and deploy upon success. If you split, you will have to pay for the extra time for the second VM to start and set up the environment before it can deploy.