Commit 72b5604

Anton Golub <antongolub@antongolub.com>
2025-08-21 13:00:57
ci: use nodejs 24 by default (#1330)
* test: check `ProcessPromise.id` is unique * ci: use nodejs 24 by default
1 parent 4dfbaee
.github/workflows/dev-publish.yml
@@ -18,7 +18,7 @@ jobs:
           persist-credentials: false
       - uses: actions/setup-node@v4
         with:
-          node-version: 22
+          node-version: 24
           cache: 'npm'
       - run: npm ci
       - run: npm test
@@ -74,7 +74,7 @@ jobs:
           persist-credentials: false
       - uses: actions/setup-node@v4
         with:
-          node-version: 22
+          node-version: 24
           cache: 'npm'
       - name: Configure npmrc
         run: |
@@ -116,7 +116,7 @@ jobs:
           persist-credentials: false
       - uses: actions/setup-node@v4
         with:
-          node-version: 22
+          node-version: 24
           cache: 'npm'
       - uses: actions/download-artifact@v5
         with:
.github/workflows/jsr-publish.yml
@@ -14,7 +14,7 @@ jobs:
           persist-credentials: false
       - uses: actions/setup-node@v4
         with:
-          node-version: 22
+          node-version: 24
           cache: 'npm'
       - run: npm ci
       - run: npm test
@@ -40,7 +40,7 @@ jobs:
           persist-credentials: false
       - uses: actions/setup-node@v4
         with:
-          node-version: 22
+          node-version: 24
           cache: 'npm'
       - uses: actions/download-artifact@v5
         with:
.github/workflows/publish.yml
@@ -20,7 +20,7 @@ jobs:
           persist-credentials: false
       - uses: actions/setup-node@v4
         with:
-          node-version: 22
+          node-version: 24
           cache: 'npm'
       - run: npm ci
       - run: npm test
@@ -72,7 +72,7 @@ jobs:
           persist-credentials: false
       - uses: actions/setup-node@v4
         with:
-          node-version: 22
+          node-version: 24
           cache: 'npm'
       - name: Configure npmrc
         run: |
@@ -109,7 +109,7 @@ jobs:
           persist-credentials: false
       - uses: actions/setup-node@v4
         with:
-          node-version: 22
+          node-version: 24
           cache: 'npm'
       - uses: actions/download-artifact@v5
         with:
.github/workflows/test.yml
@@ -23,10 +23,10 @@ jobs:
         with:
           persist-credentials: false
 
-      - name: Use Node.js 22.x
+      - name: Use Node.js 24
         uses: actions/setup-node@v4
         with:
-          node-version: 22.x
+          node-version: 24
           cache: 'npm'
 
       - run: npm ci
@@ -53,10 +53,10 @@ jobs:
           persist-credentials: false
           fetch-depth: ${{ github.event_name == 'pull_request' && '15' || '1' }} # to ensure we have enough history for commitlint
 
-      - name: Use Node.js 22.x
+      - name: Use Node.js 24
         uses: actions/setup-node@v4
         with:
-          node-version: 22.x
+          node-version: 24
           cache: 'npm'
 
       - uses: actions/download-artifact@v5
@@ -104,10 +104,10 @@ jobs:
         with:
           persist-credentials: false
 
-      - name: Use Node.js 22.x
+      - name: Use Node.js 24
         uses: actions/setup-node@v4
         with:
-          node-version: 22.x
+          node-version: 24
           cache: 'npm'
 
       - uses: actions/download-artifact@v5
@@ -268,10 +268,10 @@ jobs:
       - uses: actions/checkout@v5
         with:
           persist-credentials: false
-      - name: Use Node.js 22.x
+      - name: Use Node.js 24
         uses: actions/setup-node@v4
         with:
-          node-version: 22.x
+          node-version: 24
           cache: 'npm'
 
       - name: Install deps
build/cli.js
scripts/build-versions.mjs
@@ -23,6 +23,7 @@ const copyright = await fs.readFileSync(
   path.resolve(root, 'test/fixtures/copyright.txt'),
   'utf8'
 )
+const license = copyright.replace('YEAR', new Date().getFullYear())
 const deps = [
   'chalk',
   'depseek',
@@ -67,10 +68,10 @@ const list = JSON.stringify(argv, null, 2)
   .replaceAll('"', "'")
   .replace(/\n}$/, ',\n}')
 
-const versionsTs = `${copyright.replace('YEAR', new Date().getFullYear())}
+const versionsTs = `${license}
 export const versions: Record<string, string> = ${list}
 `
-const versionsCjs = `${copyright.replace('YEAR', new Date().getFullYear())}
+const versionsCjs = `${license}
 module.exports = { versions: ${list}
 `
 
test/fixtures/echo.http
@@ -1,6 +1,5 @@
 HTTP/1.1 200 OK
 Content-Type: text/javascript; charset=UTF-8
-Content-Length: 15
-Server: netcat!
-
-$`echo 'test'`
+Content-Length: 14
+
+$`echo 'test'`
test/fixtures/server.mjs
@@ -19,7 +19,7 @@ export const fakeServer = (data = []) => {
   server.on('connection', (conn) => {
     conn.on('data', () => {
       const d = data.shift() || 'pong'
-      const _d = typeof d === 'string' ? d.replace(/\r?\n/gm, '\r\n') : d
+      const _d = d.toString('utf-8').split(/\r?\n/).join('\r\n')
       conn.write(_d)
     })
   })
test/cli.test.js
@@ -211,7 +211,7 @@ console.log(a);
 
   test('scripts from https 500', async () => {
     const port = await getPort()
-    const server = await fakeServer(['HTTP/1.1 500\n\n']).listen(port)
+    const server = await fakeServer([`HTTP/1.1 500\n\n500\n`]).listen(port)
     const out = await $`node build/cli.js http://127.0.0.1:${port}`.nothrow()
     assert.match(out.stderr, /Error: Can't get/)
     await server.stop()
test/core.test.js
@@ -526,6 +526,18 @@ describe('core', () => {
       assert.ok(p.output instanceof ProcessOutput)
     })
 
+    test('id is unique', async () => {
+      const p1 = $`echo foo`
+      const p2 = $`echo bar`
+
+      assert.ok(p1.id !== p2.id)
+      assert.ok(p1.id.length > 5)
+      assert.ok(p2.id.length > 5)
+
+      await p1
+      await p2
+    })
+
     describe('state machine transitions', () => {
       it('running > fulfilled', async () => {
         const p = $`echo foo`
@@ -975,14 +987,14 @@ describe('core', () => {
 
     describe('unpipe()', () => {
       it('disables piping', async () => {
-        const p1 = $`echo foo && sleep 0.1 && echo bar && sleep 0.1 && echo baz && sleep 0.1 && echo qux`
-        const p2 = $`echo 1 && sleep 0.15 && echo 2 && sleep 0.1 && echo 3`
+        const p1 = $`echo foo && sleep 0.2 && echo bar && sleep 0.2 && echo baz && sleep 0.2 && echo qux`
+        const p2 = $`echo 1 && sleep 0.3 && echo 2 && sleep 0.2 && echo 3`
         const p3 = $`cat`
 
         p1.pipe(p3)
         p2.pipe(p3)
 
-        setTimeout(() => p1.unpipe(p3), 150)
+        setTimeout(() => p1.unpipe(p3), 300)
 
         const { stdout } = await p3
         assert.equal(stdout, 'foo\n1\nbar\n2\n3\n')
test/export.test.js
@@ -230,15 +230,12 @@ describe('index', () => {
     assert.equal(typeof index.fs, 'object', 'index.fs')
     assert.equal(typeof index.fs.Dir, 'function', 'index.fs.Dir')
     assert.equal(typeof index.fs.Dirent, 'function', 'index.fs.Dirent')
-    assert.equal(typeof index.fs.F_OK, 'number', 'index.fs.F_OK')
     assert.equal(typeof index.fs.FileReadStream, 'function', 'index.fs.FileReadStream')
     assert.equal(typeof index.fs.FileWriteStream, 'function', 'index.fs.FileWriteStream')
-    assert.equal(typeof index.fs.R_OK, 'number', 'index.fs.R_OK')
     assert.equal(typeof index.fs.ReadStream, 'function', 'index.fs.ReadStream')
     assert.equal(typeof index.fs.Stats, 'function', 'index.fs.Stats')
-    assert.equal(typeof index.fs.W_OK, 'number', 'index.fs.W_OK')
+    assert.equal(typeof index.fs.Utf8Stream, 'function', 'index.fs.Utf8Stream')
     assert.equal(typeof index.fs.WriteStream, 'function', 'index.fs.WriteStream')
-    assert.equal(typeof index.fs.X_OK, 'number', 'index.fs.X_OK')
     assert.equal(typeof index.fs._toUnixTimestamp, 'function', 'index.fs._toUnixTimestamp')
     assert.equal(typeof index.fs.access, 'function', 'index.fs.access')
     assert.equal(typeof index.fs.accessSync, 'function', 'index.fs.accessSync')
@@ -314,6 +311,7 @@ describe('index', () => {
     assert.equal(typeof index.fs.mkdirs, 'function', 'index.fs.mkdirs')
     assert.equal(typeof index.fs.mkdirsSync, 'function', 'index.fs.mkdirsSync')
     assert.equal(typeof index.fs.mkdtemp, 'function', 'index.fs.mkdtemp')
+    assert.equal(typeof index.fs.mkdtempDisposableSync, 'function', 'index.fs.mkdtempDisposableSync')
     assert.equal(typeof index.fs.mkdtempSync, 'function', 'index.fs.mkdtempSync')
     assert.equal(typeof index.fs.move, 'function', 'index.fs.move')
     assert.equal(typeof index.fs.moveSync, 'function', 'index.fs.moveSync')
package.json
@@ -200,7 +200,7 @@
   "author": "Anton Medvedev <anton@medv.io>",
   "license": "Apache-2.0",
   "volta": {
-    "node": "22.12.0"
+    "node": "24.6.0"
   },
   "tsd": {
     "compilerOptions": {