Skip to content

Commit

Permalink
ci: test with node 22
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Aug 26, 2024
1 parent 400dd2e commit 8e15a9d
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [16.x, 18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion demo/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": [
"should"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion demo/cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"should",
"coffeescript/register"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion demo/esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"require": [
"should"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion demo/issues-cjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"should",
"coffeescript/register"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion demo/issues-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"require": [
"should"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion demo/ts-esm-node16/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"require": [
"should"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/csv-generate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"require": [
"should"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/csv-parse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"require": [
"should"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/csv-stringify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"require": [
"should"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"repository": {
Expand Down
46 changes: 23 additions & 23 deletions packages/csv-stringify/samples/api.async.iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ import assert from 'node:assert';
import { generate } from "csv-generate";
import { stringify } from "csv-stringify";

(async () => {
// Initialise the parser by generating random records
const stringifier = generate({
length: 1000,
objectMode: true,
seed: true,
}).pipe(stringify());
// Count records
let count = 0;
// Report start
process.stdout.write("start...\n");
// Iterate through each records
for await (const row of stringifier) {
// Report current line
process.stdout.write(`${count++} ${row}\n`);
// Fake asynchronous operation
await new Promise((resolve) => setTimeout(resolve, 100));
}
// Report end
process.stdout.write("...done\n");
// Validation
assert.strictEqual(count, 6);
})();
// Initialise the parser by generating random records
const stringifier = generate({
length: 1000,
objectMode: true,
seed: true,
}).pipe(stringify({
readableHighWaterMark: 15000
}));
// Count records
let count = 0;
// Report start
process.stdout.write("start...\n");
// Iterate through each records
for await (const row of stringifier) {
// Report current line
process.stdout.write(`${count++} ${row}\n`);
// Fake asynchronous operation
await new Promise((resolve) => setTimeout(resolve, 100));
}
// Report end
process.stdout.write("...done\n");
// Validation
assert.strictEqual(count, 6);
2 changes: 1 addition & 1 deletion packages/csv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"require": [
"should"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/stream-transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"require": [
"should"
],
"throw-deprecation": true,
"throw-deprecation": false,
"timeout": 40000
},
"repository": {
Expand Down
12 changes: 6 additions & 6 deletions packages/stream-transform/test/handler.mode.callback.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe 'handler.mode.callback', ->

it 'handler with callback with parallel 1', ->
chunks = []
r = new Writable
consumer = new Writable
write: (chunk, _, callback) ->
chunks.push chunk.toString()
callback()
Expand All @@ -19,28 +19,28 @@ describe 'handler.mode.callback', ->
setImmediate ->
callback null, chunk
,
r
consumer
)
chunks.join('').split('\n').length.should.eql 1000

it 'handler with callback with parallel 2', ->
it.only 'handler with callback with parallel 2', ->
count = 0
clear = setInterval ->
count++
, 10
chunks = []
r = new Writable
consumer = new Writable
write: (chunk, _, callback) ->
chunks.push chunk.toString()
callback()
await pipeline(
generate columns: 10, objectMode: true, length: 1000
generate columns: 10, objectMode: true, length: 1000, seed: true
,
transform parallel: 2, (chunk, callback) ->
setImmediate ->
callback null, JSON.stringify(chunk)+'\n'
,
r
consumer
)
clearInterval(clear)
count.should.be.above 1
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ describe 'handler.mode.callback.error', ->

it 'with parallel 1', ->
count = 0
r = new Writable
consumer = new Writable
write: (_, __, callback) ->
callback()
try
await pipeline(
generate length: 1000
generate length: 1000, highWaterMark: 1
,
transform parallel: 1, (chunk, callback) ->
transform parallel: 1, highWaterMark: 1, (chunk, callback) ->
setImmediate ->
if ++count < 4
callback null, chunk
else
callback new Error 'Catchme'
,
r
consumer
)
throw Error 'Oh no!'
catch err
Expand All @@ -32,7 +32,7 @@ describe 'handler.mode.callback.error', ->

it 'handler with callback with parallel 10', ->
count = 0
r = new Writable
consumer = new Writable
objectMode: true,
write: (_, __, callback) ->
callback()
Expand All @@ -48,7 +48,7 @@ describe 'handler.mode.callback.error', ->
callback new Error 'Catchme'
, 10
,
r
consumer
)
throw Error 'Oh no!'
catch err
Expand Down

0 comments on commit 8e15a9d

Please sign in to comment.