Build NPM package using node 12, test it on node 6, 8, 10 & 12

I would like to build build (compile) on Node 12, and test the compiled module against Node 6, 8, 10 & 12.

I tried to cache the compiled JavaScript, but the cache seems to be kept separated between different Node version.

So the build process may require a higher Node version as run-time compatibility.

Is there a pattern to address this issue?

Ref: https://travis-ci.org/Borewit/music-metadata/builds/602478214

Imprint