From 56e253474cefa14146754fd08b15eb62160b959f Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Sun, 21 Jul 2019 21:29:42 -0700 Subject: [PATCH] fix(deps): drop dependency on through2 (#388) --- packages/google-cloud-dialogflow/package.json | 1 - .../samples/package.json | 4 +--- .../google-cloud-dialogflow/test/gapic-v2.js | 19 +++++++++++-------- .../test/gapic-v2beta1.js | 19 +++++++++++-------- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/packages/google-cloud-dialogflow/package.json b/packages/google-cloud-dialogflow/package.json index a24154d2f1c..3ed7054e59d 100644 --- a/packages/google-cloud-dialogflow/package.json +++ b/packages/google-cloud-dialogflow/package.json @@ -60,7 +60,6 @@ "nyc": "^14.0.0", "power-assert": "^1.4.4", "prettier": "^1.7.4", - "through2": "^3.0.0", "linkinator": "^1.5.0" } } diff --git a/packages/google-cloud-dialogflow/samples/package.json b/packages/google-cloud-dialogflow/samples/package.json index e3606d7a8a2..b106adf3dac 100644 --- a/packages/google-cloud-dialogflow/samples/package.json +++ b/packages/google-cloud-dialogflow/samples/package.json @@ -9,7 +9,7 @@ "resources" ], "engines": { - "node": ">=8.0.0" + "node": ">=10.0.0" }, "scripts": { "test": "mocha system-test --timeout=600000" @@ -17,8 +17,6 @@ "dependencies": { "dialogflow": "^0.10.2", "pb-util": "^0.1.0", - "pump": "^3.0.0", - "through2": "^3.0.0", "uuid": "^3.3.2", "yargs": "^13.0.0" }, diff --git a/packages/google-cloud-dialogflow/test/gapic-v2.js b/packages/google-cloud-dialogflow/test/gapic-v2.js index e93b303a27e..b09af9cc4d3 100644 --- a/packages/google-cloud-dialogflow/test/gapic-v2.js +++ b/packages/google-cloud-dialogflow/test/gapic-v2.js @@ -15,7 +15,7 @@ 'use strict'; const assert = require('assert'); -const through2 = require('through2'); +const {PassThrough} = require('stream'); const dialogflowModule = require('../src'); @@ -2818,13 +2818,16 @@ function mockSimpleGrpcMethod(expectedRequest, response, error) { function mockBidiStreamingGrpcMethod(expectedRequest, response, error) { return () => { - const mockStream = through2.obj((chunk, enc, callback) => { - assert.deepStrictEqual(chunk, expectedRequest); - if (error) { - callback(error); - } else { - callback(null, response); - } + const mockStream = new PassThrough({ + objectMode: true, + transform: (chunk, enc, callback) => { + assert.deepStrictEqual(chunk, expectedRequest); + if (error) { + callback(error); + } else { + callback(null, response); + } + }, }); return mockStream; }; diff --git a/packages/google-cloud-dialogflow/test/gapic-v2beta1.js b/packages/google-cloud-dialogflow/test/gapic-v2beta1.js index 25e9dfcd3e5..511bffb3482 100644 --- a/packages/google-cloud-dialogflow/test/gapic-v2beta1.js +++ b/packages/google-cloud-dialogflow/test/gapic-v2beta1.js @@ -15,7 +15,7 @@ 'use strict'; const assert = require('assert'); -const through2 = require('through2'); +const {PassThrough} = require('stream'); const dialogflowModule = require('../src'); @@ -3697,13 +3697,16 @@ function mockSimpleGrpcMethod(expectedRequest, response, error) { function mockBidiStreamingGrpcMethod(expectedRequest, response, error) { return () => { - const mockStream = through2.obj((chunk, enc, callback) => { - assert.deepStrictEqual(chunk, expectedRequest); - if (error) { - callback(error); - } else { - callback(null, response); - } + const mockStream = new PassThrough({ + objectMode: true, + transform: (chunk, enc, callback) => { + assert.deepStrictEqual(chunk, expectedRequest); + if (error) { + callback(error); + } else { + callback(null, response); + } + }, }); return mockStream; };