Skip to content

Commit

Permalink
Junit support on CircleCI (#344)
Browse files Browse the repository at this point in the history
* upgrade mocha to latest release supporting node 0.10

* upgrade lockfile

* Updating dev dependencies

* test more suites

* test new coverage report setup

* test relative path

* test if "always" option work correctly

* it works, sweet

* replaced istanbul with nyc

* npx should be included, lets test

* remove scripts that are never used

* don't run build on install, only on publish

* env vars need not run on a docker image level

* colored test output please

* better jest install command

* preparing to add junit reporter

* fail if yarn lockfile is not in sync

* updated lockfile

* test junit

* better script order

* trigger failure

* test what happens when multiple suites fail

* see what happens when all suites fail

* I like this ci job steps order more

* lockfile by locking file file lock lock

* done testing failures

* even more agressive weight loss

* Ok I think it can rest now

* fix the windows

* better testing setup, only babel what is needed

* turn on loose mode

* ensure tests run in loose mode

* bad bad idea

* ugh

* turned out to be a terrible idea for perf
  • Loading branch information
stipsan authored Nov 28, 2017
1 parent 817911e commit 4f9682d
Show file tree
Hide file tree
Showing 6 changed files with 546 additions and 332 deletions.
58 changes: 39 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ jobs:
build:
docker:
- image: circleci/node:carbon
# To support coverage reports from forks
environment:
CODECLIMATE_REPO_TOKEN: 688d3234f9bb133fe6efa4dfe74f7a7510f2d9c1dca419875de8257a5f02da45
COVERALLS_REPO_TOKEN: uXjaiJ9eS9qZ22QdYHeiqwrsQi9aOWJbz
# To support coverage reports from forks
environment:
CODECLIMATE_REPO_TOKEN: 688d3234f9bb133fe6efa4dfe74f7a7510f2d9c1dca419875de8257a5f02da45
COVERALLS_REPO_TOKEN: uXjaiJ9eS9qZ22QdYHeiqwrsQi9aOWJbz
FORCE_COLOR: true

steps:
- checkout
Expand All @@ -16,36 +17,55 @@ jobs:
- v1-dependencies-{{ checksum "yarn.lock" }}
- v1-dependencies-

- run: yarn install
# --frozen-lockfile ensures yarn.lockfile isn't accidentally outdated compared to package.json
- run: yarn install --no-progress --frozen-lockfile

- run: yarn lint
# ESLint, with transform cache enabled
- run: yarn lint --cache

- run: sudo npm install -g npx
# Running the testing suite with coverage enabled doubles as
# npx -p node-bin@latest -- yarn test
- run: yarn coverage

# ioredis supports version 0.10.16 and later
- run: npx -p node-bin@0.10.16 -p npm@1 -- npm run test
# Allows browsing the html coverage report generated by nyc
- store_artifacts:
path: ./coverage/lcov-report

# yarn itself only supports v4 and later
- run: npx -p node-bin@0.11 -p npm@2 -- npm test
# test matrix, start with most recent versions of node and walk backwards
- run: npx -p node-bin@8 -- yarn test

- run: npx -p node-bin@0.12 -p npm@3 -- npm test
- run: npx -p node-bin@7 -- yarn test

# @TODO submit fix to iojs-bin to make this command possible
# - run: npx -p iojs-bin -p npm@3 -- npm test
- run: npx -p node-bin@6 -- yarn test

- run: npx -p node-bin@5 -- yarn test

- run: npx -p node-bin@4 -- yarn test

- run: npx -p node-bin@5 -- yarn test
- run: npx -p node-bin@0.12 -p npm@3 -- npm test

- run: npx -p node-bin@lts -- yarn test
# yarn itself only supports v4 and later
- run: npx -p node-bin@0.11 -p npm@2 -- npm test

# Running the testing suite with coverage enabled doubles as
# npx -p node-bin@latest -- yarn test
- run: yarn coverage
# ioredis supports version 0.10.16 and later
- run: npx -p node-bin@0.10.16 -p npm@1 -- npm run test

# Let the CI know we got test results it can parse
- store_test_results:
path: ./junit

# Easy debug junit xml files by storing them in the build
- store_artifacts:
path: ./junit

# Make sure we don't get any surprises later when we try to publish a release
- run: yarn prepublishOnly

# Wait with saving deps cache until all tests pass
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "yarn.lock" }}

