Skip to content

Commit 7553244

Browse files
committed
makefile: add new test targets
Add three new Makefile targets: 1. 'test' - runs the project's unit tests 2. 'test-integration' - installs the required dependencies for and runs the project's integration tests, following the example set in [1] 3. 'test-all' - runs all project test suites (unit, integration, and end-to-end) 1: a6ff664 Signed-off-by: Lessley Dennington <[email protected]>
1 parent 32f8f11 commit 7553244

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

Makefile

+16
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ APPLE_APP_IDENTITY =
2828
APPLE_INST_IDENTITY =
2929
APPLE_KEYCHAIN_PROFILE =
3030
E2E_FLAGS=
31+
INTEGRATION_FLAGS=
3132

3233
# Build targets
3334
.PHONY: build
@@ -42,13 +43,28 @@ doc:
4243
--output="$(DOCDIR)"
4344

4445
# Testing targets
46+
.PHONY: test
47+
test: build
48+
@echo "======== Running unit tests ========"
49+
GOOS="$(GOOS)" GOARCH="$(GOARCH)" go test ./...
50+
51+
.PHONY: integration-test
52+
integration-test: build
53+
@echo
54+
@echo "======== Running integration tests ========"
55+
$(RM) -r $(TESTDIR)
56+
@scripts/run-integration-tests.sh $(INTEGRATION_FLAGS)
57+
4558
.PHONY: e2e-test
4659
e2e-test: build
4760
@echo
4861
@echo "======== Running end-to-end tests ========"
4962
$(RM) -r $(TESTDIR)
5063
@scripts/run-e2e-tests.sh $(E2E_FLAGS)
5164

65+
.PHONY: test-all
66+
test-all: build test integration-test e2e-test
67+
5268
# Installation targets
5369
.PHONY: install
5470
install: build doc

scripts/run-integration-tests.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
THISDIR="$( cd "$(dirname "$0")" ; pwd -P )"
4+
TESTDIR="$THISDIR/../test/integration"
5+
6+
# Exit as soon as any line fails
7+
set -e
8+
9+
cd "$TESTDIR"
10+
11+
npm install
12+
npm run integration-test -- ${ARGS:+${ARGS[*]}}

test/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"description": "",
66
"main": "index.js",
77
"scripts": {
8-
"e2e-test": "cucumber-js e2e -c e2e/cucumber.js"
8+
"e2e-test": "cucumber-js e2e -c e2e/cucumber.js",
9+
"integration-test": "cucumber-js integration -c integration/cucumber.js"
910
},
1011
"license": "MIT",
1112
"devDependencies": {

0 commit comments

Comments
 (0)