File tree Expand file tree Collapse file tree 3 files changed +82
-4
lines changed Expand file tree Collapse file tree 3 files changed +82
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ INSTALL_ROOT := /
13
13
BINDIR := $(CURDIR ) /bin
14
14
DISTDIR := $(CURDIR ) /_dist
15
15
DOCDIR := $(CURDIR ) /_docs
16
+ TESTDIR := $(CURDIR ) /_test
16
17
17
18
# Platform information
18
19
GOOS := $(shell go env GOOS)
@@ -26,6 +27,7 @@ PACKAGE_ARCH := $(GOARCH)
26
27
APPLE_APP_IDENTITY =
27
28
APPLE_INST_IDENTITY =
28
29
APPLE_KEYCHAIN_PROFILE =
30
+ E2E_FLAGS =
29
31
30
32
# Build targets
31
33
.PHONY : build
39
41
@scripts/make-docs.sh --docs=" $( CURDIR) /docs/man" \
40
42
--output=" $( DOCDIR) "
41
43
44
+ # Testing targets
45
+ .PHONY : e2e-test
46
+ e2e-test : build
47
+ @echo
48
+ @echo " ======== Running end-to-end tests ========"
49
+ $(RM ) -r $(TESTDIR )
50
+ @scripts/run-e2e-tests.sh $(E2E_FLAGS )
51
+
42
52
# Installation targets
43
53
.PHONY : install
44
54
install : build doc
@@ -170,3 +180,4 @@ clean:
170
180
$(RM ) -r $(BINDIR )
171
181
$(RM ) -r $(DISTDIR )
172
182
$(RM ) -r $(DOCDIR )
183
+ $(RM ) -r $(TESTDIR )
Original file line number Diff line number Diff line change @@ -170,11 +170,45 @@ $ go build -o bin/ ./...
170
170
171
171
### Testing and Linting
172
172
173
- To run the project's unit tests, navigate to the repository root directory and
174
- run ` go test -v ./... ` .
173
+ Unless otherwise specified, run commands from the repository root.
175
174
176
- To run the project's linter, navigate to the repository root directory and run
177
- ` go vet ./... ` .
175
+ #### Unit tests
176
+
177
+ ```
178
+ go test -v ./...
179
+ ```
180
+
181
+ #### Linter
182
+
183
+ ```
184
+ go vet ./...
185
+ ```
186
+
187
+ #### End-to-end tests
188
+
189
+ In order to run these tests, you need to have a recent version of
190
+ [ Node.js] ( https://nodejs.org ) (current LTS version is a pretty safe bet) and NPM
191
+ installed.
192
+
193
+ For the standard set of tests (i.e., excluding exceptionally slow tests), run:
194
+
195
+ ```
196
+ make e2e-test
197
+ ```
198
+
199
+ To configure the test execution and filtering, set the ` E2E_FLAGS ` build
200
+ variable. The available options are:
201
+
202
+ * ` --offline ` : run all tests except those that require internet access.
203
+ * ` --all ` : run all tests, including slow performance tests.
204
+
205
+ The above modes are mutually exclusive; if multiple are specified, only the last
206
+ will be used. For example, ` E2E_FLAGS="--offline --all" ` is equivalent to
207
+ ` E2E_FLAGS="--all" ` .
208
+
209
+ :warning : The performance tests that are excluded by default clone very large
210
+ repos from the internet and can take anywhere from ~ 30 minutes to multiple hours
211
+ to run, depending on internet connectivity and other system resources.
178
212
179
213
## License
180
214
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ THISDIR=" $( cd " $( dirname " $0 " ) " ; pwd -P ) "
4
+ TESTDIR=" $THISDIR /../test/e2e"
5
+
6
+ # Defaults
7
+ ARGS=()
8
+
9
+ # Parse script arguments
10
+ for i in " $@ "
11
+ do
12
+ case " $i " in
13
+ --offline)
14
+ ARGS+=(" -p" " offline" )
15
+ shift # past argument
16
+ ;;
17
+ --all)
18
+ ARGS+=(" -p" " all" )
19
+ shift # past argument
20
+ ;;
21
+ * )
22
+ die " unknown option '$i '"
23
+ ;;
24
+ esac
25
+ done
26
+
27
+ # Exit as soon as any line fails
28
+ set -e
29
+
30
+ cd " $TESTDIR "
31
+
32
+ npm install
33
+ npm run test -- ${ARGS: +${ARGS[*]} }
You can’t perform that action at this time.
0 commit comments