From 731ce560675cd81d2910978a78ae072e4be2a7c3 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 19 Mar 2018 10:46:11 +0330 Subject: [PATCH] add circleCI pipeline --- .circleci/config.yml | 59 +++++++++++++++++++++++++++++++++++++------- jest.config.js | 13 ---------- package.json | 6 +---- 3 files changed, 51 insertions(+), 27 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2c670c0e0e..ec2947cf27 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,9 +1,13 @@ version: 2 + +defaults: &defaults + working_directory: /usr/src/app + docker: + - image: banian/node-headless-chrome + jobs: - build: - working_directory: /usr/src/app - docker: - - image: banian/node-headless-chrome + install: + <<: *defaults steps: # Checkout repository - checkout @@ -23,17 +27,54 @@ jobs: paths: - "node_modules" - # Test + lint: + <<: *defaults - run: - name: Tests - command: NODE_ENV=test yarn test && yarn coverage + name: ESLint + command: yarn lint - # Release edge + build: + <<: *defaults - run: - name: Publish nuxt-edge + name: Build Fixtures + command: yarn build-fixtures + + test: + <<: *defaults + - run: + name: Test + command: yarn jest test/ + + release: + - run: + name: release command: | if [ "${CIRCLE_BRANCH}" == "dev" ]; then echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc ./scripts/release-edge fi + +workflows: + version: 2 + install-and-parallel-test: + jobs: + - install + + - lint: + requires: + - install + + - build: + requires: + - install + + - test: + requires: + - build + + - release: + requires: + - build + - lint + - test diff --git a/jest.config.js b/jest.config.js index 7478e43cdf..7f69c4dbe0 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,21 +1,8 @@ module.exports = { 'testEnvironment': 'node', 'coverageDirectory': './coverage/', - 'collectCoverage': false, 'setupTestFrameworkScriptFile': './test/utils/setup', 'testMatch': [ '/test/*.test.js' - ], - 'projects': [ - // { - // 'displayName': 'Lint', - // 'runner': 'jest-runner-eslint', - // 'testMatch': [ - // '/lib/*.js' - // ] - // }, - { - 'displayName': 'Test' - } ] } diff --git a/package.json b/package.json index c54f2afa45..ba5e513514 100644 --- a/package.json +++ b/package.json @@ -42,17 +42,13 @@ }, "scripts": { "build-fixtures": "node ./scripts/build-fixtures", - "test": "npm run lint && npm run build-fixtures && jest test/", + "test": "npm run build-fixtures && jest", "test:unit": "jest", "coverage": "codecov", "lint": "eslint --ext .js,.mjs,.vue bin/* build/ lib/ test/ examples/", "precommit": "npm run lint", "postinstall": "opencollective postinstall || exit 0" }, - "jest": { - "coverageDirectory": "./coverage/", - "collectCoverage": true - }, "engines": { "node": ">=8.0.0", "npm": ">=5.0.0"