diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index a9e88b10..76202405 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -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 }} diff --git a/demo/browser/package.json b/demo/browser/package.json index f2e8419b..8399f794 100644 --- a/demo/browser/package.json +++ b/demo/browser/package.json @@ -13,7 +13,7 @@ "require": [ "should" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "scripts": { diff --git a/demo/cjs/package.json b/demo/cjs/package.json index 1b768687..d0778904 100644 --- a/demo/cjs/package.json +++ b/demo/cjs/package.json @@ -26,7 +26,7 @@ "should", "coffeescript/register" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "scripts": { diff --git a/demo/esm/package.json b/demo/esm/package.json index f5ebf3db..6b2c3734 100644 --- a/demo/esm/package.json +++ b/demo/esm/package.json @@ -22,7 +22,7 @@ "require": [ "should" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "scripts": { diff --git a/demo/issues-cjs/package.json b/demo/issues-cjs/package.json index 6d91a250..a433e03f 100644 --- a/demo/issues-cjs/package.json +++ b/demo/issues-cjs/package.json @@ -21,7 +21,7 @@ "should", "coffeescript/register" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "scripts": { diff --git a/demo/issues-esm/package.json b/demo/issues-esm/package.json index 61438e83..e303c6d3 100644 --- a/demo/issues-esm/package.json +++ b/demo/issues-esm/package.json @@ -19,7 +19,7 @@ "require": [ "should" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "scripts": { diff --git a/demo/ts-esm-node16/package.json b/demo/ts-esm-node16/package.json index 2846168a..d4b1fe1b 100644 --- a/demo/ts-esm-node16/package.json +++ b/demo/ts-esm-node16/package.json @@ -27,7 +27,7 @@ "require": [ "should" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "scripts": { diff --git a/packages/csv-generate/package.json b/packages/csv-generate/package.json index 6610c49d..97ca22a2 100644 --- a/packages/csv-generate/package.json +++ b/packages/csv-generate/package.json @@ -83,7 +83,7 @@ "require": [ "should" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "repository": { diff --git a/packages/csv-parse/package.json b/packages/csv-parse/package.json index 0a2dc5a3..514e895e 100644 --- a/packages/csv-parse/package.json +++ b/packages/csv-parse/package.json @@ -97,7 +97,7 @@ "require": [ "should" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "repository": { diff --git a/packages/csv-stringify/package.json b/packages/csv-stringify/package.json index 5aa29ce2..ccba241a 100644 --- a/packages/csv-stringify/package.json +++ b/packages/csv-stringify/package.json @@ -73,7 +73,7 @@ "require": [ "should" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "repository": { diff --git a/packages/csv-stringify/samples/api.async.iterator.js b/packages/csv-stringify/samples/api.async.iterator.js index 34754096..f6f9339f 100644 --- a/packages/csv-stringify/samples/api.async.iterator.js +++ b/packages/csv-stringify/samples/api.async.iterator.js @@ -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); diff --git a/packages/csv/package.json b/packages/csv/package.json index d6fda11d..a6efd699 100644 --- a/packages/csv/package.json +++ b/packages/csv/package.json @@ -92,7 +92,7 @@ "require": [ "should" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "repository": { diff --git a/packages/stream-transform/package.json b/packages/stream-transform/package.json index 136697d7..15e59249 100644 --- a/packages/stream-transform/package.json +++ b/packages/stream-transform/package.json @@ -74,7 +74,7 @@ "require": [ "should" ], - "throw-deprecation": true, + "throw-deprecation": false, "timeout": 40000 }, "repository": { diff --git a/packages/stream-transform/test/handler.mode.callback.coffee b/packages/stream-transform/test/handler.mode.callback.coffee index 15d27d79..7830295b 100644 --- a/packages/stream-transform/test/handler.mode.callback.coffee +++ b/packages/stream-transform/test/handler.mode.callback.coffee @@ -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() @@ -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 diff --git a/packages/stream-transform/test/handler.mode.callback.error.coffee b/packages/stream-transform/test/handler.mode.callback.error.coffee index d35587bf..152d24f3 100644 --- a/packages/stream-transform/test/handler.mode.callback.error.coffee +++ b/packages/stream-transform/test/handler.mode.callback.error.coffee @@ -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 @@ -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() @@ -48,7 +48,7 @@ describe 'handler.mode.callback.error', -> callback new Error 'Catchme' , 10 , - r + consumer ) throw Error 'Oh no!' catch err