diff --git a/gno.land/pkg/integration/testdata_test.go b/gno.land/pkg/integration/testdata_test.go index c947624de00..ba4d5176df1 100644 --- a/gno.land/pkg/integration/testdata_test.go +++ b/gno.land/pkg/integration/testdata_test.go @@ -10,13 +10,12 @@ import ( "github.com/stretchr/testify/require" ) -var debugTs = false - -func init() { debugTs, _ = strconv.ParseBool(os.Getenv("DEBUG_TS")) } - func TestTestdata(t *testing.T) { t.Parallel() + flagInMemoryTS, _ := strconv.ParseBool(os.Getenv("INMEMORY_TS")) + flagNoSeqTS, _ := strconv.ParseBool(os.Getenv("NO_SEQ_TS")) + p := gno_integration.NewTestingParams(t, "testdata") if coverdir, ok := gno_integration.ResolveCoverageDir(); ok { @@ -29,7 +28,7 @@ func TestTestdata(t *testing.T) { require.NoError(t, err) mode := commandKindTesting - if debugTs { + if flagInMemoryTS { mode = commandKindInMemory } @@ -45,9 +44,24 @@ func TestTestdata(t *testing.T) { return nil } - if debugTs { + if flagInMemoryTS && !flagNoSeqTS { testscript.RunT(tSeqShim{t}, p) } else { testscript.Run(t, p) } } + +type tSeqShim struct{ *testing.T } + +// noop Parallel method allow us to run test sequentially +func (tSeqShim) Parallel() {} + +func (t tSeqShim) Run(name string, f func(testscript.T)) { + t.T.Run(name, func(t *testing.T) { + f(tSeqShim{t}) + }) +} + +func (t tSeqShim) Verbose() bool { + return testing.Verbose() +} diff --git a/gno.land/pkg/integration/testscript_gnoland.go b/gno.land/pkg/integration/testscript_gnoland.go index 4b61b95015a..ae484a07669 100644 --- a/gno.land/pkg/integration/testscript_gnoland.go +++ b/gno.land/pkg/integration/testscript_gnoland.go @@ -50,8 +50,14 @@ const ( type commandkind int const ( + // commandKindBin builds and uses an integration binary to run the testscript + // in a separate process. This should be used for any external package that + // wants to use test scripts. commandKindBin commandkind = iota + // commandKindTesting uses the current testing binary to run the testscript + // in a separate process. This command cannot be used outside this package. commandKindTesting + // commandKindInMemory runs testscripts in memory. commandKindInMemory ) diff --git a/gno.land/pkg/integration/testscript_seqs.go b/gno.land/pkg/integration/testscript_seqs.go index 71ef450d7f2..76ab1b7282d 100644 --- a/gno.land/pkg/integration/testscript_seqs.go +++ b/gno.land/pkg/integration/testscript_seqs.go @@ -1,22 +1 @@ package integration - -import ( - "testing" - - "github.com/rogpeppe/go-internal/testscript" -) - -type tSeqShim struct{ *testing.T } - -// noop Parallel method allow us to run test sequentially -func (tSeqShim) Parallel() {} - -func (t tSeqShim) Run(name string, f func(testscript.T)) { - t.T.Run(name, func(t *testing.T) { - f(tSeqShim{t}) - }) -} - -func (t tSeqShim) Verbose() bool { - return testing.Verbose() -}