Skip to content

Commit 3f7b1b9

Browse files
committed
start single command test
1 parent 3735115 commit 3f7b1b9

File tree

2 files changed

+56
-21
lines changed

2 files changed

+56
-21
lines changed

Diff for: jscomp/build_tests/in_source/bsconfig.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name" : "x",
3+
"sources" : ".",
4+
"package-specs" : [{
5+
"module" : "commonjs",
6+
"in-source": true
7+
},{
8+
"module" : "amdjs",
9+
"in-source": true
10+
}
11+
]
12+
}

Diff for: scripts/test.go

+44-21
Original file line numberDiff line numberDiff line change
@@ -144,38 +144,58 @@ func installGlobal(wg *sync.WaitGroup) {
144144
}
145145

146146
var cmd = exec.Command
147+
147148

149+
// Avoid rebuilding OCaml again
148150
func init() {
149151
vendorOCamlPath, _ := filepath.Abs(filepath.Join(".", "vendor", "ocaml", "bin"))
150152
os.Setenv("PATH",
151153
vendorOCamlPath+string(os.PathListSeparator)+os.Getenv("PATH"))
152154
}
153-
155+
func testBsb() {
156+
c := cmd("bsb", "-regen")
157+
c.Dir = filepath.Join("jscomp", "build_tests", "in_source")
158+
out, err := c.CombinedOutput()
159+
outS := string(out)
160+
if !strings.Contains( outS, "two module formats") {
161+
fmt.Println(outS)
162+
fmt.Println(err)
163+
os.Exit(2)
164+
} else {
165+
fmt.Println("Output matches")
166+
}
167+
168+
}
154169
func main() {
155170
noInstallGlobal := flag.Bool("no-install-global", false, "don't install global")
156171
noOunitTest := flag.Bool("no-ounit", false, "don't do ounit test")
157-
172+
noMochaTest := flag.Bool("no-mocha", false, "don't run mocha")
173+
noThemeTest := flag.Bool("no-theme", false, "no bsb theme test")
174+
// disableAll := flag.Bool("disable-all", false, "disable all tets")
158175
flag.Parse()
159-
// Avoid rebuilding OCaml again
176+
177+
178+
160179
output, _ := cmd("which", "ocaml").CombinedOutput()
161180
fmt.Println("OCaml:", string(output))
162181
if !*noOunitTest {
163182
cmd("make", "-C", "jscomp", "test")
164183
}
165-
make := cmd("make", "-C", "jscomp", "travis-world-test")
166-
make.Stdout = os.Stdout
167-
make.Stderr = os.Stderr
168-
error := make.Run()
169-
if error != nil {
170-
os.Exit(2)
184+
if !*noMochaTest {
185+
make := cmd("make", "-C", "jscomp", "travis-world-test")
186+
make.Stdout = os.Stdout
187+
make.Stderr = os.Stderr
188+
error := make.Run()
189+
if error != nil {
190+
os.Exit(2)
191+
}
171192
}
172193

173-
174194
if !*noInstallGlobal {
175195
ginstall := cmd("npm", "i", "-g", ".")
176196
fmt.Println("install bucklescript globally")
177197
start := time.Now()
178-
error = ginstall.Run()
198+
error := ginstall.Run()
179199
if error != nil {
180200
log.Fatalf("install failed")
181201
} else {
@@ -185,15 +205,18 @@ func main() {
185205
}
186206
bsbDir, _ := cmd("bsb", "-where").CombinedOutput()
187207
fmt.Println("BSBDIR:", string(bsbDir))
188-
189-
var wg sync.WaitGroup
190-
for _, theme := range []string{"basic", "basic-reason", "generator", "minimal", "node"} {
191-
fmt.Println("Test theme", theme)
192-
wg.Add(1)
193-
go (func(theme string) {
194-
defer wg.Done()
195-
testTheme(theme)
196-
})(theme)
208+
if !*noThemeTest {
209+
var wg sync.WaitGroup
210+
for _, theme := range []string{"basic", "basic-reason", "generator", "minimal", "node"} {
211+
fmt.Println("Test theme", theme)
212+
wg.Add(1)
213+
go (func(theme string) {
214+
defer wg.Done()
215+
testTheme(theme)
216+
})(theme)
217+
}
218+
wg.Wait()
197219
}
198-
wg.Wait()
220+
221+
testBsb()
199222
}

0 commit comments

Comments
 (0)