Skip to content

Commit a2d16d1

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/9b50c2a1d7e9ab7b4bc9c9ff88892e98c5f62244/src/transforms/ava:test-build.js Please contact the author of the transform if you believe there was an error.
1 parent 4edbe37 commit a2d16d1

File tree

19 files changed

+144
-29
lines changed

19 files changed

+144
-29
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@v3
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@v3
51+
with:
52+
name: dist
53+
path: dist
54+
55+
- name: Test 🔬
56+
run: yarn test:${{ matrix.bundle }}

.github/workflows/ci:test.yml renamed to .github/workflows/ci:cover.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
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 📃
2323
uses: codecov/codecov-action@v3

.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
@@ -21,7 +21,7 @@ list.remove(...)
2121

2222
[![License](https://img.shields.io/github/license/data-structures-and-algorithms/skip-list.svg)](https://raw.githubusercontent.com/data-structures-and-algorithms/skip-list/main/LICENSE)
2323
[![Version](https://img.shields.io/npm/v/@data-structure/skip-list.svg)](https://www.npmjs.org/package/@data-structure/skip-list)
24-
[![Tests](https://img.shields.io/github/workflow/status/data-structures-and-algorithms/skip-list/ci:test?event=push&label=tests)](https://github.com/data-structures-and-algorithms/skip-list/actions/workflows/ci:test.yml?query=branch:main)
24+
[![Tests](https://img.shields.io/github/workflow/status/data-structures-and-algorithms/skip-list/ci?event=push&label=tests)](https://github.com/data-structures-and-algorithms/skip-list/actions/workflows/ci.yml?query=branch:main)
2525
[![Dependencies](https://img.shields.io/librariesio/github/data-structures-and-algorithms/skip-list.svg)](https://github.com/data-structures-and-algorithms/skip-list/network/dependencies)
2626
[![GitHub issues](https://img.shields.io/github/issues/data-structures-and-algorithms/skip-list.svg)](https://github.com/data-structures-and-algorithms/skip-list/issues)
2727
[![Downloads](https://img.shields.io/npm/dm/@data-structure/skip-list.svg)](https://www.npmjs.org/package/@data-structure/skip-list)

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
"build": "NODE_ENV=production microbundle",
4848
"build-docs": "esdoc",
4949
"build-gh-pages": "npm run build-docs",
50-
"ci:build": "npm run build",
51-
"ci:test": "npm run lint-config && npm run lint && npm run cover",
5250
"commit-msg": "commitlint --edit",
5351
"cover": "NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test",
5452
"debug": "NODE_ENV=debug npm run test -- -st --fail-fast",
@@ -64,7 +62,13 @@
6462
"prepare": "npm run build",
6563
"prepublishOnly": "pinst --disable",
6664
"release": "np --message ':hatching_chick: release: Bumping to v%s.'",
67-
"test": "ava"
65+
"test": "npm run test:src",
66+
"test-cmd": "NODE_LOADER_CONFIG=test/loader/config.js ava",
67+
"test:cjs": "IMPORT_MAP_PATH=test/import-maps/dist/index.json npm run test-cmd",
68+
"test:dist": "npm run test:modern && npm run test:module && npm run test:cjs",
69+
"test:modern": "IMPORT_MAP_PATH=test/import-maps/dist/index.modern.json npm run test-cmd",
70+
"test:module": "IMPORT_MAP_PATH=test/import-maps/dist/index.module.json npm run test-cmd",
71+
"test:src": "IMPORT_MAP_PATH=test/import-maps/src/index.json npm run test-cmd"
6872
},
6973
"dependencies": {
7074
"@iterable-iterator/cardinality": "^4.0.0",
@@ -85,6 +89,8 @@
8589
"@iterable-iterator/sorted": "^1.0.0",
8690
"@js-library/commitlint-config": "0.0.4",
8791
"@node-loader/babel": "2.0.1",
92+
"@node-loader/core": "2.0.0",
93+
"@node-loader/import-maps": "1.1.0",
8894
"@randomized/random": "^4.1.0",
8995
"@total-order/primitive": "^1.0.1",
9096
"ava": "4.3.3",
@@ -112,7 +118,7 @@
112118
"test/src/**/*"
113119
],
114120
"nodeArguments": [
115-
"--experimental-loader=@node-loader/babel"
121+
"--experimental-loader=@node-loader/core"
116122
],
117123
"require": [
118124
"regenerator-runtime/runtime"

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/SkipList/from.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {list} from '@iterable-iterator/list';
66
import {range} from '@iterable-iterator/range';
77
import {sorted} from '@iterable-iterator/sorted';
88

9-
import {SkipList} from '../../../src/index.js';
9+
import {SkipList} from '#module';
1010

1111
const macro = (t, p, compare, n) => {
1212
const tree = SkipList.from(compare, range(n), p);

test/src/SkipList/get.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {increasing, decreasing} from '@total-order/primitive';
55
import {map} from '@iterable-iterator/map';
66
import {range} from '@iterable-iterator/range';
77

8-
import {SkipList} from '../../../src/index.js';
8+
import {SkipList} from '#module';
99

1010
test('SkipList::get', (t) => {
1111
for (const compare of [increasing, decreasing]) {

test/src/SkipList/has.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {increasing, decreasing} from '@total-order/primitive';
55
import {range} from '@iterable-iterator/range';
66
import {map} from '@iterable-iterator/map';
77

8-
import {SkipList} from '../../../src/index.js';
8+
import {SkipList} from '#module';
99

1010
test('SkipList::has', (t) => {
1111
for (const compare of [increasing, decreasing]) {

test/src/SkipList/iter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {list} from '@iterable-iterator/list';
66
import {range} from '@iterable-iterator/range';
77
import {map} from '@iterable-iterator/map';
88

9-
import {SkipList} from '../../../src/index.js';
9+
import {SkipList} from '#module';
1010

1111
test('SkipList::Symbol.iterator', (t) => {
1212
for (const compare of [increasing, decreasing]) {

test/src/SkipList/range.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {range} from '@iterable-iterator/range';
77

88
import {shuffle} from '@randomized/random';
99

10-
import {SkipList} from '../../../src/index.js';
10+
import {SkipList} from '#module';
1111

1212
test('SkipList::range', (t) => {
1313
for (const [s, compare] of [

test/src/SkipList/remove.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {exhaust} from '@iterable-iterator/consume';
1111

1212
import {shuffle} from '@randomized/random';
1313

14-
import {SkipList} from '../../../src/index.js';
14+
import {SkipList} from '#module';
1515

1616
test('SkipList::remove', (t) => {
1717
const n = 10_000;

test/src/debug.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ import {range} from '@iterable-iterator/range';
66

77
import {increasing, decreasing} from '@total-order/primitive';
88

9-
import {
10-
SkipList,
11-
makeBottomLevel,
12-
makeDeterministic,
13-
debug,
14-
} from '../../src/index.js';
9+
import {SkipList, makeBottomLevel, makeDeterministic, debug} from '#module';
1510

1611
test('debug (empty)', (t) => {
1712
for (const compare of [increasing, decreasing]) {

yarn.lock

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

1346+
"@node-loader/core@2.0.0":
1347+
version "2.0.0"
1348+
resolved "https://registry.yarnpkg.com/@node-loader/core/-/core-2.0.0.tgz#7f5a3a91fe137c8e71c0813f3bbaa0ee136a1308"
1349+
integrity sha512-7wV4qj2/tROXGgoYWmNvObUXbXqSv1yUD31K79Jt1q7NDuqrLz4WjjW+wVoCNgVcl8+YSj9BvLX8KsB/SrSzuw==
1350+
1351+
"@node-loader/import-maps@1.1.0":
1352+
version "1.1.0"
1353+
resolved "https://registry.yarnpkg.com/@node-loader/import-maps/-/import-maps-1.1.0.tgz#4785fdce3bc973c5b53a4549248ab42b370ecda9"
1354+
integrity sha512-RPB+7vBVhk9xF/eiSGSxEnL6hGQ0a1ua9hvl/MxXDmu7F+Nv+gMwA7AJ0S5TmcgulHAp9/IxobGoFiOxkX7xWQ==
1355+
13461356
"@nodelib/fs.scandir@2.1.5":
13471357
version "2.1.5"
13481358
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"

0 commit comments

Comments
 (0)