Skip to content

Commit

Permalink
🤖 test: Allow to test build with AVA.
Browse files Browse the repository at this point in the history
These changes were automatically generated by a transform whose code can be found at:
  - https://github.com/make-github-pseudonymous-again/rejuvenate/blob/a9afbfe78a793f6bba0aae1432dd3bacf30c05a5/src/transforms/ava:test-build.js
Please contact the author of the transform if you believe there was an error.
  • Loading branch information
a-flying-potato authored and make-github-pseudonymous-again committed Oct 28, 2022
1 parent 9bfff41 commit b613603
Show file tree
Hide file tree
Showing 62 changed files with 190 additions and 67 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: ci

on:
- push
- pull_request

jobs:

build:
name: Continuous integration (build)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Build 🏗️
run: yarn build

- name: Archive build 💽
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
retention-days: 1

test:
needs: ["build"]
name: Continuous integration (tests)
runs-on: ubuntu-latest
strategy:
matrix:
bundle: ["modern", "module", "cjs"]
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Load build 💽
uses: actions/download-artifact@v3
with:
name: dist
path: dist

- name: Test 🔬
run: yarn test:${{ matrix.bundle }}
12 changes: 6 additions & 6 deletions .github/workflows/ci:test.yml → .github/workflows/ci:cover.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
name: ci:test
name: ci:cover
on:
- push
- pull_request
jobs:
test:
name: Continuous integration (tests)
cover:
name: Continuous integration (code coverage)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install 🔧
- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Test 🔬
run: yarn ci:test
- name: Test and record coverage 🔬
run: yarn cover

- name: Publish coverage report 📃
uses: codecov/codecov-action@v3
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/ci:lint-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: ci:lint-config
on:
- push
- pull_request
jobs:
cover:
name: Continuous integration (config linting)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Lint config 👕
run: yarn lint-config
12 changes: 6 additions & 6 deletions .github/workflows/ci:build.yml → .github/workflows/ci:lint.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: ci:build
name: ci:lint
on:
- push
- pull_request
jobs:
test:
name: Continuous integration (build)
cover:
name: Continuous integration (code linting)
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Install 🔧
- name: Install 📦
uses: bahmutov/npm-install@v1
with:
install-command: yarn --frozen-lockfile --ignore-scripts
useRollingCache: true

- name: Build 🏗️
run: yarn ci:build
- name: Lint 👕
run: yarn lint
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mul( 6 , 7 ) ; // 42

