Skip to content

Commit a312203

Browse files
🤖 test: Allow to test build with AVA.
These changes were automatically generated by a transform whose code can be found at: - https://github.com/make-github-pseudonymous-again/rejuvenate/blob/3fadbfc03be787be61d688a4b90430927ab58aa5/src/transforms/ava:test-build.js Please contact the author of the transform if you believe there was an error.
1 parent 90a09a1 commit a312203

21 files changed

+147
-27
lines changed

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: ci
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
9+
build:
10+
name: Continuous integration (build)
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout 🛎️
14+
uses: actions/checkout@v3
15+
16+
- name: Install 📦
17+
uses: bahmutov/npm-install@v1
18+
with:
19+
install-command: yarn --frozen-lockfile --ignore-scripts
20+
useRollingCache: true
21+
22+
- name: Build 🏗️
23+
run: yarn build
24+
25+
- name: Archive build 💽
26+
uses: actions/upload-artifact@v2
27+
with:
28+
name: dist
29+
path: dist
30+
retention-days: 1
31+
32+
test:
33+
needs: ["build"]
34+
name: Continuous integration (tests)
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
bundle: ["modern", "module", "cjs"]
39+
steps:
40+
- name: Checkout 🛎️
41+
uses: actions/checkout@v3
42+
43+
- name: Install 📦
44+
uses: bahmutov/npm-install@v1
45+
with:
46+
install-command: yarn --frozen-lockfile --ignore-scripts
47+
useRollingCache: true
48+
49+
- name: Load build 💽
50+
uses: actions/download-artifact@v2
51+
with:
52+
name: dist
53+
path: dist
54+
55+
- name: Test 🔬
56+
run: yarn test:${{ matrix.bundle }}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
name: ci:test
1+
name: ci:cover
22
on:
33
- push
44
- pull_request
55
jobs:
6-
test:
7-
name: Continuous integration (tests)
6+
cover:
7+
name: Continuous integration (code coverage)
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout 🛎️
1111
uses: actions/checkout@v3
1212

13-
- name: Install 🔧
13+
- name: Install 📦
1414
uses: bahmutov/npm-install@v1
1515
with:
1616
install-command: yarn --frozen-lockfile --ignore-scripts
1717
useRollingCache: true
1818

19-
- name: Test 🔬
20-
run: yarn ci:test
19+
- name: Test and record coverage 🔬
20+
run: yarn cover
2121

2222
- name: Publish coverage report 📃
23-
uses: codecov/codecov-action@v3
23+
uses: codecov/codecov-action@v2
2424
with:
2525
fail_ci_if_error: true

.github/workflows/ci:lint-config.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: ci:lint-config
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
cover:
7+
name: Continuous integration (config linting)
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout 🛎️
11+
uses: actions/checkout@v3
12+
13+
- name: Install 📦
14+
uses: bahmutov/npm-install@v1
15+
with:
16+
install-command: yarn --frozen-lockfile --ignore-scripts
17+
useRollingCache: true
18+
19+
- name: Lint config 👕
20+
run: yarn lint-config
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
name: ci:build
1+
name: ci:lint
22
on:
33
- push
44
- pull_request
55
jobs:
6-
test:
7-
name: Continuous integration (build)
6+
cover:
7+
name: Continuous integration (code linting)
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout 🛎️
1111
uses: actions/checkout@v3
1212

13-
- name: Install 🔧
13+
- name: Install 📦
1414
uses: bahmutov/npm-install@v1
1515
with:
1616
install-command: yarn --frozen-lockfile --ignore-scripts
1717
useRollingCache: true
1818

19-
- name: Build 🏗️
20-
run: yarn ci:build
19+
- name: Lint 👕
20+
run: yarn lint

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ next( reversed( identity( 3 ) ) ) ; // [ 0 , 1 , 2 ]
2323

