Conversation
| - `esy '@test' install` | ||
|
|
||
| ### Building | ||
| ### Building from Head |
There was a problem hiding this comment.
What does "from Head" mean here? Isn't that usually where you run tests, and shouldn't it also work anyways?
There was a problem hiding this comment.
Good call. I think I was trying to call out how esy build works wrt to esy build vs. esy '@test' build. I'm still wrapping my head around it, but my understanding is that esy build vs. est '@test' build make different environments/packages/etc.
This could be wrong, I've been using esy for 3 days now, so open to suggestions/advice!
There was a problem hiding this comment.
Oh, right. Yeah I think "sandboxes" might be more accurate than environments, which as defined by esy seems to be something else.
There was a problem hiding this comment.
So esy install will install the default sandbox, while esy @test install will install the test sandbox.
| - `esy build` | ||
|
|
||
| ### Running tests | ||
| ### Running tests in a testing environment |
There was a problem hiding this comment.
Again I'm not sure what "testing environment" means. Are there environments where you cannot run the tests like this?
There was a problem hiding this comment.
same as here: #178 (comment)
Basically, I'm interested in removing code from libvim, so my workflow is really:
- remove code
- run tests
- commit
I never actually have to esy build directly in that flow. I imagine others will want to contribute in this manner for the forseeable future so was trying to figure out how to word that :)
| - `esy '@test' build` | ||
| - `esy '@test' x run-tests.sh` (This will compile your code first and all tests) |
There was a problem hiding this comment.
This could be reduced to esy @test && esy test.
esy @test will install and build the test project, a shortcut for esy @test install && esy @test build.
esy test will run the test script defined in package.json, which evaluates to esy '@test' x run-tests.sh
There was a problem hiding this comment.
I got these commands from Bryphe in discord, when we were having problems with esy test directly. I'll play around a bit more tonight
There was a problem hiding this comment.
so the first worked, but the second esy test errors on my mac:
Lees-MacBook-Pro:src lbot$ esy test
error: project is not installed, run `esy install`
esy: exiting due to errors above
There was a problem hiding this comment.
Right, because the script is in the default sandbox you have to have that installed as well. It might be an idea to move/copy that script to test.json as run, so you can just do esy @test && esy @test run.
There was a problem hiding this comment.
I'm sorry that I seem so dense, but I tried your suggestion and I'm hitting this silly "project is not installed" error again, and I can't seem to figure it out:
I made this in my test.json:
{
"name": "libvim",
"version": "8.10869.0",
"description": "Standalone vim library",
"license": "MIT",
"scripts": {"run": "esy x run-tests.sh"},
"esy": {
"build": [
["bash", "-c", "#{os == 'windows' ? 'build/build-windows-tests.sh' : 'build/build-posix-tests.sh'}"]
],
"buildsInSource": true
},
"dependencies": { }
}
I then ran esy '@test' and got the following output at the bottom of the command:
echo "Copying apitest/yank.test.exe to ~/Development/onivim/libvim-test/libvim/src/_esy/test/store/s/libvim-0c7375f1/bin"
Copying apitest/yank.test.exe to ~/Development/onivim/libvim-test/libvim/src/_esy/test/store/s/libvim-0c7375f1/bin
cp apitest/yank.test.exe ~/Development/onivim/libvim-test/libvim/src/_esy/test/store/s/libvim-0c7375f1/bin
cp build/run-tests.sh ~/Development/onivim/libvim-test/libvim/src/_esy/test/store/s/libvim-0c7375f1/bin
after, I try to use the new run script, and it get the same error:
$ esy '@test' run
error: project is not installed, run `esy install`
esy: exiting due to errors above
I thought at first that maybe run-tests.sh was doing something weird inside but it's pretty benign. This is basically the same part that was broken before, so I suspect it's something with the way theesy x run-tests.shcommand is written that esy is not envoking the env properly. What am I missing here? Sorry for the noob questions but esy is eluding me!
There was a problem hiding this comment.
For what it's worth, I've basically never been able to get anything I put as a script to run (echo $HOME, python --version, etc), I always get the esy project is not installed error.
There was a problem hiding this comment.
No worries, it really is confusing.
esy x run-tests.sh will run run-tests.sh in the default sandbox, which means it needs to be installed first. To run it in the @test sandbox you'll need to use esy @test x run-tests.sh. In general, running esy without specifying a sandbox will always apply to the default sandbox, and esy @test will always apply to the @test sandbox (at least as far as I'm aware).
Although I'm not entirely sure esy @test x is actually needed here. You could also try to have the script execute run-tests.sh directly.
I think these help and clarify but do let me know if anything else should be adjusted!