sstephenson / bats

Bash Automated Testing System
MIT License
7.12k stars 519 forks source link

Source files from another bash script? #249

Closed reggi closed 6 years ago

reggi commented 6 years ago

I am trying to write a test using the nvm command. Below I have an example I get nvm: command not found.

#!/usr/bin/env bats
. ~/.nvm/nvm.sh

@test "install axp-app/axp-acq-app with nvm 6.8.0" {
    nvm use 6.8.0
    [ "$status" -eq 0 ]
}

I've tried the following:

. ~/.nvm/nvm.sh

and

source ~/.nvm/nvm.sh

reggi commented 6 years ago

This worked!

#!/usr/bin/env bats

@test "install axp-app/axp-acq-app with nvm 6.8.0" {
    . ~/.nvm/nvm.sh
    nvm use 6.8.0
    [ "$status" -eq 0 ]
}