Skip to content

Commit

Permalink
Merge pull request #35 from shgysk8zer0/patch/updates
Browse files Browse the repository at this point in the history
Updates to testing
  • Loading branch information
shgysk8zer0 authored Oct 7, 2024
2 parents 811bace + 725e219 commit 3e583e7
Show file tree
Hide file tree
Showing 10 changed files with 309 additions and 252 deletions.
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

37 changes: 0 additions & 37 deletions .eslintrc.json

This file was deleted.

39 changes: 11 additions & 28 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,16 @@ on:
- master
- release/*
jobs:
npm-test:
name: NPM Install and Test
build:
name: Node CI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true
submodules: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: npm
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- name: Restore cache
uses: actions/cache@v4
# use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Install dependencies
run: npm ci --ignore-scripts --no-audit --no-fund
- name: Run npm test
run: npm test --if-present
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
# `cache: npm` seems to require a `package-lock.json` file
# cache: npm
- run: npm i
- run: npm run build --if-present
- run: npm test
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ node_modules/
importmap.json
importmap.yaml
*.config.js
*.test.js
*.gz
*.tgz
*.log
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.3.1
20.9.0
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Changed
- Update node version via `.npmrc`
- Update Node CI workflow
- Install & use `@shgysk8zer0/eslint-config`
- Add support for `node --test`, including ignoring tests for publishing
- Update ESLint & super-linter
- Switch to more basic Rollup config
- Update `exports` and `main` accordingly

### Fixed
- Fix missed renaming in README

## Removed
- Remove old ESLint config files

## [v1.1.1] - 2023-09-24

### Added
Expand Down
32 changes: 3 additions & 29 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
export default {
'ignores': [
'/node_modules/*',
'/_site/*',
'/img/*',
'/css/*',
'/fonts/*',
'/js/std-js/*',
'**/*.cjs',
'**/*.mjs',
'**/*.min.js',
'*.out.js',
],
'rules': {
'indent': [2, 'tab', { 'SwitchCase': 1 }],
'quotes': [2, 'single'],
'semi': [2, 'always'],
'no-console': 0,
'no-async-promise-executor': 0,
'no-prototype-builtins': 0,
'no-unused-vars': 'error',
},
'languageOptions': {
'globals': {
'globalThis': 'readonly',
'trustedTypes': 'readonly'
}
}
};
import { node } from '@shgysk8zer0/eslint-config';

export default node({ files: ['**/*/js'], ignores: ['**/*.min.js', '**/*.cjs', '**/*.mjs'] });
8 changes: 8 additions & 0 deletions index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test, describe } from 'node:test';
import assert from 'node:assert';
import { MESSAGE } from './consts.js';
const signal = AbortSignal.timeout(300);

describe('An example test', () => {
test('Message is a string', { signal }, () => assert.equal(typeof MESSAGE, 'string', 'Message should be a string.'));
});
Loading

0 comments on commit 3e583e7

Please sign in to comment.