Skip to content

Commit

Permalink
Update everything, switch to Vitest
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Feb 10, 2024
1 parent 611d87b commit 67bd361
Show file tree
Hide file tree
Showing 16 changed files with 3,159 additions and 10,433 deletions.
11 changes: 8 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const warn = process.argv.includes("--report-unused-disable-directives")
module.exports = {
root: true,
extends: ["eslint:recommended"],
plugins: ["jest"],
plugins: ["vitest"],
parserOptions: {
ecmaVersion: 2018,
},
Expand Down Expand Up @@ -63,10 +63,15 @@ module.exports = {
yoda: warn,
},
overrides: [
{
files: ["test/*.js", "*.mjs"],
parserOptions: {
sourceType: "module",
},
},
{
files: ["*.test.js"],
extends: ["plugin:jest/recommended"],
env: { "jest/globals": true },
extends: ["plugin:vitest/recommended"],
},
],
};
22 changes: 9 additions & 13 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,27 @@ jobs:

strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node-version }}"

- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ matrix.node-version }}-${{ hashFiles('package.json', 'package-lock.json') }}

- name: npm ci
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm ci
- if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm ci --no-audit

- name: Build
run: npm run build
- run: npm run build

- name: ESLint
run: npx eslint . --report-unused-disable-directives
- run: npx eslint . --report-unused-disable-directives

- name: Prettier
run: npx prettier --check .
- run: npx prettier --check .
16 changes: 7 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,23 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "${{ matrix.node-version }}"

- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ matrix.node-version }}-${{ hashFiles('package.json', 'package-lock.json') }}

- name: npm ci
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm ci
- if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm ci --no-audit

- name: Jest
run: npx jest --coverage
- run: npx vitest
2 changes: 1 addition & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ for (const { src, dest = src, transform } of FILES_TO_COPY) {
if (transform) {
fs.writeFileSync(
path.join(BUILD, dest),
transform(fs.readFileSync(path.join(DIR, src), "utf8"))
transform(fs.readFileSync(path.join(DIR, src), "utf8")),
);
} else {
fs.copyFileSync(path.join(DIR, src), path.join(BUILD, dest));
Expand Down
13 changes: 0 additions & 13 deletions jest.config.js

This file was deleted.

Loading

0 comments on commit 67bd361

Please sign in to comment.