[![License](https://img.shields.io/github/license/arithmetic-type/double.svg)](https://raw.githubusercontent.com/arithmetic-type/double/main/LICENSE)
[![Version](https://img.shields.io/npm/v/@arithmetic-type/double.svg)](https://www.npmjs.org/package/@arithmetic-type/double)
[![Tests](https://img.shields.io/github/workflow/status/arithmetic-type/double/ci:test?event=push&label=tests)](https://github.com/arithmetic-type/double/actions/workflows/ci:test.yml?query=branch:main)
[![Tests](https://img.shields.io/github/workflow/status/arithmetic-type/double/ci?event=push&label=tests)](https://github.com/arithmetic-type/double/actions/workflows/ci.yml?query=branch:main)
[![Dependencies](https://img.shields.io/librariesio/github/arithmetic-type/double.svg)](https://github.com/arithmetic-type/double/network/dependencies)
[![GitHub issues](https://img.shields.io/github/issues/arithmetic-type/double.svg)](https://github.com/arithmetic-type/double/issues)
[![Downloads](https://img.shields.io/npm/dm/@arithmetic-type/double.svg)](https://www.npmjs.org/package/@arithmetic-type/double)
Expand Down
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
"build": "NODE_ENV=production microbundle",
"build-docs": "esdoc",
"build-gh-pages": "npm run build-docs",
"ci:build": "npm run build",
"ci:test": "npm run lint-config && npm run lint && npm run cover",
"commit-msg": "commitlint --edit",
"cover": "NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test",
"debug": "NODE_ENV=debug npm run test -- -st --fail-fast",
Expand All @@ -62,7 +60,13 @@
"prepare": "npm run build",
"prepublishOnly": "pinst --disable",
"release": "np --message ':hatching_chick: release: Bumping to v%s.'",
"test": "ava"
"test": "npm run test:src",
"test-cmd": "NODE_LOADER_CONFIG=test/loader/config.js ava",
"test:cjs": "IMPORT_MAP_PATH=test/import-maps/dist/index.json npm run test-cmd",
"test:dist": "npm run test:modern && npm run test:module && npm run test:cjs",
"test:modern": "IMPORT_MAP_PATH=test/import-maps/dist/index.modern.json npm run test-cmd",
"test:module": "IMPORT_MAP_PATH=test/import-maps/dist/index.module.json npm run test-cmd",
"test:src": "IMPORT_MAP_PATH=test/import-maps/src/index.json npm run test-cmd"
},
"dependencies": {},
"devDependencies": {
Expand All @@ -72,6 +76,8 @@
"@babel/register": "7.18.9",
"@commitlint/cli": "17.1.2",
"@js-library/commitlint-config": "0.0.4",
"@node-loader/core": "2.0.0",
"@node-loader/import-maps": "1.1.0",
"@randomized/random": "4.1.0",
"ava": "^3.15.0",
"babel-plugin-transform-remove-console": "6.9.4",
Expand Down Expand Up @@ -101,7 +107,10 @@
"@babel/register"
],
"timeout": "1m",
"concurrency": 8
"concurrency": 8,
"nodeArguments": [
"--experimental-loader=@node-loader/core"
]
},
"babel": {
"sourceMaps": true,
Expand Down
5 changes: 5 additions & 0 deletions test/import-maps/dist/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"#module": "./dist/index.cjs"
}
}
5 changes: 5 additions & 0 deletions test/import-maps/dist/index.modern.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"#module": "./dist/index.modern.js"
}
}
5 changes: 5 additions & 0 deletions test/import-maps/dist/index.module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"#module": "./dist/index.module.js"
}
}
5 changes: 5 additions & 0 deletions test/import-maps/src/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"imports": {
"#module": "./src/index.js"
}
}
8 changes: 8 additions & 0 deletions test/loader/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as importMapLoader from '@node-loader/import-maps';
import * as babelLoader from '@node-loader/babel';

const config = {
loaders: [importMapLoader, babelLoader],
};

export default config;
2 changes: 1 addition & 1 deletion test/src/arithmetic/add.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../src/index.js';
import * as number from '#module';

test('add', (t) => {
const one = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/constants/add1.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../../src/index.js';
import * as number from '#module';

test('add1', (t) => {
const one = function (n) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/constants/div2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../../src/index.js';
import * as number from '#module';

test('div2', (t) => {
const one = function (n) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/constants/iadd1.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../../src/index.js';
import * as number from '#module';

test('iadd1', (t) => {
const one = function (n) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/constants/idiv2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../../src/index.js';
import * as number from '#module';

test('idiv2', (t) => {
const one = function (n) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/constants/imul2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../../src/index.js';
import * as number from '#module';

test('imul2', (t) => {
const one = function (a) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/constants/imul5.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../../src/index.js';
import * as number from '#module';

test('imul5', (t) => {
const one = function (a) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/constants/isub1.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../../src/index.js';
import * as number from '#module';

test('isub1', (t) => {
const one = function (n) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/constants/mul2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../../src/index.js';
import * as number from '#module';

test('mul2', (t) => {
const one = function (a) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/constants/mul5.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../../src/index.js';
import * as number from '#module';

test('mul5', (t) => {
const one = function (a) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/constants/sub1.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../../src/index.js';
import * as number from '#module';

test('sub1', (t) => {
const one = function (n) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/div.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../src/index.js';
import * as number from '#module';

test('div', (t) => {
const one = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/divmod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import test from 'ava';
import {min, max} from '@arithmetic-type/int32';
import {randint} from '@randomized/random';

import {divmod} from '../../../src/index.js';
import {divmod} from '#module';

test('divmod', (t) => {
const one = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/iadd.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../src/index.js';
import * as number from '#module';

test('iadd', (t) => {
const one = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/idiv.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../src/index.js';
import * as number from '#module';

test('idiv', (t) => {
const one = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/idivmod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import test from 'ava';
import {min, max} from '@arithmetic-type/int32';
import {randint} from '@randomized/random';

import {idivmod} from '../../../src/index.js';
import {idivmod} from '#module';

test('idivmod', (t) => {
const one = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/imod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import test from 'ava';
import {min, max} from '@arithmetic-type/int32';
import {randint} from '@randomized/random';

import {imod} from '../../../src/index.js';
import {imod} from '#module';

test('imod', (t) => {
const one = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/imul.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../src/index.js';
import * as number from '#module';

test('imul', (t) => {
const one = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/ishl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../src/index.js';
import * as number from '#module';

test('ishl', (t) => {
const n = 10;
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/ishr.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../src/index.js';
import * as number from '#module';

test('ishr', (t) => {
const n = 10;
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/ishu.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../src/index.js';
import * as number from '#module';

test('ishu', (t) => {
const n = 10;
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/isub.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../src/index.js';
import * as number from '#module';

test('isub', (t) => {
const one = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import test from 'ava';
import {min, max} from '@arithmetic-type/int32';
import {randint} from '@randomized/random';

import {mod} from '../../../src/index.js';
import {mod} from '#module';

test('mod', (t) => {
const one = function (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/arithmetic/mul.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import * as number from '../../../src/index.js';
import * as number from '#module';

test('mul', (t) => {
const one = function (a, b) {
Expand Down
Loading

0 comments on commit b613603

Please sign in to comment.