I would expect esy test to run a command in package.json, either in scripts or in the esy section.
As is, I have to run npm test, which feels super weird
Curious what's in your npm test command. You can run esy build anyCommand to run any command in your build environment (good for running unit tests). Right now, that means you can make a script ./test so that I can run esy build ./test. Maybe in the future, test would make its way into blessed command list.
We discussed this a while ago and supporting scripts same way js does it turned out to be more challenging and prone to user errors. Since there is not just one environment, people would likely trip up over empty sandboxes.
I'm temporarily getting by on make test and my current setup for testing looks like
esy b refmterr jbuilder runtest --dev
Notice the b which is the equivalent of esy build %cmd% (i.e runs it in _build environment_).
I do think that we can learn something from Cargo though, and provide a few important predefined commands out of the box beyond build/install/init.
We don't need to make esy into a general purpose script runner because in general esy any-cmd will work to run arbitrary things like publishing/release scripts.
esy install # Done
esy build # Done
esy add # Done
esy anyCmd --arg1 # Done
esy init # Done (in master)
esy test
esy clean
The reason why I think that install/build/test/clean are somewhat "special" is that it means anyone who checks our your repo, immediately knows how to install deps, build the project, run tests, and clean - regardless of how they are implemented - and those are the select few important commands necessary to contribute to a project.
yeahh jumping out to a makefile is also something I want to avoid :D
and I don't want to have to type esy b refmterr jbuilder runtest --dev every time 馃槄
I'm renaming this issue into "Running package.json scripts with esy". After discussion at ReasonConf it is became clear that there are strong reasons for this to exist:
cc @bsansouci
Thank you @rauanmayemir !
Most helpful comment
I'm renaming this issue into "Running package.json scripts with esy". After discussion at ReasonConf it is became clear that there are strong reasons for this to exist: