Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update testing steps in readme.md #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@ npm install -g [email protected]
- `esy install`
- `esy '@test' install`

### Building
### Building from Head
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "from Head" mean here? Isn't that usually where you run tests, and shouldn't it also work anyways?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. Yeah I think "sandboxes" might be more accurate than environments, which as defined by esy seems to be something else.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again I'm not sure what "testing environment" means. Are there environments where you cannot run the tests like this?

Copy link
Author

@leematos leematos Feb 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Comment on lines 71 to +72
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@glennsl glennsl Feb 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.


## FAQ

Expand Down