mirror of
https://github.com/TECHNOFAB11/jsonnet-bundler.git
synced 2025-12-11 23:50:05 +01:00
fix: allow other dirs than vendor (#80)
This commit is contained in:
parent
0ba0ff5522
commit
1d729c9517
4 changed files with 36 additions and 6 deletions
|
|
@ -32,6 +32,18 @@ import (
|
|||
const initContents = `{"dependencies": [], "legacyImports": true}`
|
||||
|
||||
func TestInstallCommand(t *testing.T) {
|
||||
testInstallCommandWithJsonnetHome(t, "vendor")
|
||||
}
|
||||
|
||||
func TestInstallCommandCustomJsonnetHome(t *testing.T) {
|
||||
testInstallCommandWithJsonnetHome(t, "custom-vendor-dir")
|
||||
}
|
||||
|
||||
func TestInstallCommandDeepCustomJsonnetHome(t *testing.T) {
|
||||
testInstallCommandWithJsonnetHome(t, "custom/vendor/dir")
|
||||
}
|
||||
|
||||
func testInstallCommandWithJsonnetHome(t *testing.T, jsonnetHome string) {
|
||||
testcases := []struct {
|
||||
Name string
|
||||
URIs []string
|
||||
|
|
@ -65,7 +77,7 @@ func TestInstallCommand(t *testing.T) {
|
|||
cleanup := func() {
|
||||
_ = os.Remove(jsonnetfile.File)
|
||||
_ = os.Remove(jsonnetfile.LockFile)
|
||||
_ = os.RemoveAll("vendor")
|
||||
_ = os.RemoveAll(jsonnetHome)
|
||||
_ = os.RemoveAll("jsonnet")
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +93,7 @@ func TestInstallCommand(t *testing.T) {
|
|||
jsonnetFileContent(t, jsonnetfile.File, []byte(initContents))
|
||||
|
||||
// install something, check it writes only if required, etc.
|
||||
installCommand("", "vendor", tc.URIs)
|
||||
installCommand("", jsonnetHome, tc.URIs)
|
||||
jsonnetFileContent(t, jsonnetfile.File, tc.ExpectedJsonnetFile)
|
||||
if tc.ExpectedJsonnetLockFile != nil {
|
||||
jsonnetFileContent(t, jsonnetfile.LockFile, tc.ExpectedJsonnetLockFile)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue