Skip to content

Commit

Permalink
[Tests] pre-build the tests, only in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jun 21, 2024
1 parent f6db001 commit aa46e8e
Show file tree
Hide file tree
Showing 11 changed files with 248 additions and 13 deletions.
26 changes: 24 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@
"@babel/preset-flow"
],
"plugins": [
"@babel/plugin-transform-flow-strip-types"
]
"@babel/plugin-transform-flow-strip-types",
],
"env": {
"test": {
"plugins": [
["module-resolver", {
"root": ["./__tests__"],
"alias": {
"^axobject-query/src/(.*)": "./lib/\\1",
}
}]
]
},
"development": {
"plugins": [
["module-resolver", {
"root": ["./src"],
"alias": {
"^axobject-query/src/(.*)": "./src/\\1",
}
}]
]
},
}
}
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ jobs:
with:
range: '>= 0.4'
type: majors
command: npm run tests-only
build-command: npm run build:tests
build-output-dir: |
__tests-built__
lib
command: npm run tests-built

flow:
name: Flow type checking
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ reports/
docs/
.nyc_output/
coverage/
__tests-built__/
2 changes: 1 addition & 1 deletion __tests__/src/AXObjectElementMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'tape';
import deepEqual from 'deep-equal-json';
import inspect from 'object-inspect';

import AXObjectElementMap from '../../src/AXObjectElementMap';
import AXObjectElementMap from 'axobject-query/src/AXObjectElementMap';

const entriesList = [
["AbbrRole", [{"name": "abbr"}]],
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/AXObjectRoleMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'tape';
import deepEqual from 'deep-equal-json';
import inspect from 'object-inspect';

import AXObjectRoleMap from '../../src/AXObjectRoleMap';
import AXObjectRoleMap from 'axobject-query/src/AXObjectRoleMap';

const entriesList = [
["AlertDialogRole", [{"name": "alertdialog"}]],
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/AXObjectsMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'tape';
import deepEqual from 'deep-equal-json';
import inspect from 'object-inspect';

import AXObjectsMap from '../../src/AXObjectsMap';
import AXObjectsMap from 'axobject-query/src/AXObjectsMap';

const entriesList = [
["AbbrRole", {relatedConcepts: [{module: 'HTML',concept: {name: 'abbr',},},],type: 'structure'}],
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/elementAXObjectMap-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'tape';
import deepEqual from 'deep-equal-json';
import inspect from 'object-inspect';

import elementAXObjectMap from '../../src/elementAXObjectMap';
import elementAXObjectMap from 'axobject-query/src/elementAXObjectMap';

const entriesList = [
[{"name": "abbr"}, ["AbbrRole"]],
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/util/iterationDecorator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import test from 'tape';
import values from 'object.values';
import mockProperty from 'mock-property';

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

test('iterationDecorator', (t) => {
t.test('adds a Symbol.iterator property to a collection', async (st) => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/src/util/iteratorProxy-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'tape';

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

test('iteratorProxy', async (t) => {
const arr = ['a', 'b', 'c'];
Expand Down
213 changes: 209 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"prepublishOnly": "npm run build",
"pretest": "npm run lint:fix && npm run flow",
"test": "npm run tests-only",
"build:tests": "npm run build && rimraf __tests-built__ && babel __tests__ --out-dir __tests-built__",
"tests-built": "nyc tape '__tests-built__/**/*.js'",
"tests-only": "nyc tape -r @babel/register '__tests__/**/*.js'"
},
"repository": {
Expand All @@ -37,6 +39,7 @@
"@babel/preset-env": "^7.19.4",
"@babel/preset-flow": "^7.18.6",
"@babel/register": "^7.24.6",
"babel-plugin-module-resolver": "^5.0.2",
"encoding": "^0.1.13",
"eslint": "^8.26.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down

0 comments on commit aa46e8e

Please sign in to comment.