From 8fbcf3e63c966b2a12a4e98da7b3dde27f06b057 Mon Sep 17 00:00:00 2001 From: Noah Chen Date: Fri, 20 Jan 2017 20:41:23 -0500 Subject: [PATCH] Fail tests if CIRCLE_NODE_TOTAL is < 4 (#2084) --- circle.yml | 1 + scripts/assertMinCircleNodes.js | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 scripts/assertMinCircleNodes.js diff --git a/circle.yml b/circle.yml index 4b2d8cf7528..358b6f4aff7 100644 --- a/circle.yml +++ b/circle.yml @@ -4,6 +4,7 @@ general: - gh-pages dependencies: pre: + - node ./scripts/assertMinCircleNodes.js $CIRCLE_NODE_TOTAL - case $CIRCLE_NODE_INDEX in 0) nvm use 4.2 ;; 1) nvm use 5.7 ;; [2-3]) nvm use 6.1 ;; esac test: override: diff --git a/scripts/assertMinCircleNodes.js b/scripts/assertMinCircleNodes.js new file mode 100644 index 00000000000..449864e72e7 --- /dev/null +++ b/scripts/assertMinCircleNodes.js @@ -0,0 +1,8 @@ +var requiredNodes = 4; +var nodes = parseInt(process.argv[2], 10); +if (requiredNodes != null && requiredNodes > nodes) { + console.error("ERROR: You must run CircleCI with 4 parallel nodes"); + console.error(" This ensures that different environments are tested for TSLint compatibility"); + console.error(" https://circleci.com/gh//tslint/edit#parallel-builds"); + process.exit(1); +}