2424
[![License](https://img.shields.io/github/license/computational-combinatorics/permutation.svg)](https://raw.githubusercontent.com/computational-combinatorics/permutation/main/LICENSE)
2525
[![Version](https://img.shields.io/npm/v/@combinatorics/permutation.svg)](https://www.npmjs.org/package/@combinatorics/permutation)
26-
[![Tests](https://img.shields.io/github/workflow/status/computational-combinatorics/permutation/ci:test?event=push&label=tests)](https://github.com/computational-combinatorics/permutation/actions/workflows/ci:test.yml?query=branch:main)
26+
[![Tests](https://img.shields.io/github/workflow/status/computational-combinatorics/permutation/ci?event=push&label=tests)](https://github.com/computational-combinatorics/permutation/actions/workflows/ci.yml?query=branch:main)
2727
[![Dependencies](https://img.shields.io/david/computational-combinatorics/permutation.svg)](https://david-dm.org/computational-combinatorics/permutation)
2828
[![Dev dependencies](https://img.shields.io/david/dev/computational-combinatorics/permutation.svg)](https://david-dm.org/computational-combinatorics/permutation?type=dev)
2929
[![GitHub issues](https://img.shields.io/github/issues/computational-combinatorics/permutation.svg)](https://github.com/computational-combinatorics/permutation/issues)

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@
4545
"build": "NODE_ENV=production microbundle",
4646
"build-docs": "esdoc",
4747
"build-gh-pages": "npm run build-docs",
48-
"ci:build": "npm run build",
49-
"ci:test": "npm run lint-config && npm run lint && npm run cover",
5048
"commit-msg": "commitlint --edit",
5149
"cover": "NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test",
5250
"debug": "NODE_ENV=debug npm run test -- -st --fail-fast",
@@ -62,7 +60,13 @@
6260
"prepare": "npm run build",
6361
"prepublishOnly": "pinst --disable",
6462
"release": "np --message ':hatching_chick: release: Bumping to v%s.'",
65-
"test": "ava"
63+
"test": "npm run test:src",
64+
"test-cmd": "NODE_LOADER_CONFIG=test/loader/config.js ava",
65+
"test:cjs": "IMPORT_MAP_PATH=test/import-maps/dist/index.json npm run test-cmd",
66+
"test:dist": "npm run test:modern && npm run test:module && npm run test:cjs",
67+
"test:modern": "IMPORT_MAP_PATH=test/import-maps/dist/index.modern.json npm run test-cmd",
68+
"test:module": "IMPORT_MAP_PATH=test/import-maps/dist/index.module.json npm run test-cmd",
69+
"test:src": "IMPORT_MAP_PATH=test/import-maps/src/index.json npm run test-cmd"
6670
},
6771
"dependencies": {},
6872
"devDependencies": {
@@ -77,6 +81,8 @@
7781
"@iterable-iterator/slice": "1.0.2",
7882
"@js-library/commitlint-config": "0.0.4",
7983
"@node-loader/babel": "2.0.1",
84+
"@node-loader/core": "2.0.0",
85+
"@node-loader/import-maps": "1.0.3",
8086
"@randomized/random": "4.1.0",
8187
"@set-theory/closure": "1.0.0",
8288
"@total-order/lex": "1.0.0",
@@ -109,7 +115,7 @@
109115
],
110116
"timeout": "1m",
111117
"nodeArguments": [
112-
"--experimental-loader=@node-loader/babel"
118+
"--experimental-loader=@node-loader/core"
113119
]
114120
},
115121
"babel": {

test/import-maps/dist/index.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"imports": {
3+
"#module": "./dist/index.cjs"
4+
}
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"imports": {
3+
"#module": "./dist/index.modern.js"
4+
}
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"imports": {
3+
"#module": "./dist/index.module.js"
4+
}
5+
}

test/import-maps/src/index.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"imports": {
3+
"#module": "./src/index.js"
4+
}
5+
}

test/loader/config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import * as importMapLoader from '@node-loader/import-maps';
2+
import * as babelLoader from '@node-loader/babel';
3+
4+
const config = {
5+
loaders: [importMapLoader, babelLoader],
6+
};
7+
8+
export default config;

test/src/apply.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
22
import {shuffle} from '@randomized/random';
3-
import {apply, identity, transpositions} from '../../src/index.js';
3+
import {apply, identity, transpositions} from '#module';
44

55
function macro(t, size) {
66
const sigma = identity(size);

test/src/bitreversal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import test from 'ava';
2-
import {bitreversal} from '../../src/index.js';
2+
import {bitreversal} from '#module';
33

44
test('bitreversal', (t) => {
55
t.deepEqual(bitreversal(1), [0]);

test/src/copy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
22
import {shuffle} from '@randomized/random';
3-
import {copy, identity} from '../../src/index.js';
3+
import {copy, identity} from '#module';
44

55
function macro(t, size) {
66
const sigma = identity(size);

test/src/invert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
identity,
99
invert,
1010
itranspositions,
11-
} from '../../src/index.js';
11+
} from '#module';
1212

1313
function macro(t, do_invert, size) {
1414
const sigma = identity(size);

test/src/next.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {takewhile} from '@iterable-iterator/slice';
88
import {singletonUnderUnaryOperator as closure} from '@set-theory/closure';
99
import {partial} from '@functional-abstraction/functools';
1010
import {factorial} from '@combinatorics/factorial';
11-
import {identity, next} from '../../src/index.js';
11+
import {identity, next} from '#module';
1212

1313
function macro(t, size) {
1414
const compare = fixedlexicographical(increasing, size);

test/src/permutations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {increasing} from '@total-order/primitive';
33
import {fixedlexicographical} from '@total-order/lex';
44
import {isSorted} from '@comparison-sorting/is-sorted';
55
import {factorial} from '@combinatorics/factorial';
6-
import {identity, next, permutations} from '../../src/index.js';
6+
import {identity, next, permutations} from '#module';
77

88
function macro(t, size) {
99
const compare = fixedlexicographical(increasing, size);

test/src/reversed.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
22
import {shuffle} from '@randomized/random';
3-
import {identity, reversed} from '../../src/index.js';
3+
import {identity, reversed} from '#module';
44

55
function macro(t, size) {
66
const sigma = identity(size);

test/src/transpose.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
22
import {randint, shuffle} from '@randomized/random';
3-
import {copy, compose, identity, transpose} from '../../src/index.js';
3+
import {copy, compose, identity, transpose} from '#module';
44

55
function macro(t, size) {
66
const sigma = identity(size);

test/src/transposition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import test from 'ava';
22
import {randint} from '@randomized/random';
3-
import {identity, compose, transposition} from '../../src/index.js';
3+
import {identity, compose, transposition} from '#module';
44

55
function macro(t, size) {
66
const id = identity(size);

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,6 +2196,16 @@
21962196
resolved "https://registry.yarnpkg.com/@node-loader/babel/-/babel-2.0.1.tgz#a04d7535b5ade12e3987de04fc5ffe204f26c64c"
21972197
integrity sha512-lulESaNn+jyn4lCbfcFWFcRYchsL0jY8q/mf5XRKOiX2uTpkXE3fGAlZ4+wyP/hIAMSlDPuHIUkRSTkJZ6SQyA==
21982198

2199+
"@node-loader/core@2.0.0":
2200+
version "2.0.0"
2201+
resolved "https://registry.yarnpkg.com/@node-loader/core/-/core-2.0.0.tgz#7f5a3a91fe137c8e71c0813f3bbaa0ee136a1308"
2202+
integrity sha512-7wV4qj2/tROXGgoYWmNvObUXbXqSv1yUD31K79Jt1q7NDuqrLz4WjjW+wVoCNgVcl8+YSj9BvLX8KsB/SrSzuw==
2203+
2204+
"@node-loader/import-maps@1.0.3":
2205+
version "1.0.3"
2206+
resolved "https://registry.yarnpkg.com/@node-loader/import-maps/-/import-maps-1.0.3.tgz#4dff536d5dd4d9ff3510e1d2e0ddaf86630d4299"
2207+
integrity sha512-Wjw7atGrC/s9m26k853N93xUi9fxo8wcL8asFXqpkITRltuUmbSVyzblW7K742SCC/Ev9FM0zcS72CPreBu8Kg==
2208+
21992209
"@nodelib/fs.scandir@2.1.5":
22002210
version "2.1.5"
22012211
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"

0 commit comments

Comments
 (0)