Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] migrate tests to Github Actions #469

Merged
merged 4 commits into from Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
@@ -1,2 +1,3 @@
Gruntfile.js
*.min.js
coverage/
70 changes: 70 additions & 0 deletions .github/workflows/node-4+.yml
@@ -0,0 +1,70 @@
name: 'Tests: node.js'

on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.set-matrix.outputs.requireds }}
minors: ${{ steps.set-matrix.outputs.optionals }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
preset: '>=4'

latest:
needs: [matrix]
name: 'latest minors'
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
- run: npm run tests-only
if: ${{ startsWith(matrix.node-version, '11') || startsWith(matrix.node-version, '9') || startsWith(matrix.node-version, '8') || startsWith(matrix.node-version, '6') }}
- run: npm run tests-only
if: ${{ !startsWith(matrix.node-version, '11') && !startsWith(matrix.node-version, '9') && !startsWith(matrix.node-version, '8') && !startsWith(matrix.node-version, '6') }}
env:
NODE_OPTIONS: '--unhandled-rejections=none'
- uses: codecov/codecov-action@v1

minors:
needs: [matrix, latest]
name: 'non-latest minors'
continue-on-error: true
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
- run: npm run tests-only
if: ${{ startsWith(matrix.node-version, '11') || startsWith(matrix.node-version, '9') || startsWith(matrix.node-version, '8') || startsWith(matrix.node-version, '6') }}
- run: npm run tests-only
if: ${{ !startsWith(matrix.node-version, '11') && !startsWith(matrix.node-version, '10.16') && !startsWith(matrix.node-version, '10.15') && !startsWith(matrix.node-version, '10.14') && !startsWith(matrix.node-version, '10.13') && !startsWith(matrix.node-version, '10.12') && !startsWith(matrix.node-version, '10.11') && !startsWith(matrix.node-version, '10.10') && !startsWith(matrix.node-version, '10.9') && !startsWith(matrix.node-version, '10.8') && !startsWith(matrix.node-version, '10.7') && !startsWith(matrix.node-version, '10.6') && !startsWith(matrix.node-version, '10.5') && !startsWith(matrix.node-version, '10.4') && !startsWith(matrix.node-version, '10.3') && !startsWith(matrix.node-version, '10.2') && !startsWith(matrix.node-version, '10.1') && !startsWith(matrix.node-version, '10.0') && !startsWith(matrix.node-version, '9') && !startsWith(matrix.node-version, '8') && !startsWith(matrix.node-version, '6') }}
env:
NODE_OPTIONS: '--unhandled-rejections=none'
- uses: codecov/codecov-action@v1

node:
name: 'node 4+'
needs: [latest, minors]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
62 changes: 62 additions & 0 deletions .github/workflows/node-iojs.yml
@@ -0,0 +1,62 @@
name: 'Tests: node.js (io.js)'

on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.set-matrix.outputs.requireds }}
minors: ${{ steps.set-matrix.outputs.optionals }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
preset: 'iojs'

latest:
needs: [matrix]
name: 'latest minors'
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.latest) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
skip-ls-check: true
- run: npm run tests-only
- uses: codecov/codecov-action@v1

minors:
needs: [matrix, latest]
name: 'non-latest minors'
continue-on-error: true
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.minors) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
skip-ls-check: true
- run: npm run tests-only
- uses: codecov/codecov-action@v1

node:
name: 'io.js'
needs: [latest, minors]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
26 changes: 26 additions & 0 deletions .github/workflows/node-pretest.yml
@@ -0,0 +1,26 @@
name: 'Tests: pretest/posttest'

on: [pull_request, push]

