clean-script Naively one tries to run something like this: test && cleanup If tests fail cleanup will never be called though. Try clean-script instead: npm i -g clean-scriptclean-script 'test' 'cleanup' MIT License 2015 Stephan Bönnemann