From d5501e42e9f3b889b677192eb6612c0445f3550c Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Fri, 5 Jun 2020 16:41:51 -0700 Subject: [PATCH] Make browser integration tests more effecient --- integration-tests/utils.go | 29 +++++++++---------------- packages/integration-tests/package.json | 2 +- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/integration-tests/utils.go b/integration-tests/utils.go index 12c8d2ba0..e38ee1f35 100644 --- a/integration-tests/utils.go +++ b/integration-tests/utils.go @@ -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") } diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index e0e88a060..57ad834a7 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -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",