From 3638063072aeea1925bab5f9565d7765bf8d4cf4 Mon Sep 17 00:00:00 2001 From: Boxuan Li Date: Sun, 29 Jul 2018 12:06:01 +0800 Subject: [PATCH] Separate test logic Move integration test into individual stage and allow failure for it. Related to https://github.com/coala/gh-board/issues/45 --- .travis.yml | 35 ++++++++++++++++++++++++--------- package.json | 5 +++++ script/run-integration-test.sh | 5 +++++ script/run-test.sh | 3 --- test/{ => integration}/index.js | 0 5 files changed, 36 insertions(+), 12 deletions(-) create mode 100755 script/run-integration-test.sh rename test/{ => integration}/index.js (100%) diff --git a/.travis.yml b/.travis.yml index aa795e6e..3b5bd243 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,27 @@ cache: directories: - "node_modules" +.disable_global: &disable_global + after_success: false + after_failure: false + deploy: false + +.integration: &integration + <<: *disable_global + stage: integration + # Needed for Firefox + before_script: + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start + - sleep 3 # give xvfb some time to start + script: script/run-integration-test.sh + # env forces jobs to be created from the top level settings env: jobs: include: - - stage: moban + - <<: *disable_global + stage: moban language: python python: 3.6 cache: pip @@ -17,14 +33,9 @@ jobs: install: pip install moban before_script: false script: .ci/check_moban.sh - after_success: false - deploy: false - -# Needed for Firefox -before_script: - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start - - sleep 3 # give xvfb some time to start + - *integration + allow_failures: + - *integration before_install: - npm install --no-save --no-optional --only=dev npm@5.8.0 @@ -39,6 +50,12 @@ script: - script/build.sh - npm run test +after_success: + - codecov + +after_failure: + - codecov + notifications: email: false webhooks: https://www.travisbuddy.com/ diff --git a/package.json b/package.json index 0a8cfecf..522ed35e 100644 --- a/package.json +++ b/package.json @@ -103,5 +103,10 @@ }, "engines": { "npm": "~5.8.0" + }, + "ava": { + "files": [ + "test/integration/**.js" + ] } } diff --git a/script/run-integration-test.sh b/script/run-integration-test.sh new file mode 100755 index 00000000..c8a3e171 --- /dev/null +++ b/script/run-integration-test.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e -x + +# Set the flag `--race` to kill all tasks when a task finished with zero. +$(npm bin)/run-p --race "start-selenium" "serve" "build-and-test" diff --git a/script/run-test.sh b/script/run-test.sh index d7ced812..a363e574 100755 --- a/script/run-test.sh +++ b/script/run-test.sh @@ -14,6 +14,3 @@ do done $(npm bin)/jest - -# Set the flag `--race` to kill all tasks when a task finished with zero. -$(npm bin)/run-p --race "start-selenium" "serve" "build-and-test" diff --git a/test/index.js b/test/integration/index.js similarity index 100% rename from test/index.js rename to test/integration/index.js