Skip to content

Commit b99f35b

Browse files
🤖 config(ci): 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/31b7e48f29789fa2e2ad9e16013ff277c3bbca57/src/transforms/ava:test-build.js Please contact the author of the transform if you believe there was an error.
1 parent b552283 commit b99f35b

File tree

11 files changed

+106
-26
lines changed

11 files changed

+106
-26
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@v4
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@v4
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:build.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ build(s, 0, s.length, t, 0);
1313

1414
[![License](https://img.shields.io/github/license/string-data-structure/longest-prefix-suffix-array.svg)](https://raw.githubusercontent.com/string-data-structure/longest-prefix-suffix-array/main/LICENSE)
1515
[![Version](https://img.shields.io/npm/v/@string-data-structure/longest-prefix-suffix-array.svg)](https://www.npmjs.org/package/@string-data-structure/longest-prefix-suffix-array)
16-
[![Tests](https://img.shields.io/github/workflow/status/string-data-structure/longest-prefix-suffix-array/ci:cover?event=push&label=tests)](https://github.com/string-data-structure/longest-prefix-suffix-array/actions/workflows/ci:cover.yml?query=branch:main)
16+
[![Tests](https://img.shields.io/github/workflow/status/string-data-structure/longest-prefix-suffix-array/ci?event=push&label=tests)](https://github.com/string-data-structure/longest-prefix-suffix-array/actions/workflows/ci.yml?query=branch:main)
1717
[![Dependencies](https://img.shields.io/librariesio/github/string-data-structure/longest-prefix-suffix-array.svg)](https://github.com/string-data-structure/longest-prefix-suffix-array/network/dependencies)
1818
[![GitHub issues](https://img.shields.io/github/issues/string-data-structure/longest-prefix-suffix-array.svg)](https://github.com/string-data-structure/longest-prefix-suffix-array/issues)
1919
[![Downloads](https://img.shields.io/npm/dm/@string-data-structure/longest-prefix-suffix-array.svg)](https://www.npmjs.org/package/@string-data-structure/longest-prefix-suffix-array)

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
"build": "NODE_ENV=production microbundle",
4949
"build-docs": "esdoc",
5050
"build-gh-pages": "npm run build-docs",
51-
"ci:build": "npm run build",
52-
"ci:test": "npm run lint-config && npm run lint && npm run cover",
5351
"commit-msg": "commitlint --edit",
5452
"cover": "NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test",
5553
"debug": "NODE_ENV=debug npm run test -- -st --fail-fast",
@@ -65,7 +63,13 @@
6563
"prepare": "npm run build",
6664
"prepublishOnly": "pinst --disable",
6765
"release": "np --message ':hatching_chick: release: Bumping to v%s.'",
68-
"test": "ava"
66+
"test": "npm run test:src",
67+
"test-cmd": "NODE_LOADER_CONFIG=test/loader/config.js ava",
68+
"test:cjs": "IMPORT_MAP_PATH=test/import-maps/dist/index.json npm run test-cmd",
69+
"test:dist": "npm run test:modern && npm run test:module && npm run test:cjs",
70+
"test:modern": "IMPORT_MAP_PATH=test/import-maps/dist/index.modern.json npm run test-cmd",
71+
"test:module": "IMPORT_MAP_PATH=test/import-maps/dist/index.module.json npm run test-cmd",
72+
"test:src": "IMPORT_MAP_PATH=test/import-maps/src/index.json npm run test-cmd"
6973
},
7074
"dependencies": {},
7175
"devDependencies": {
@@ -74,6 +78,8 @@
7478
"@commitlint/cli": "18.6.0",
7579
"@js-library/commitlint-config": "0.0.4",
7680
"@node-loader/babel": "2.0.1",
81+
"@node-loader/core": "2.0.0",
82+
"@node-loader/import-maps": "1.1.0",
7783
"ava": "6.1.1",
7884
"babel-plugin-transform-remove-console": "6.9.4",
7985
"babel-plugin-unassert": "3.2.0",
@@ -99,7 +105,7 @@
99105
"test/src/**/*"
100106
],
101107
"nodeArguments": [
102-
"--experimental-loader=@node-loader/babel"
108+
"--experimental-loader=@node-loader/core"
103109
],
104110
"require": [
105111
"regenerator-runtime/runtime.js"

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 babelLoader from '@node-loader/babel';
2+
import * as importMapLoader from '@node-loader/import-maps';
3+
4+
const config = {
5+
loaders: [importMapLoader, babelLoader],
6+
};
7+
8+
export default config;

test/src/_fixtures.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {build} from '../../src/index.js';
1+
import {build} from '#module';
22

33
const _lpsa = (p, pi, pj) => {
44
// eslint-disable-next-line unicorn/no-new-array

0 commit comments

Comments
 (0)