Good code requires care.

Travis CI issue: local docker to the rescue

I am using Travis to run CI tests for our electrum packages.
Two weeks ago, my tests started to fail with a mysterious error
and I was unable to reproduce the problem on my machine:

No such file or directory

Running Travis CI in a local docker container

I decided to troubleshoot Travis locally in a Docker image as
explained on the Travis site.
For this, I first insalled the latest version of Docker for Windows
on my Windows 10 laptop.
Then, I got down to the command line in order to pull a pre-configured
Travis docker image and make sure that it was using the expected node
and npm versions:

Investigating locally, just like a Unix guru

I searched the web and found several mentions of people
having trouble to get node to work properly when sudo was used
in an nvm environment.

In my case, doing the nvm install and nvm use would not allow
me to do sudo node --version either. So I suspected that I would
have to solve that issue
in order to get my Travis CI scripts to complete the tests.

My hash-bang fails!

In my case, the package electrum-require-components could not be
executed. The definition of its package.json file pointed to a *.js
file as its binary:

By applying the nvm hack found on
stack overflow,
I was able to get my tests to run. But I did not find this solution to be
really satisfying, as I have other packages which also rely on JavaScript
node scripts, and which work without the hack.

When following the naming conventions helps

I finally solved my problem by renamingbin.js
to electrum-require-components.

So, did I trip on some weird behaviour
in npm? Probably, but this no longer matters, since I have a functional
CI again, and a lot of real work to do.