Skip to content

Commit aa46e8e

Browse files
committed
[Tests] pre-build the tests, only in CI
1 parent f6db001 commit aa46e8e

11 files changed

+248
-13
lines changed

.babelrc

+24-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@
44
"@babel/preset-flow"
55
],
66
"plugins": [
7-
"@babel/plugin-transform-flow-strip-types"
8-
]
7+
"@babel/plugin-transform-flow-strip-types",
8+
],
9+
"env": {
10+
"test": {
11+
"plugins": [
12+
["module-resolver", {
13+
"root": ["./__tests__"],
14+
"alias": {
15+
"^axobject-query/src/(.*)": "./lib/\\1",
16+
}
17+
}]
18+
]
19+
},
20+
"development": {
21+
"plugins": [
22+
["module-resolver", {
23+
"root": ["./src"],
24+
"alias": {
25+
"^axobject-query/src/(.*)": "./src/\\1",
26+
}
27+
}]
28+
]
29+
},
30+
}
931
}

.github/workflows/test.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ jobs:
1313
with:
1414
range: '>= 0.4'
1515
type: majors
16-
command: npm run tests-only
16+
build-command: npm run build:tests
17+
build-output-dir: |
18+
__tests-built__
19+
lib
20+
command: npm run tests-built
1721

1822
flow:
1923
name: Flow type checking

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ reports/
44
docs/
55
.nyc_output/
66
coverage/
7+
__tests-built__/

__tests__/src/AXObjectElementMap-test.js

+1-1
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 AXObjectElementMap from '../../src/AXObjectElementMap';
5+
import AXObjectElementMap from 'axobject-query/src/AXObjectElementMap';
66

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

__tests__/src/AXObjectRoleMap-test.js

+1-1
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 AXObjectRoleMap from '../../src/AXObjectRoleMap';
5+
import AXObjectRoleMap from 'axobject-query/src/AXObjectRoleMap';
66

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

__tests__/src/AXObjectsMap-test.js

+1-1
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 AXObjectsMap from '../../src/AXObjectsMap';
5+
import AXObjectsMap from 'axobject-query/src/AXObjectsMap';
66

77
const entriesList = [
88
["AbbrRole", {relatedConcepts: [{module: 'HTML',concept: {name: 'abbr',},},],type: 'structure'}],

__tests__/src/elementAXObjectMap-test.js

+1-1
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 elementAXObjectMap from '../../src/elementAXObjectMap';
5+
import elementAXObjectMap from 'axobject-query/src/elementAXObjectMap';
66

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

__tests__/src/util/iterationDecorator-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import test from 'tape';
22
import values from 'object.values';
33
import mockProperty from 'mock-property';
44

5-
import iterationDecorator from '../../../src/util/iterationDecorator';
5+
import iterationDecorator from 'axobject-query/src/util/iterationDecorator';
66

77
test('iterationDecorator', (t) => {
88
t.test('adds a Symbol.iterator property to a collection', async (st) => {

__tests__/src/util/iteratorProxy-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'tape';
22

3-
import iteratorProxy from '../../../src/util/iteratorProxy';
3+
import iteratorProxy from 'axobject-query/src/util/iteratorProxy';
44

55
test('iteratorProxy', async (t) => {
66
const arr = ['a', 'b', 'c'];

package-lock.json

+209-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"prepublishOnly": "npm run build",
1515
"pretest": "npm run lint:fix && npm run flow",
1616
"test": "npm run tests-only",
17+
"build:tests": "npm run build && rimraf __tests-built__ && babel __tests__ --out-dir __tests-built__",
18+
"tests-built": "nyc tape '__tests-built__/**/*.js'",
1719
"tests-only": "nyc tape -r @babel/register '__tests__/**/*.js'"
1820
},
1921
"repository": {
@@ -37,6 +39,7 @@
3739
"@babel/preset-env": "^7.19.4",
3840
"@babel/preset-flow": "^7.18.6",
3941
"@babel/register": "^7.24.6",
42+
"babel-plugin-module-resolver": "^5.0.2",
4043
"encoding": "^0.1.13",
4144
"eslint": "^8.26.0",
4245
"eslint-config-airbnb-base": "^15.0.0",

0 commit comments

Comments
 (0)