Skip to content

Commit 62f0f9d

Browse files
committed
fix: include workspace modules in gno test
Signed-off-by: Norman <norman@samourai.coop>
1 parent d35e1ff commit 62f0f9d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

gnovm/cmd/gno/test.go

+17-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import (
55
"flag"
66
"fmt"
77
goio "io"
8+
"os"
9+
"path/filepath"
810
"time"
911

1012
"github.com/gnolang/gno/gnovm/pkg/gnoenv"
1113
gno "github.com/gnolang/gno/gnovm/pkg/gnolang"
14+
"github.com/gnolang/gno/gnovm/pkg/gnomod"
1215
"github.com/gnolang/gno/gnovm/pkg/packages"
1316
"github.com/gnolang/gno/gnovm/pkg/test"
1417
"github.com/gnolang/gno/tm2/pkg/commands"
@@ -152,11 +155,24 @@ func execTest(cfg *testCfg, args []string, io commands.IO) error {
152155
cfg.rootDir = gnoenv.RootDir()
153156
}
154157

158+
depsPatterns := []string{}
159+
160+
// include local modules
161+
workspaceDir := "."
162+
cwd, err := os.Getwd()
163+
if err == nil {
164+
workspaceDir, err = gnomod.FindRootDir(cwd)
165+
if err != nil {
166+
workspaceDir = "."
167+
}
168+
}
169+
depsPatterns = append(depsPatterns, filepath.Join(workspaceDir, "..."))
170+
155171
// Find targets for test.
156172
conf := &packages.LoadConfig{
157173
IO: io,
158174
Fetcher: testPackageFetcher,
159-
DepsPatterns: []string{"./..."},
175+
DepsPatterns: depsPatterns,
160176
Deps: true,
161177
}
162178
pkgs, err := packages.Load(conf, args...)

0 commit comments

Comments
 (0)