@@ -17,15 +17,14 @@ func TestIntegration(t *testing.T) {
17
17
if err != nil {
18
18
t .Fatalf ("failed to read current dir: %v" , err )
19
19
}
20
- root := filepath .Dir (dir )
21
20
22
21
// Build docker image.
23
22
// TODO(hxjiang): use Go in PATH instead of env GOVERSION. LUCI will prepare
24
23
// the Go in different version so vscode-go test don't need to worry.
25
24
dockerBuild := exec .Command ("docker" , "build" , "-q" , "-f" , "./build/Dockerfile" , "." )
26
25
// The docker build must be executed at the root of the vscode-go repository
27
26
// to ensure the entire repository is copied into the image.
28
- dockerBuild .Dir = root
27
+ dockerBuild .Dir = filepath . Dir ( dir )
29
28
output , err := dockerBuild .Output ()
30
29
if err != nil {
31
30
t .Fatalf ("failed to build docker image: %v" , err )
@@ -42,14 +41,42 @@ func TestIntegration(t *testing.T) {
42
41
t .Logf ("image cleanup log:\n %s\n " , output )
43
42
}()
44
43
45
- // Run integration test using previous build docker image.
44
+ // Run tests using previous build docker image.
45
+ //
46
+ // Coloring is disabled for integration tests but preserved for manual
47
+ // triggers.
48
+ // Use "npm config set color false" to disable npm color output globally,
49
+ // and because we cannot access the Mocha command directly in this script,
50
+ // we use env "FORCE_COLOR=0" to disable its color output.
51
+ script := `npm config set color false;
52
+ npm ci;
53
+
54
+ echo "**** Set up virtual display ****";
55
+ /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
56
+ trap "kill \"\$(jobs -p)\"" EXIT;
57
+ export DISPLAY=:99;
58
+ sleep 3;
59
+
60
+ echo "**** Run settings generator ****";
61
+ go run ./tools/generate.go -w=false -gopls=true;
62
+
63
+ echo "**** Test build ****";
64
+ npm run compile;
65
+
66
+ echo "**** Run Go tests ****";
67
+ go test ./...;
68
+
69
+ echo "**** Run test ****";
70
+ FORCE_COLOR=0 npm run unit-test;
71
+ FORCE_COLOR=0 npm test --silent;
72
+
73
+ echo "**** Run lint ****";
74
+ npm run lint`
46
75
// For debug tests, we need ptrace.
47
- // TODO(hxjiang): migrate the shell based ci test with go test.
48
- // TODO(hxjiang): remove ANSI escape codes from npm log.
49
- dockerRun := exec .Command ("docker" , "run" , "--cap-add" , "SYS_PTRACE" , "--shm-size=8G" , "--workdir=/workspace" , imageID , "ci" )
50
- output , err = dockerRun .CombinedOutput ()
76
+ cmd := exec .Command ("docker" , "run" , "--cap-add" , "SYS_PTRACE" , "--shm-size=8G" , "--workdir=/workspace/extension" , "--entrypoint" , "/bin/bash" , imageID , "-c" , script )
77
+ output , err = cmd .CombinedOutput ()
51
78
t .Logf ("integration test log:\n %s\n " , output )
52
79
if err != nil {
53
- t .Errorf ("failed to run integration test: %v" , err )
80
+ t .Errorf ("failed to run integration test in docker : %v" , err )
54
81
}
55
82
}
0 commit comments