This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix skip build deps on cleanup (#1675)
* Fixed skip build deps option so that is not called if dependencies are not built * Forgot debug print
- Loading branch information
Showing
2 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package build | ||
|
||
import ( | ||
"sync" | ||
"testing" | ||
|
||
"github.com/gobuffalo/envy" | ||
"github.com/gobuffalo/genny/gentest" | ||
"github.com/gobuffalo/meta" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_WithDeps(t *testing.T) { | ||
r := require.New(t) | ||
envy.Set(envy.GO111MODULE, "on") | ||
|
||
run := gentest.NewRunner() | ||
|
||
opts := &Options{ | ||
WithAssets: false, | ||
WithBuildDeps: true, | ||
Environment: "bar", | ||
App: meta.New("."), | ||
} | ||
|
||
emptyMap := sync.Map{} | ||
opts.rollback = &emptyMap | ||
|
||
f := Cleanup(opts) | ||
f(run) | ||
|
||
results := run.Results() | ||
|
||
cmds := []string{"go mod tidy"} | ||
for i, c := range results.Commands { | ||
eq(r, cmds[i], c) | ||
} | ||
} | ||
|
||
func Test_WithoutDeps(t *testing.T) { | ||
r := require.New(t) | ||
envy.Set(envy.GO111MODULE, "on") | ||
|
||
run := gentest.NewRunner() | ||
|
||
opts := &Options{ | ||
WithAssets: false, | ||
WithBuildDeps: false, | ||
Environment: "bar", | ||
App: meta.New("."), | ||
} | ||
|
||
emptyMap := sync.Map{} | ||
opts.rollback = &emptyMap | ||
|
||
f := Cleanup(opts) | ||
f(run) | ||
|
||
results := run.Results() | ||
|
||
r.Len(results.Commands, 0) | ||
} |