# Semantic release is setup to check on its own when to publish a new release or not
- run: yarn semantic-release || true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

.nyc_output
coverage
junit
lib
node_modules
npm-debug.log
4 changes: 3 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.circleci
.vscode
.nyc_output
coverage
junit
scripts
src
test
scripts
.babelrc
.codeclimate.yml
.eslintignore
Expand Down
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ platform:

install:
- ps: Install-Product node $env:nodejs_version
- npm install --global npx
- yarn install

test_script: yarn test
test_script: npx mocha --require babel-core/register --recursive

build: off

Expand Down
40 changes: 17 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,16 @@
},
"main": "./lib",
"scripts": {
"build": "mkdirp lib && babel src --out-dir lib",
"build:watch": "npm run build -- --watch",
"changelog:commit": "sr-changelog commit",
"changelog:preview": "sr-changelog",
"clean": "rimraf lib",
"codeclimate": "codeclimate-test-reporter < ./coverage/lcov.info",
"precommit": "lint-staged",
"coverage": "npm run coveralls && npm run codeclimate",
"coveralls": "node_modules/.bin/babel-node node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec --recursive test && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"lint": "./node_modules/.bin/eslint .",
"prepublish": "npm run clean && npm run build",
"precoverage": "nyc --reporter=lcov yarn test",
"coverage": "yarn coveralls && yarn codeclimate",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"lint": "eslint .",
"prepublishOnly": "npx rimraf lib && npx mkdirp lib && babel src --out-dir lib",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"pretest": "printf \"node \" && node --version",
"test": "mocha --compilers js:babel-register --recursive",
"test:watch": "npm test -- --watch --growl",
"test": "mocha --require babel-core/register --recursive --reporter mocha-circleci-reporter --reporter-options testsuitesTitle=node@$(node --version),mochaFile=junit/$(node --version).xml",
"update-compat": "node scripts/update-compat && git add compat.md README.md && git commit --quiet -m \"Chore: Update feature compat table\" &> /dev/null || true"
},
"dependencies": {
Expand All @@ -43,32 +38,31 @@
"ioredis": "2.x || 3.x"
},
"devDependencies": {
"babel-cli": "6.24.1",
"babel-cli": "^6.26.0",
"babel-eslint": "7.2.1",
"babel-preset-env": "^1.6.0",
"babel-register": "6.24.0",
"codeclimate-test-reporter": "0.4.1",
"coveralls": "2.13.0",
"babel-preset-env": "^1.6.1",
"babel-register": "^6.26.0",
"codeclimate-test-reporter": "0.5.0",
"coveralls": "3.0.0",
"eslint": "3.19.0",
"eslint-config-airbnb-base": "11.1.3",
"eslint-config-prettier": "^2.7.0",
"eslint-plugin-import": "2.2.0",
"expect": "1.20.2",
"growl": "1.9.2",
"husky": "^0.14.3",
"ioredis": "^3.1.1",
"istanbul": "1.1.0-alpha.1",
"ioredis": "^3.2.1",
"lint-staged": "^5.0.0",
"mkdirp": "0.5.1",
"mocha": "3.2.0",
"mocha": "^3.5.3",
"mocha-circleci-reporter": "^0.0.2",
"nyc": "^11.3.0",
"prettier": "^1.8.2",
"prettier-package-json": "^1.4.0",
"redis-commands": "1.3.1",
"redis-commands": "^1.3.1",
"release-relief": "^1.0.1",
"rimraf": "2.6.1",
"semver": "^5.4.1"
},
"keywords": [
"fakeredis",
"in-memory",
"ioredis",
"ioredis-mock",
Expand Down
Loading

0 comments on commit 4f9682d

Please sign in to comment.