Delete merge-check.sh; tests that launch bundles skip with their reason (issue 1295, S2; ADR 0529)

The checker runs node-tools' Go level and its npm test; what the script said
was NOT TESTED HERE is a skip naming the missing node or @novox/mesh-sdk.
This commit is contained in:
2026-10-23 15:25:10 +02:00
parent e0fadc43d9
commit 5dffb920ff
9 changed files with 65 additions and 56 deletions
+38
View File
@@ -0,0 +1,38 @@
package meshtest
import (
"os"
"os/exec"
"path/filepath"
"runtime"
"testing"
)
// bundlesWhy returns the reason bundles cannot be launched from a checkout rooted at root, or "" when they can: the
// TypeScript and Python bundles the runtime and the console launch need node and the package
// @novox/mesh-sdk, which comes from the package registry and is installed beside node-tools/package.json
// (novox/hq ADR 0529 clause 1: what merge-check.sh said "NOT TESTED HERE" about is a skip with its reason).
func bundlesWhy(root string, haveNode bool) string {
if !haveNode {
return "node is not installed"
}
if _, err := os.Stat(filepath.Join(root, "node_modules", "@novox", "mesh-sdk")); err != nil {
return "@novox/mesh-sdk is not installed in " + filepath.Join(root, "node_modules")
}
return ""
}
// NeedBundles skips the test, saying why, where the bundles it launches cannot run here.
func NeedBundles(t *testing.T) {
t.Helper()
_, err := exec.LookPath("node")
if why := bundlesWhy(moduleRoot(), err == nil); why != "" {
t.Skip("NOT TESTED HERE: this test launches bundles, and " + why)
}
}
// moduleRoot is node-tools/, where package.json and node_modules are.
func moduleRoot() string {
_, here, _, _ := runtime.Caller(0)
return filepath.Join(filepath.Dir(here), "..", "..")
}
@@ -73,3 +73,20 @@ func TestEachTestHasABusOfItsOwn(t *testing.T) {
}
})
}
// What merge-check.sh said was "NOT TESTED HERE" is a skip with its reason: no node, or no package, each says so.
func TestBundlesCannotBeLaunchedWithoutNodeOrTheSDKAndTheSkipSaysWhy(t *testing.T) {
root := t.TempDir()
if why := bundlesWhy(root, false); !strings.Contains(why, "node is not installed") {
t.Errorf("no node said %q", why)
}
if why := bundlesWhy(root, true); !strings.Contains(why, "@novox/mesh-sdk") {
t.Errorf("no package said %q", why)
}
if err := os.MkdirAll(filepath.Join(root, "node_modules", "@novox", "mesh-sdk"), 0o755); err != nil {
t.Fatal(err)
}
if why := bundlesWhy(root, true); why != "" {
t.Errorf("node and the package present said %q", why)
}
}