Skip to content

Commit

Permalink
feat: support node 20/21
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed May 1, 2024
1 parent 12d4a2b commit 7878877
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 61 deletions.
99 changes: 50 additions & 49 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,74 +7,75 @@ jobs:
runs-on: ubuntu-latest

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

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 21
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 21

- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install dependencies
run: pnpm install
- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm lint
- name: Lint
run: pnpm lint

typecheck:
runs-on: ubuntu-latest

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

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 21
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 21

- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install dependencies
run: |
pnpm install
pnpm -r build
- name: Install dependencies
run: |
pnpm install
pnpm -r build
- name: Typecheck
run: pnpm typecheck
- name: Typecheck
run: pnpm typecheck

tests:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node: [20, 21, 22]
runs-on: ${{ matrix.os }}
timeout-minutes: 10

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 21

- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install dependencies
run: |
pnpm install
pnpm -r build
- name: Run tests
env:
FORCE_COLOR: 1
run: pnpm test
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Install pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install dependencies
run: |
pnpm install
pnpm -r build
- name: Run tests
env:
FORCE_COLOR: 1
run: pnpm test
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@types/supertest": "^6.0.2",
"c8": "^9.1.0",
"del-cli": "^5.1.0",
"desm": "^1.3.1",
"eslint": "^8.57.0",
"execa": "^8.0.1",
"fs-extra": "^11.2.0",
Expand Down
1 change: 1 addition & 0 deletions packages/dump_viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"dependencies": {
"@unocss/reset": "^0.59.0",
"desm": "^1.3.1",
"preact": "^10.19.6",
"vis-data": "^7.1.9",
"vis-network": "^9.1.9"
Expand Down
4 changes: 2 additions & 2 deletions packages/dump_viewer/src/dump_viewer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { join } from 'node:path'
import { join } from 'desm'
import { readFile } from 'node:fs/promises'

/**
Expand All @@ -14,7 +14,7 @@ export async function dumpViewer() {
/**
* Load the HTML content and replace the placeholder with the dump
*/
const htmlLocation = join(import.meta.dirname, 'index.html')
const htmlLocation = join(import.meta.url, 'index.html')
let html = await readFile(htmlLocation, 'utf8')
html = html.replace('$__hot_hook_placeholder__', JSON.stringify(dump))

Expand Down
8 changes: 4 additions & 4 deletions packages/hot_hook/bin/test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { configure, processCLIArgs, run } from '@japa/runner'
import { join } from 'desm'
import { assert } from '@japa/assert'
import { fileSystem } from '@japa/file-system'
import { snapshot } from '@japa/snapshot'
import { join } from 'node:path'
import { fileSystem } from '@japa/file-system'
import { configure, processCLIArgs, run } from '@japa/runner'

processCLIArgs(process.argv.splice(2))
configure({
files: ['tests/**/*.spec.ts'],
plugins: [
assert(),
fileSystem({ basePath: join(import.meta.dirname, '../tmp'), autoClean: true }),
fileSystem({ basePath: join(import.meta.url, '../tmp'), autoClean: true }),
snapshot(),
],
})
Expand Down
5 changes: 3 additions & 2 deletions packages/hot_hook/tests/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import fs from 'fs-extra'
import { join } from 'desm'
import path from 'node:path'
import pTimeout from 'p-timeout'
import { pEvent } from 'p-event'
import path, { join } from 'node:path'
import { getActiveTest } from '@japa/runner'
import { NodeOptions, execaNode } from 'execa'

export const projectRoot = join(import.meta.dirname, '../')
export const projectRoot = join(import.meta.url, '../')

export async function fakeInstall(destination: string) {
const { name: packageName, bin = {} } = await fs.readJson(
Expand Down
8 changes: 4 additions & 4 deletions packages/runner/bin/test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { configure, processCLIArgs, run } from '@japa/runner'
import { join } from 'desm'
import { assert } from '@japa/assert'
import { fileSystem } from '@japa/file-system'
import { snapshot } from '@japa/snapshot'
import { join } from 'node:path'
import { fileSystem } from '@japa/file-system'
import { configure, processCLIArgs, run } from '@japa/runner'

processCLIArgs(process.argv.splice(2))
configure({
files: ['tests/**/*.spec.ts'],
plugins: [
assert(),
fileSystem({ basePath: join(import.meta.dirname, '../tmp'), autoClean: true }),
fileSystem({ basePath: join(import.meta.url, '../tmp'), autoClean: true }),
snapshot(),
],
})
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7878877

Please sign in to comment.