diff --git a/.eslintrc b/.eslintrc index ebc3541..a345eda 100644 --- a/.eslintrc +++ b/.eslintrc @@ -19,6 +19,7 @@ ".nyc_output/", "flow-typed/", "flow", + "__tests-built__/", ], "overrides": [ { diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bdad625..a30b162 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,80 +1,54 @@ name: CI on: - push: - branches: - - main - - "!dependabot/**" - pull_request: - workflow_dispatch: + [push, pull_request, workflow_dispatch] + jobs: - jest: - name: Jest (Node v${{ matrix.node }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node: [14, 16, 17] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Load Node version ${{ matrix.node }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node }} - cache: npm - - name: Npm Install - run: npm ci - - name: Run Jest - run: npm run test:ci - - name: Run Coveralls - uses: coverallsapp/github-action@v2 - if: matrix.node == '16' - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - file: ./reports/lcov.info + tests: + uses: ljharb/actions/.github/workflows/node.yml@a840bfaa7e24d260a9f451baa97ca172fdb327af + with: + range: '>= 0.8' + type: majors + build-command: npm run build:tests + build-output-dir: __tests-built__,lib + command: npm run tests-built + flow: name: Flow type checking runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Load Node - uses: actions/setup-node@v4 + - uses: actions/checkout@v4 + - uses: ljharb/actions/node/install@a840bfaa7e24d260a9f451baa97ca172fdb327af with: - cache: npm - - name: Npm Install - run: npm ci + use-npm-ci: true - name: Flow type check - run: npm run flow + run: npx flow + eslint: - name: ESLint (Node v${{ matrix.node }}) + name: ESLint runs-on: ubuntu-latest - strategy: - matrix: - node: [16] steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Load Node version ${{ matrix.node }} - uses: actions/setup-node@v4 + - uses: actions/checkout@v4 + - uses: ljharb/actions/node/install@a840bfaa7e24d260a9f451baa97ca172fdb327af with: - node-version: ${{ matrix.node }} - cache: npm - - name: Npm Install - run: npm ci + use-npm-ci: true - name: Run ESLint run: npm run lint + diff-breakUpAriaJSON: name: Compare JSON to src output runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Load Node version - uses: actions/setup-node@v4 + - uses: actions/checkout@v4 + - uses: ljharb/actions/node/install@a840bfaa7e24d260a9f451baa97ca172fdb327af with: - cache: npm - - name: Npm Install - run: npm ci + use-npm-ci: true - name: Run diff check for the breakUpAriaJSON script run: node scripts/breakUpAriaJSON.js && git diff --exit-code -- src + + finisher: + name: all checks + needs: [tests, flow, eslint, diff-breakUpAriaJSON] + runs-on: ubuntu-latest + steps: + - run: true + diff --git a/.gitignore b/.gitignore index 73ea672..b457831 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ docs/ coverage/ .nyc_output/ +__tests-built__/ diff --git a/.nycrc b/.nycrc index 1826526..5073804 100644 --- a/.nycrc +++ b/.nycrc @@ -8,6 +8,8 @@ "branches": 76.06, "exclude": [ "coverage", - "test" + "__tests-built__", + "test", + "scripts" ] } diff --git a/__tests__/src/ariaPropsMaps-test.js b/__tests__/src/ariaPropsMaps-test.js index 9022797..d85f8c5 100644 --- a/__tests__/src/ariaPropsMaps-test.js +++ b/__tests__/src/ariaPropsMaps-test.js @@ -2,8 +2,8 @@ import test from 'tape'; import deepEqual from 'deep-equal-json'; import inspect from 'object-inspect'; -import ariaPropsMap from '../../src/ariaPropsMap'; -import rolesMap from '../../src/rolesMap'; +import ariaPropsMap from 'aria-query/src/ariaPropsMap'; +import rolesMap from 'aria-query/src/rolesMap'; const entriesList = [ ['aria-activedescendant', {'type': 'id'}], diff --git a/__tests__/src/domMap-test.js b/__tests__/src/domMap-test.js index 1ba61dc..012c18d 100644 --- a/__tests__/src/domMap-test.js +++ b/__tests__/src/domMap-test.js @@ -2,7 +2,7 @@ import test from 'tape'; import deepEqual from 'deep-equal-json'; import inspect from 'object-inspect'; -import domMap from '../../src/domMap'; +import domMap from 'aria-query/src/domMap'; const entriesList = [ ["a", {"reserved": false}], diff --git a/__tests__/src/elementRoleMap-test.js b/__tests__/src/elementRoleMap-test.js index a7922d5..061ff56 100644 --- a/__tests__/src/elementRoleMap-test.js +++ b/__tests__/src/elementRoleMap-test.js @@ -2,7 +2,7 @@ import test from 'tape'; import deepEqual from 'deep-equal-json'; import inspect from 'object-inspect'; -import elementRoleMap from '../../src/elementRoleMap'; +import elementRoleMap from 'aria-query/src/elementRoleMap'; const entriesList = [ [{"name": "article"}, ["article"]], diff --git a/__tests__/src/roleElementMap-test.js b/__tests__/src/roleElementMap-test.js index 0624b89..fdce43c 100644 --- a/__tests__/src/roleElementMap-test.js +++ b/__tests__/src/roleElementMap-test.js @@ -2,7 +2,7 @@ import test from 'tape'; import inspect from 'object-inspect'; import deepEqual from 'deep-equal-json'; -import roleElementMap from '../../src/roleElementMap'; +import roleElementMap from 'aria-query/src/roleElementMap'; const entriesList = [ ["article", [{"name": "article"}]], diff --git a/__tests__/src/rolesMap-test.js b/__tests__/src/rolesMap-test.js index 0111d61..f655c50 100644 --- a/__tests__/src/rolesMap-test.js +++ b/__tests__/src/rolesMap-test.js @@ -1,8 +1,8 @@ import test from 'tape'; import inspect from 'object-inspect'; -import rolesMap from '../../src/rolesMap'; -import ariaPropsMap from '../../src/ariaPropsMap'; +import rolesMap from 'aria-query/src/rolesMap'; +import ariaPropsMap from 'aria-query/src/ariaPropsMap'; const entriesList = [ ["alert", null], diff --git a/package-lock.json b/package-lock.json index dd6cb8d..82bb932 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@babel/core": "^7.24.7", "@babel/eslint-parser": "^7.19.1", "@babel/node": "^7.22.5", + "@babel/plugin-transform-react-jsx": "^7.20.7", "@babel/preset-env": "^7.19.4", "@babel/preset-flow": "^7.18.6", "@babel/register": "^7.24.6", @@ -30,6 +31,9 @@ "object.values": "^1.2.0", "rimraf": "^3.0.2", "tape": "^5.8.1" + }, + "engines": { + "node": ">= 0.4" } }, "node_modules/@ampproject/remapping": { @@ -1033,7 +1037,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", "dev": true, - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.18.6" }, @@ -1535,7 +1538,7 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.20.7.tgz", "integrity": "sha512-Tfq7qqD+tRj3EoDhY00nn2uP2hsRxgYGi5mLQ5TimKav0a9Lrpd4deE+fcLXU8zFYRjlKPHZhpCvfEA6qnBxqQ==", "dev": true, - "peer": true, + "license": "MIT", "dependencies": { "@babel/helper-annotate-as-pure": "^7.18.6", "@babel/helper-module-imports": "^7.18.6", @@ -9127,7 +9130,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz", "integrity": "sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==", "dev": true, - "peer": true, "requires": { "@babel/helper-plugin-utils": "^7.18.6" } @@ -9449,7 +9451,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.20.7.tgz", "integrity": "sha512-Tfq7qqD+tRj3EoDhY00nn2uP2hsRxgYGi5mLQ5TimKav0a9Lrpd4deE+fcLXU8zFYRjlKPHZhpCvfEA6qnBxqQ==", "dev": true, - "peer": true, "requires": { "@babel/helper-annotate-as-pure": "^7.18.6", "@babel/helper-module-imports": "^7.18.6", diff --git a/package.json b/package.json index dba8b0c..8d1f53e 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,11 @@ "lint": "eslint --ext=js,mjs .", "prepublishOnly": "npm run build", "pretest": "npm run lint && flow", + "build:tests": "npm run build && rimraf __tests-built__ && BABEL_ENV=test babel __tests__ --out-dir __tests-built__", + "tests-built": "nyc tape '__tests-built__/**/*.js'", "tests-only": "nyc tape -r @babel/register '__tests__/**/*.js'", "test": "npm run tests-only", + "posttest": "npm audit --production", "output_as_hack": "babel-node ./scripts/output_as_hack.js" }, "repository": { @@ -36,6 +39,7 @@ "@babel/core": "^7.24.7", "@babel/eslint-parser": "^7.19.1", "@babel/node": "^7.22.5", + "@babel/plugin-transform-react-jsx": "^7.20.7", "@babel/preset-env": "^7.19.4", "@babel/preset-flow": "^7.18.6", "@babel/register": "^7.24.6", @@ -59,5 +63,8 @@ "not dead", "not op_mini all", "ie 11" - ] + ], + "engines": { + "node": ">= 0.4" + } }