diff --git a/.github/workflows/node-4+.yml b/.github/workflows/node-4+.yml new file mode 100644 index 000000000..dad291877 --- /dev/null +++ b/.github/workflows/node-4+.yml @@ -0,0 +1,81 @@ +name: 'Tests: node.js' + +on: [pull_request, push] + +jobs: + matrix: + runs-on: ubuntu-latest + outputs: + latest: ${{ steps.set-matrix.outputs.requireds }} + steps: + - uses: ljharb/actions/node/matrix@main + id: set-matrix + with: + versionsAsRoot: true + type: 'majors' + preset: '>=4' + + latest: + needs: [matrix] + name: 'latest majors' + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: ${{ fromJson(needs.matrix.outputs.latest) }} + eslint: + - 7 + - 6 + - 5 + - 4 + - 3 + exclude: + - node-version: 9 + eslint: 7 + - node-version: 8 + eslint: 7 + - node-version: 7 + eslint: 7 + - node-version: 7 + eslint: 6 + - node-version: 6 + eslint: 7 + - node-version: 6 + eslint: 6 + - node-version: 5 + eslint: 7 + - node-version: 5 + eslint: 6 + - node-version: 5 + eslint: 5 + - node-version: 5 + eslint: 4 + - node-version: 5 # TODO: fix + eslint: 3 + - node-version: 4 + eslint: 7 + - node-version: 4 + eslint: 6 + - node-version: 4 + eslint: 5 + - node-version: 4 # TODO: fix + eslint: 4 + - node-version: 4 # TODO: fix + eslint: 3 + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/run@main + name: 'npm install && npm run tests-only' + with: + after_install: npm uninstall --no-save eslint-config-airbnb-base && npm install --no-save "eslint@${{ matrix.eslint }}" + node-version: ${{ matrix.node-version }} + command: 'test:ci' + skip-ls-check: true + + node: + name: 'node 4+' + needs: [latest] + runs-on: ubuntu-latest + steps: + - run: 'echo tests completed' diff --git a/.github/workflows/node-pretest.yml b/.github/workflows/node-pretest.yml new file mode 100644 index 000000000..108ec2ad3 --- /dev/null +++ b/.github/workflows/node-pretest.yml @@ -0,0 +1,40 @@ +name: 'Tests: pretest/posttest' + +on: [pull_request, push] + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/run@main + name: 'npm install && npm run lint' + with: + node-version: 'lts/*' + command: 'lint' + skip-ls-check: true + + flow: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/run@main + name: 'npm install && npm run flow' + with: + node-version: 'lts/*' + command: 'flow' + skip-ls-check: true + + posttest: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: ljharb/actions/node/run@main + name: 'npm install && npm run posttest' + with: + node-version: 'lts/*' + command: 'posttest' + skip-ls-check: true diff --git a/.gitignore b/.gitignore index cb09d260f..41cb00a9f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,10 @@ .DS_Store -coverage +coverage/ lib node_modules npm-debug.log + +npm-shrinkwrap.json package-lock.json -reports yarn-error.log yarn.lock diff --git a/package.json b/package.json index a73b987e7..cebde0124 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "main": "lib/index.js", "scripts": { "build": "rimraf lib && babel src --out-dir lib --copy-files", - "coveralls": "cat ./reports/lcov.info | coveralls", "create": "node ./scripts/create-rule", "flow": "if [ ! -e ./.flowconfig ]; then echo \"Could not find .flowconfig\"; else flow; test $? -eq 0 -o $? -eq 2; fi", "lint:fix": "npm run lint -- --fix", @@ -26,6 +25,7 @@ "prepublish": "safe-publish-latest && not-in-publish || (npm run lint && npm run flow && npm run jest && npm run build)", "pretest": "npm run lint:fix && npm run flow", "test": "npm run jest", + "posttest": "aud --production", "test:ci": "npm run jest -- --ci --runInBand", "jest": "jest --coverage __tests__/**/*" }, @@ -33,10 +33,10 @@ "@babel/cli": "^7.12.10", "@babel/core": "^7.12.10", "@babel/plugin-transform-flow-strip-types": "^7.12.10", + "aud": "^1.1.3", "babel-eslint": "^10.1.0", "babel-jest": "^24.9.0", "babel-preset-airbnb": "^5.0.0", - "coveralls": "^3.1.0", "eslint": "^3 || ^4 || ^5 || ^6 || ^7", "eslint-config-airbnb-base": "^14.2.1", "eslint-plugin-flowtype": "^5.2.0", @@ -77,9 +77,10 @@ "jest": { "coverageReporters": [ "lcov", + "json", "html" ], - "coverageDirectory": "reports", + "coverageDirectory": "coverage", "roots": [ "__tests__" ],