Skip to content

Commit cfcf0b0

Browse files
committed
Makefile: add 'e2e-test' target
Add a target to the Makefile that installs the end-to-end test NPM dependencies then runs the tests. By default, this will only run tests matching the "default" profile of the tests (excluding performance tests). The 'TEST_E2E_PERF' flag, if it has a value, will instead run the tests with the 'all' profile (including the performance tests). Signed-off-by: Victoria Dye <[email protected]>
1 parent 3d477c9 commit cfcf0b0

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ INSTALL_ROOT := /
1313
BINDIR := $(CURDIR)/bin
1414
DISTDIR := $(CURDIR)/_dist
1515
DOCDIR := $(CURDIR)/_docs
16+
TESTDIR := $(CURDIR)/_test
1617

1718
# Platform information
1819
GOOS := $(shell go env GOOS)
@@ -26,6 +27,7 @@ PACKAGE_ARCH := $(GOARCH)
2627
APPLE_APP_IDENTITY =
2728
APPLE_INST_IDENTITY =
2829
APPLE_KEYCHAIN_PROFILE =
30+
TEST_E2E_PERF=
2931

3032
# Build targets
3133
.PHONY: build
@@ -39,6 +41,18 @@ doc:
3941
@scripts/make-docs.sh --docs="$(CURDIR)/docs/man" \
4042
--output="$(DOCDIR)"
4143

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+
@if [ -n "$(TEST_E2E_PERF)" ]; then \
51+
./scripts/run-e2e-tests.sh --all; \
52+
else \
53+
./scripts/run-e2e-tests.sh; \
54+
fi
55+
4256
# Installation targets
4357
.PHONY: install
4458
install: build doc
@@ -170,3 +184,4 @@ clean:
170184
$(RM) -r $(BINDIR)
171185
$(RM) -r $(DISTDIR)
172186
$(RM) -r $(DOCDIR)
187+
$(RM) -r $(TESTDIR)

scripts/run-e2e-tests.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
THISDIR="$( cd "$(dirname "$0")" ; pwd -P )"
4+
TESTDIR="$THISDIR/../test/e2e"
5+
6+
# Defaults
7+
NPM_TARGET="test"
8+
9+
# Parse script arguments
10+
for i in "$@"
11+
do
12+
case "$i" in
13+
--all)
14+
NPM_TARGET="test-all"
15+
shift # past argument
16+
;;
17+
*)
18+
die "unknown option '$i'"
19+
;;
20+
esac
21+
done
22+
23+
# Exit as soon as any line fails
24+
set -e
25+
26+
cd "$TESTDIR"
27+
28+
npm install
29+
npm run $NPM_TARGET

0 commit comments

Comments
 (0)