Skip to content

Commit 07aa3aa

Browse files
authored
chore(test): Reduce verbosity of test output (#54)
1 parent 42a6df7 commit 07aa3aa

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ cache:
1010
after_script:
1111
- sleep 10
1212
- cat ./coverage/lcov.info | npx coveralls
13+
- cat .test_output/server.log
1314

1415
before_deploy:
1516
- rm -rf gh-pages

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Serverless: [200] {"statusCode":200,"headers":{"Access-Control-Allow-Origin":"*"
4848
```
4949
npm test
5050
```
51-
See sample test run [log](https://anishkny.github.io/realworld-dynamodb-lambda/test-output/test.log) and [network traffic](https://anishkny.github.io/realworld-dynamodb-lambda/test-output/network.html).
51+
See sample test run [log](https://travis-ci.org/anishkny/realworld-dynamodb-lambda) and [network traffic](https://anishkny.github.io/realworld-dynamodb-lambda/test-output/network.html).
5252

5353
# How it works
5454

start-server.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ export AWS_ACCESS_KEY_ID=foo
1616
export AWS_SECRET_ACCESS_KEY=bar
1717
serverless dynamodb start --migrate &
1818
sleep 5
19-
nyc serverless offline $SERVERLESS_OFFLINE_EXTRA_ARGS &
19+
nyc serverless offline &
2020
sleep 5

test-api-local.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/usr/bin/env bash
2-
set -x
2+
rm -rf .test_output && mkdir -p .test_output
33

4-
SERVERLESS_OFFLINE_EXTRA_ARGS="--dontPrintOutput" ./start-server.sh
4+
echo -n 'Starting server (see .test_output/server.log)... '
5+
./start-server.sh > .test_output/server.log 2>&1
6+
echo 'Done!'
57

6-
rm -rf .test_output && mkdir -p .test_output
78
touch .test_output/network.md
89
export NETWORK_DUMP_FILE=.test_output/network.md
910

1011
set -eo pipefail
11-
API_URL=http://localhost:3000/api mocha 2>&1 | tee .test_output/test.log
12+
API_URL=http://localhost:3000/api mocha
1213
set +e
13-
sleep 5
1414

1515
cat << EOF > .test_output/network.html
1616
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -32,6 +32,11 @@ cat << EOF > .test_output/network.html
3232
</style>
3333
<article class="markdown-body">
3434
EOF
35-
showdown makehtml --input $NETWORK_DUMP_FILE >> .test_output/network.html
35+
showdown --quiet makehtml --input $NETWORK_DUMP_FILE >> .test_output/network.html
36+
37+
echo -n 'Stopping server (see .test_output/server.log)... '
38+
sleep 5
39+
./stop-server.sh >> .test_output/server.log 2>&1
40+
echo 'Done!'
3641

37-
./stop-server.sh
42+
nyc report

0 commit comments

Comments
 (0)