railpack

Configure and troubleshoot Railpack builds, with emphasis on RAILPACK_* environment variables, railpack.json overlays, build-plan inspection, local CLI installation and usage, and local BuildKit containers. Use for Railpack provider configuration, custom install/build/start commands, Mise or Apt packages, build or runtime variables and secrets, generated-plan debugging, BUILDKIT_HOST errors, or running Railpack from a release or source checkout.

Install
npx skills add 'https://github.com/railwayapp/railpack/tree/main/.'
Incomplete bundle · no download
main · 21a254fScanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

core/providers/node/cleanse_test.go

core/providers/node/cleanse_test.goBrowse 1970 files
View on GitHub
← Back to SKILL.md
package node import (	"reflect"	"testing" 	"github.com/railwayapp/railpack/core/plan") func buildPlan(withCache bool) *plan.BuildPlan {	p := plan.NewBuildPlan()	if withCache {		p.Caches["node_modules"] = &plan.Cache{Directory: NODE_MODULES_CACHE, Type: plan.CacheTypeShared}	}	return p} func TestCleanse_CachePresent_StepDoesNotRemoveNodeModules(t *testing.T) {	p := buildPlan(true)	step := plan.Step{Name: "build", Caches: []string{"node_modules"}}	step.Commands = []plan.Command{plan.NewExecShellCommand("echo 'nothing to see'")}	p.Steps = append(p.Steps, step) 	provider := &NodeProvider{}	provider.CleansePlan(p) 	if !reflect.DeepEqual(p.Steps[0].Caches, []string{"node_modules"}) {		t.Fatalf("expected cache to remain since step doesn't remove node_modules, got %#v", p.Steps[0].Caches)	}} func TestCleanse_CachePresent_StepRemovesNodeModules(t *testing.T) {	p := buildPlan(true)	step := plan.Step{Name: "build", Caches: []string{"node_modules"}}	step.Commands = []plan.Command{plan.NewExecShellCommand("rm -rf node_modules && echo done")}	p.Steps = append(p.Steps, step) 	provider := &NodeProvider{}	provider.CleansePlan(p) 	if len(p.Steps[0].Caches) != 0 {		t.Fatalf("expected cache to be removed (nil or empty), got %#v", p.Steps[0].Caches)	}} func TestCleanse_InstallStepAlwaysKeepsCache(t *testing.T) {	p := buildPlan(true)	install := plan.Step{Name: "install", Caches: []string{"node_modules"}}	install.Commands = []plan.Command{plan.NewExecShellCommand("npm ci")}	p.Steps = append(p.Steps, install) 	provider := &NodeProvider{}	provider.CleansePlan(p) 	if !reflect.DeepEqual(p.Steps[0].Caches, []string{"node_modules"}) {		t.Fatalf("expected install step cache to remain, got %#v", p.Steps[0].Caches)	}}