MithrilJS / ospec

Noiseless testing framework
MIT License
48 stars 13 forks source link

Fix postinstall #45

Closed pygy closed 2 years ago

pygy commented 2 years ago

Fix the post-install crash introduced in v4.1.2

Description

For testing ospec, we install a previous, known stable version as a dep-dependency as "ospec-stable". the postinstall hook is also used to rename the corresponding files in node_nodules/.bin from ospec* to ospec-stable* to avoid problems in Windows (where running ospec from npm scripts would try to load the ospec.js found at the root, rather than the corresponding shell script in node_nodules/.bin.

v4.1.2 tried to invoke the renaming script, but it wasn't part of the npm bundle, leading to an error when installing it as a dep. I couldn't find a way to execute JS conditionally from NPM scripts that works in both Windows and *nix, so I instead added the renaming script (~10loc) to the bundle. It is a noop when installed as a dep or dev-dep.

Motivation and Context

How Has This Been Tested?

Types of changes

Checklist: