Skip to content

Commit 0c0d722

Browse files
committed
[Tests] pre-build the tests, only in CI
1 parent 7f0a606 commit 0c0d722

11 files changed

+57
-71
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
".nyc_output/",
2020
"flow-typed/",
2121
"flow",
22+
"__tests-built__/",
2223
],
2324
"overrides": [
2425
{

.github/workflows/test.yml

Lines changed: 32 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,54 @@
11
name: CI
22
on:
3-
push:
4-
branches:
5-
- main
6-
- "!dependabot/**"
7-
pull_request:
8-
workflow_dispatch:
3+
[push, pull_request, workflow_dispatch]
4+
95
jobs:
10-
jest:
11-
name: Jest (Node v${{ matrix.node }})
12-
runs-on: ubuntu-latest
13-
strategy:
14-
fail-fast: false
15-
matrix:
16-
node: [14, 16, 17]
17-
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
20-
- name: Load Node version ${{ matrix.node }}
21-
uses: actions/setup-node@v4
22-
with:
23-
node-version: ${{ matrix.node }}
24-
cache: npm
25-
- name: Npm Install
26-
run: npm ci
27-
- name: Run Jest
28-
run: npm run test:ci
29-
- name: Run Coveralls
30-
uses: coverallsapp/github-action@v2
31-
if: matrix.node == '16'
32-
with:
33-
github-token: ${{ secrets.GITHUB_TOKEN }}
34-
file: ./reports/lcov.info
6+
tests:
7+
uses: ljharb/actions/.github/workflows/node.yml@a840bfaa7e24d260a9f451baa97ca172fdb327af
8+
with:
9+
range: '>= 0.8'
10+
type: majors
11+
build-command: npm run build:tests
12+
build-output-dir: __tests-built__,lib
13+
command: npm run tests-built
14+
3515
flow:
3616
name: Flow type checking
3717
runs-on: ubuntu-latest
3818
steps:
39-
- name: Checkout
40-
uses: actions/checkout@v4
41-
- name: Load Node
42-
uses: actions/setup-node@v4
19+
- uses: actions/checkout@v4
20+
- uses: ljharb/actions/node/install@a840bfaa7e24d260a9f451baa97ca172fdb327af
4321
with:
44-
cache: npm
45-
- name: Npm Install
46-
run: npm ci
22+
use-npm-ci: true
4723
- name: Flow type check
48-
run: npm run flow
24+
run: npx flow
25+
4926
eslint:
50-
name: ESLint (Node v${{ matrix.node }})
27+
name: ESLint
5128
runs-on: ubuntu-latest
52-
strategy:
53-
matrix:
54-
node: [16]
5529
steps:
56-
- name: Checkout
57-
uses: actions/checkout@v4
58-
- name: Load Node version ${{ matrix.node }}
59-
uses: actions/setup-node@v4
30+
- uses: actions/checkout@v4
31+
- uses: ljharb/actions/node/install@a840bfaa7e24d260a9f451baa97ca172fdb327af
6032
with:
61-
node-version: ${{ matrix.node }}
62-
cache: npm
63-
- name: Npm Install
64-
run: npm ci
33+
use-npm-ci: true
6534
- name: Run ESLint
6635
run: npm run lint
36+
6737
diff-breakUpAriaJSON:
6838
name: Compare JSON to src output
6939
runs-on: ubuntu-latest
7040
steps:
71-
- name: Checkout
72-
uses: actions/checkout@v4
73-
- name: Load Node version
74-
uses: actions/setup-node@v4
41+
- uses: actions/checkout@v4
42+
- uses: ljharb/actions/node/install@a840bfaa7e24d260a9f451baa97ca172fdb327af
7543
with:
76-
cache: npm
77-
- name: Npm Install
78-
run: npm ci
44+
use-npm-ci: true
7945
- name: Run diff check for the breakUpAriaJSON script
8046
run: node scripts/breakUpAriaJSON.js && git diff --exit-code -- src
47+
48+
finisher:
49+
name: all checks
50+
needs: [tests, flow, eslint, diff-breakUpAriaJSON]
51+
runs-on: ubuntu-latest
52+
steps:
53+
- run: true
54+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ docs/
55

66
coverage/
77
.nyc_output/
8+
__tests-built__/

.nycrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
"branches": 76.06,
99
"exclude": [
1010
"coverage",
11-
"test"
11+
"__tests-built__",
12+
"test",
13+
"scripts"
1214
]
1315
}

__tests__/src/ariaPropsMaps-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import test from 'tape';
22
import deepEqual from 'deep-equal-json';
33
import inspect from 'object-inspect';
44

5-
import ariaPropsMap from '../../src/ariaPropsMap';
6-
import rolesMap from '../../src/rolesMap';
5+
import ariaPropsMap from 'aria-query/src/ariaPropsMap';
6+
import rolesMap from 'aria-query/src/rolesMap';
77

88
const entriesList = [
99
['aria-activedescendant', {'type': 'id'}],

__tests__/src/domMap-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import test from 'tape';
22
import deepEqual from 'deep-equal-json';
33
import inspect from 'object-inspect';
44

5-
import domMap from '../../src/domMap';
5+
import domMap from 'aria-query/src/domMap';
66

77
const entriesList = [
88
["a", {"reserved": false}],

__tests__/src/elementRoleMap-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import test from 'tape';
22
import deepEqual from 'deep-equal-json';
33
import inspect from 'object-inspect';
44

5-
import elementRoleMap from '../../src/elementRoleMap';
5+
import elementRoleMap from 'aria-query/src/elementRoleMap';
66

77
const entriesList = [
88
[{"name": "article"}, ["article"]],

__tests__/src/roleElementMap-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import test from 'tape';
22
import inspect from 'object-inspect';
33
import deepEqual from 'deep-equal-json';
44

5-
import roleElementMap from '../../src/roleElementMap';
5+
import roleElementMap from 'aria-query/src/roleElementMap';
66

77
const entriesList = [
88
["article", [{"name": "article"}]],

__tests__/src/rolesMap-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import test from 'tape';
22
import inspect from 'object-inspect';
33

4-
import rolesMap from '../../src/rolesMap';
5-
import ariaPropsMap from '../../src/ariaPropsMap';
4+
import rolesMap from 'aria-query/src/rolesMap';
5+
import ariaPropsMap from 'aria-query/src/ariaPropsMap';
66

77
const entriesList = [
88
["alert", null],

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
"lint": "eslint --ext=js,mjs .",
1414
"prepublishOnly": "npm run build",
1515
"pretest": "npm run lint && flow",
16+
"build:tests": "npm run build && rimraf __tests-built__ && BABEL_ENV=test babel __tests__ --out-dir __tests-built__",
17+
"tests-built": "nyc tape '__tests-built__/**/*.js'",
1618
"tests-only": "nyc tape -r @babel/register '__tests__/**/*.js'",
1719
"test": "npm run tests-only",
20+
"posttest": "npm audit --production",
1821
"output_as_hack": "babel-node ./scripts/output_as_hack.js"
1922
},
2023
"repository": {
@@ -36,6 +39,7 @@
3639
"@babel/core": "^7.24.7",
3740
"@babel/eslint-parser": "^7.19.1",
3841
"@babel/node": "^7.22.5",
42+
"@babel/plugin-transform-react-jsx": "^7.20.7",
3943
"@babel/preset-env": "^7.19.4",
4044
"@babel/preset-flow": "^7.18.6",
4145
"@babel/register": "^7.24.6",
@@ -59,5 +63,8 @@
5963
"not dead",
6064
"not op_mini all",
6165
"ie 11"
62-
]
66+
],
67+
"engines": {
68+
"node": ">= 0.4"
69+
}
6370
}

0 commit comments

Comments
 (0)