jobs:
pretest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install lts/* && npm install'
with:
node-version: 'lts/*'
- run: npm run pretest

posttest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install lts/* && npm install'
with:
node-version: 'lts/*'
- run: npm run posttest
64 changes: 64 additions & 0 deletions .github/workflows/node-zero.yml
@@ -0,0 +1,64 @@
name: 'Tests: node.js (0.x)'

on: [pull_request, push]

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
stable: ${{ steps.set-matrix.outputs.requireds }}
unstable: ${{ steps.set-matrix.outputs.optionals }}
steps:
- uses: ljharb/actions/node/matrix@main
id: set-matrix
with:
preset: '0.x'

stable:
needs: [matrix]
name: 'stable minors'
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.stable) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
skip-ls-check: true
- run: npm run tests-only
- uses: codecov/codecov-action@v1

unstable:
needs: [matrix, stable]
name: 'unstable minors'
continue-on-error: true
if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix.outputs.unstable) }}

steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
name: 'nvm install ${{ matrix.node-version }} && npm install'
with:
node-version: ${{ matrix.node-version }}
cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
skip-ls-check: true
- run: npm run tests-only
- uses: codecov/codecov-action@v1

node:
name: 'node 0.x'
needs: [stable, unstable]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -7,3 +7,6 @@ node_modules/
npm-shrinkwrap.json
package-lock.json
yarn.lock

coverage/
.nyc_output/
12 changes: 12 additions & 0 deletions .nycrc
@@ -0,0 +1,12 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"Gruntfile.js",
"*.min.js",
"coverage",
"test",
"test-sham"
]
}
4 changes: 0 additions & 4 deletions .travis.yml
@@ -1,10 +1,6 @@
language: node_js
os:
- linux
import:
- ljharb/travis-ci:node/all.yml
- ljharb/travis-ci:node/pretest.yml
- ljharb/travis-ci:node/posttest.yml
before_install:
- 'if [ -n "${SAUCE-}" ]; then npm install -g grunt-cli; fi'
script:
Expand Down
4 changes: 0 additions & 4 deletions es6-shim.js
Expand Up @@ -390,10 +390,6 @@
return (a === b) || (numberIsNaN(a) && numberIsNaN(b));
},

IsIterable: function (o) {
return ES.TypeIsObject(o) && (typeof o[$iterator$] !== 'undefined' || isArguments(o));
},

GetIterator: function (o) {
if (isArguments(o)) {
// special case support for `arguments`
Expand Down
9 changes: 5 additions & 4 deletions package.json
Expand Up @@ -25,11 +25,11 @@
"scripts": {
"prepublish": "safe-publish-latest && (not-in-publish || npm run minify)",
"pretest": "npm run lint && evalmd *.md",
"test": "npm run tests-only",
"test": "NODE_OPTIONS='--unhandled-rejections=none' npm run tests-only",
"posttest": "aud --production",
"tests-only": "NODE_OPTIONS='--unhandled-rejections=none' npm run test:shim && npm run test:sham",
"test:shim": "mocha test/*.js test/*/*.js",
"test:sham": "mocha test-sham/*.js",
"tests-only": "nyc mocha 'test/**/*.js' 'test-sham/*.js'",
"test:shim": "nyc mocha 'test/**/*.js'",
"test:sham": "nyc mocha 'test-sham/*.js'",
"test:native": "NO_ES6_SHIM=1 npm run tests-only",
"lint": "npm run lint:shim && npm run lint:sham",
"lint:shim": "eslint es6-shim.js test/*.js test/*/*.js",
Expand Down Expand Up @@ -72,6 +72,7 @@
"grunt-saucelabs": "^8.6.3",
"in-publish": "^2.0.1",
"mocha": "^3.5.3",
"nyc": "^10.3.2",
"promises-aplus-tests": "^2.1.2",
"promises-es6-tests": "^0.5.0",
"safe-publish-latest": "^1.1.4",
Expand Down
2 changes: 1 addition & 1 deletion test/map.js
Expand Up @@ -351,7 +351,7 @@ describe('Map', function () {
});

it('throws when called on a non-Map', function () {
var expectedMessage = /^(Method )?Map.prototype.entries called on incompatible receiver |^entries method called on incompatible |^Cannot create a Map entry iterator for a non-Map object.|^Map\.prototype\.entries: 'this' is not a Map object$|^std_Map_iterator method called on incompatible \w$|Map.prototype.entries requires that \|this\| be Map+$/;
var expectedMessage = /^(Method )?Map.prototype.entries called on incompatible receiver |^entries method called on incompatible |^Cannot create a Map entry iterator for a non-Map object.|^Map\.prototype\.entries: 'this' is not a Map object$|^std_Map_iterator method called on incompatible \w$|Map.prototype.entries requires that \|this\| be Map+$|is not an object \(evaluating 'Map.prototype.entries.call\(nonMap\)'\)|Map operation called on non-Map object/;
var nonMaps = [true, false, 'abc', NaN, new Set([1, 2]), { a: true }, [1], Object('abc'), Object(NaN)];
nonMaps.forEach(function (nonMap) {
expect(function () { return Map.prototype.entries.call(nonMap); }).to['throw'](TypeError, expectedMessage);
Expand Down
3 changes: 3 additions & 0 deletions test/mocha.opts
@@ -1,2 +1,5 @@
--require es5-shim
--require ./es6-shim
--require ./es6-sham
--require test/test_helpers.js

2 changes: 1 addition & 1 deletion test/set.js
Expand Up @@ -331,7 +331,7 @@ describe('Set', function () {
});

it('throws when called on a non-Set', function () {
var expectedMessage = /^(Method )?Set.prototype.values called on incompatible receiver |^values method called on incompatible |^Cannot create a Set value iterator for a non-Set object.$|^Set.prototype.values: 'this' is not a Set object$|^std_Set_iterator method called on incompatible \w+$|Set.prototype.values requires that \|this\| be Set/;
var expectedMessage = /^(Method )?Set.prototype.values called on incompatible receiver |^values method called on incompatible |^Cannot create a Set value iterator for a non-Set object.$|^Set.prototype.values: 'this' is not a Set object$|^std_Set_iterator method called on incompatible \w+$|Set.prototype.values requires that \|this\| be Set| is not an object|Set operation called on non-Set object/;
var nonSets = [true, false, 'abc', NaN, new Map([[1, 2]]), { a: true }, [1], Object('abc'), Object(NaN)];
nonSets.forEach(function (nonSet) {
expect(function () { return Set.prototype.values.call(nonSet); }).to['throw'](TypeError, expectedMessage);
Expand Down