Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Make browser integration tests more effecient
Browse files Browse the repository at this point in the history
  • Loading branch information
albrow committed Jun 5, 2020
1 parent 021585b commit d5501e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
29 changes: 10 additions & 19 deletions integration-tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,29 +116,20 @@ func buildForTests(t *testing.T, ctx context.Context) {
buildStandaloneForTests(t, ctx)
buildBootstrapForTests(t, ctx)

fmt.Println("Clear yarn cache...")
cmd := exec.CommandContext(ctx, "yarn", "cache", "clean")
cmd.Dir = "../"
// Note(albrow): We have to rebuild the browser package manually in case
// any Go code was changed. The TypeScript compiler can automatically rebuild
// for TypeScript code changes only.
fmt.Println("Building mesh-browser package...")
cmd := exec.CommandContext(ctx, "yarn", "build")
cmd.Dir = "../packages/browser"
output, err := cmd.CombinedOutput()
require.NoError(t, err, "could not clean yarn cache: %s", string(output))
require.NoError(t, err, "could not build mesh-browser package: %s", string(output))

fmt.Println("Installing dependencies for TypeScript bindings...")
cmd = exec.CommandContext(ctx, "yarn", "install", "--force")
cmd.Dir = "../"
output, err = cmd.CombinedOutput()
require.NoError(t, err, "could not install depedencies for TypeScript bindings: %s", string(output))

fmt.Println("Running postinstall for browser node...")
cmd = exec.CommandContext(ctx, "yarn", "postinstall")
cmd.Dir = "../packages/integration-tests"
output, err = cmd.CombinedOutput()
require.NoError(t, err, "could not run yarn postinstall: %s", string(output))

fmt.Println("Building TypeScript bindings...")
fmt.Println("Building integration-tests package...")
cmd = exec.CommandContext(ctx, "yarn", "build")
cmd.Dir = "../"
cmd.Dir = "../packages/integration-tests"
output, err = cmd.CombinedOutput()
require.NoError(t, err, "could not build TypeScript bindings: %s", string(output))
require.NoError(t, err, "could not build integration-tests package: %s", string(output))
fmt.Println("Done building everything")
}

Expand Down
2 changes: 1 addition & 1 deletion packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "Apache-2.0",
"private": true,
"scripts": {
"build": "node --max_old_space_size=3072 ./node_modules/.bin/webpack --mode=development",
"build": "yarn build:ts && node --max_old_space_size=3072 ./node_modules/.bin/webpack --mode=development",
"build:ts": "tsc -b",
"clean": "shx rm ./dist/bundle.js || exit 0",
"postinstall:comment": "Remove the go and scripts directories of the mesh browser package to reduce the webpack bundle size",
Expand Down

0 comments on commit d5501e4

Please sign in to comment.