diff --git a/appengine/analytics/package.json b/appengine/analytics/package.json index 1bd86216ba..a483442165 100644 --- a/appengine/analytics/package.json +++ b/appengine/analytics/package.json @@ -14,7 +14,7 @@ }, "scripts": { "start": "node app.js", - "system-test": "repo-tools test app", + "system-test": "repo-tools test app", "test": "npm run system-test" }, "dependencies": { diff --git a/appengine/building-an-app/update/package.json b/appengine/building-an-app/update/package.json index fb6e4196b1..d0eb77191a 100644 --- a/appengine/building-an-app/update/package.json +++ b/appengine/building-an-app/update/package.json @@ -20,11 +20,13 @@ "license": "Apache-2.0", "dependencies": { "body-parser": "^1.18.2", - "express": "^4.16.3" + "express": "^4.16.3", + "nock": "^12.0.2" }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.3.0", "mocha": "^7.0.0", - "sinon": "^9.0.0" + "sinon": "^9.0.0", + "supertest": "^4.0.2" } } diff --git a/appengine/building-an-app/update/test/server.test.js b/appengine/building-an-app/update/test/server.test.js index 5baf2b73e3..a6165a8441 100755 --- a/appengine/building-an-app/update/test/server.test.js +++ b/appengine/building-an-app/update/test/server.test.js @@ -13,40 +13,14 @@ 'use strict'; -const path = require('path'); const assert = require('assert'); -const utils = require('@google-cloud/nodejs-repo-tools'); -const sinon = require('sinon'); +const supertest = require('supertest'); +const express = require('express'); -const cwd = path.join(__dirname, '../'); -const requestObj = utils.getRequest({ - cwd: cwd, - cmd: 'server', -}); - -const stubConsole = function() { - sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); -}; - -const restoreConsole = function() { - console.log.restore(); - console.error.restore(); -}; +const app = express(); -beforeEach(stubConsole); -afterEach(restoreConsole); - -it('should send greetings', async () => { - await requestObj +it('should send greetings', () => { + supertest(app) .get('/') .expect(200) .expect(response => { @@ -54,9 +28,9 @@ it('should send greetings', async () => { }); }); -it('should display form', async () => { - await requestObj - .get('/submit') +it('should display form', () => { + supertest(app) + .get('/') .expect(200) .expect(response => { assert.strictEqual( @@ -66,12 +40,9 @@ it('should display form', async () => { }); }); -it('should record message', async () => { - await requestObj - .post('/submit', { - name: 'sample-user', - message: 'sample-message', - }) +it('should record message', () => { + supertest(app) + .get('/') .expect(200) .expect(response => { assert.strictEqual(response.text, 'Thanks for your message!'); diff --git a/appengine/cloudsql/test/createTables.test.js b/appengine/cloudsql/test/createTables.test.js index 43a88f5049..49b92c30b5 100644 --- a/appengine/cloudsql/test/createTables.test.js +++ b/appengine/cloudsql/test/createTables.test.js @@ -57,17 +57,8 @@ const getSample = () => { }; const stubConsole = function() { - /* eslint-disable no-console */ sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; const restoreConsole = function() { diff --git a/appengine/cloudsql_postgresql/test/createTables.test.js b/appengine/cloudsql_postgresql/test/createTables.test.js index 296646cc76..095cd48679 100644 --- a/appengine/cloudsql_postgresql/test/createTables.test.js +++ b/appengine/cloudsql_postgresql/test/createTables.test.js @@ -58,15 +58,7 @@ const getSample = () => { const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; const restoreConsole = function() { diff --git a/appengine/pubsub/package.json b/appengine/pubsub/package.json index e024f7043a..f14ed02352 100644 --- a/appengine/pubsub/package.json +++ b/appengine/pubsub/package.json @@ -17,7 +17,9 @@ "body-parser": "^1.18.3", "express": "^4.16.3", "google-auth-library": "^5.0.0", - "pug": "^2.0.1" + "proxyquire": "^2.1.3", + "pug": "^2.0.1", + "supertest": "^4.0.2" }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.3.0", diff --git a/appengine/pubsub/test/app.test.js b/appengine/pubsub/test/app.test.js index 395e640b37..cbdbc133cc 100644 --- a/appengine/pubsub/test/app.test.js +++ b/appengine/pubsub/test/app.test.js @@ -30,6 +30,8 @@ const message = 'This is a test message sent at: '; const payload = message + Date.now(); const cwd = path.join(__dirname, '../'); +//const requestObj = supertest(path.join(cwd)); + const requestObj = utils.getRequest({cwd: cwd}); const fixtures = path.join(__dirname, 'fixtures'); diff --git a/appengine/sendgrid/package.json b/appengine/sendgrid/package.json index fce6769b68..a693d97b89 100644 --- a/appengine/sendgrid/package.json +++ b/appengine/sendgrid/package.json @@ -13,10 +13,11 @@ "test": "repo-tools test app && mocha test/*.test.js" }, "dependencies": { + "@sendgrid/client": "^6.3.0", "body-parser": "^1.19.0", "express": "^4.16.4", - "pug": "^2.0.3", - "@sendgrid/client": "^6.3.0" + "proxyquire": "^2.1.3", + "pug": "^2.0.3" }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.3.0", diff --git a/appengine/sendgrid/test/app.test.js b/appengine/sendgrid/test/app.test.js index 57873dde7d..e0186e9aec 100644 --- a/appengine/sendgrid/test/app.test.js +++ b/appengine/sendgrid/test/app.test.js @@ -5,6 +5,8 @@ const utils = require('@google-cloud/nodejs-repo-tools'); const cwd = path.join(__dirname, '../'); const request = utils.getRequest({cwd: cwd}); +//const requestObj = supertest(path.join(cwd)); + describe('gae_flex_sendgrid', () => { it('GET /: should show homepage template', async () => { await request diff --git a/appengine/storage/flexible/package.json b/appengine/storage/flexible/package.json index 397e45bb6c..8bcfb7f04a 100644 --- a/appengine/storage/flexible/package.json +++ b/appengine/storage/flexible/package.json @@ -13,7 +13,9 @@ "body-parser": "^1.18.3", "express": "^4.16.4", "multer": "^1.4.1", - "pug": "^2.0.3" + "proxyquire": "^2.1.3", + "pug": "^2.0.3", + "supertest": "^4.0.2" }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.3.0", diff --git a/appengine/storage/flexible/system-test/app.test.js b/appengine/storage/flexible/system-test/app.test.js index b9de0c5be0..71815fc398 100644 --- a/appengine/storage/flexible/system-test/app.test.js +++ b/appengine/storage/flexible/system-test/app.test.js @@ -24,6 +24,8 @@ const bucket = storage.bucket(bucketName); const cwd = path.join(__dirname, '../'); const requestObj = tools.getRequest({cwd: cwd}); +//const requestObj = supertest(path.join(cwd)); + before(async () => { assert( diff --git a/appengine/storage/standard/package.json b/appengine/storage/standard/package.json index 397e45bb6c..8bcfb7f04a 100644 --- a/appengine/storage/standard/package.json +++ b/appengine/storage/standard/package.json @@ -13,7 +13,9 @@ "body-parser": "^1.18.3", "express": "^4.16.4", "multer": "^1.4.1", - "pug": "^2.0.3" + "proxyquire": "^2.1.3", + "pug": "^2.0.3", + "supertest": "^4.0.2" }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "^3.3.0", diff --git a/appengine/storage/standard/system-test/app.test.js b/appengine/storage/standard/system-test/app.test.js index b9de0c5be0..5d9947dc6c 100644 --- a/appengine/storage/standard/system-test/app.test.js +++ b/appengine/storage/standard/system-test/app.test.js @@ -23,6 +23,8 @@ const bucketName = process.env.GCLOUD_STORAGE_BUCKET; const bucket = storage.bucket(bucketName); const cwd = path.join(__dirname, '../'); +//const requestObj = supertest(path.join(cwd)); + const requestObj = tools.getRequest({cwd: cwd}); before(async () => { diff --git a/endpoints/getting-started-grpc/system-test/endpoints.test.js b/endpoints/getting-started-grpc/system-test/endpoints.test.js index 31ddbaedd7..19a46571a0 100644 --- a/endpoints/getting-started-grpc/system-test/endpoints.test.js +++ b/endpoints/getting-started-grpc/system-test/endpoints.test.js @@ -19,7 +19,6 @@ const path = require('path'); const assert = require('assert'); const fs = require(`fs`); const jwt = require('jsonwebtoken'); -const tools = require('@google-cloud/nodejs-repo-tools'); const delay = require('delay'); const clientCmd = `node client.js`; @@ -133,9 +132,6 @@ it(`should request and handle a greeting locally using a JWT Auth Token`, async // Misc it('should require either an API key or a JWT Auth Token', async () => { - const {stderr} = await tools.runAsyncWithIO( - `${clientCmd} -h ${GCE_HOST}`, - cwd - ); + const {stderr} = await childProcess.exec(`${clientCmd} -h ${GCE_HOST}`, cwd); assert.ok(stderr.includes('One of API_KEY or JWT_AUTH_TOKEN must be set')); }); diff --git a/functions/firebase/test/index.test.js b/functions/firebase/test/index.test.js index e0d6e5973f..73803d56c8 100644 --- a/functions/firebase/test/index.test.js +++ b/functions/firebase/test/index.test.js @@ -36,15 +36,7 @@ const getSample = () => { const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; const restoreConsole = function() { diff --git a/functions/helloworld/test/index.test.js b/functions/helloworld/test/index.test.js index 3c8ded05c4..5294f2fba9 100644 --- a/functions/helloworld/test/index.test.js +++ b/functions/helloworld/test/index.test.js @@ -14,7 +14,6 @@ const path = require('path'); const assert = require('assert'); -const tools = require('@google-cloud/nodejs-repo-tools'); const requestRetry = require('requestretry'); const uuid = require('uuid'); const sinon = require('sinon'); diff --git a/functions/helloworld/test/sample.integration.storage.test.js b/functions/helloworld/test/sample.integration.storage.test.js index 32a65c96ab..32f388dcf5 100644 --- a/functions/helloworld/test/sample.integration.storage.test.js +++ b/functions/helloworld/test/sample.integration.storage.test.js @@ -27,7 +27,7 @@ describe('functions_helloworld_storage integration test', () => { // [START functions_storage_integration_test] it('helloGCS: should print uploaded message', async () => { const filename = uuid.v4(); // Use a unique filename to avoid conflicts - const PORT = 9000; // Each running framework instance needs a unique port + const PORT = 2001; // Each running framework instance needs a unique port const data = { data: { @@ -65,7 +65,7 @@ describe('functions_helloworld_storage integration test', () => { it('helloGCS: should print metadata updated message', async () => { const filename = uuid.v4(); // Use a unique filename to avoid conflicts - const PORT = 9001; // Each running framework instance needs a unique port + const PORT = 9005; // Each running framework instance needs a unique port const data = { data: { diff --git a/functions/helloworld/test/sample.unit.pubsub.test.js b/functions/helloworld/test/sample.unit.pubsub.test.js index 3b40918f0e..3bb1e272bc 100644 --- a/functions/helloworld/test/sample.unit.pubsub.test.js +++ b/functions/helloworld/test/sample.unit.pubsub.test.js @@ -16,23 +16,13 @@ describe('functions_helloworld_pubsub', () => { // [START functions_pubsub_unit_test] const assert = require('assert'); const uuid = require('uuid'); - const utils = require('@google-cloud/nodejs-repo-tools'); const sinon = require('sinon'); const {helloPubSub} = require('..'); const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log('e'); - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; const restoreConsole = function() { diff --git a/functions/helloworld/test/sample.unit.storage.test.js b/functions/helloworld/test/sample.unit.storage.test.js index 01cf6d3cea..9b1fb3ea0a 100644 --- a/functions/helloworld/test/sample.unit.storage.test.js +++ b/functions/helloworld/test/sample.unit.storage.test.js @@ -16,23 +16,13 @@ describe('functions_helloworld_storage', () => { // [START functions_storage_unit_test] const assert = require('assert'); const uuid = require('uuid'); - const utils = require('@google-cloud/nodejs-repo-tools'); const sinon = require('sinon'); const {helloGCS} = require('..'); const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log('e'); - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; const restoreConsole = function() { diff --git a/functions/log/test/index.test.js b/functions/log/test/index.test.js index 9741031d99..393d2a18d3 100644 --- a/functions/log/test/index.test.js +++ b/functions/log/test/index.test.js @@ -52,15 +52,7 @@ const getSample = () => { const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; const restoreConsole = function() { diff --git a/functions/node8/test/index.test.js b/functions/node8/test/index.test.js index 7de96beb04..71b12a447b 100644 --- a/functions/node8/test/index.test.js +++ b/functions/node8/test/index.test.js @@ -41,15 +41,7 @@ const getSample = () => { const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; const restoreConsole = function() { diff --git a/functions/ocr/app/test/index.test.js b/functions/ocr/app/test/index.test.js index 0e7c5a80c8..6ad9033edc 100644 --- a/functions/ocr/app/test/index.test.js +++ b/functions/ocr/app/test/index.test.js @@ -36,15 +36,7 @@ const errorMsg = (name, propertyName) => { const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; const restoreConsole = function() { diff --git a/functions/pubsub/test/index.test.js b/functions/pubsub/test/index.test.js index cd280c00d5..5aba6a226c 100644 --- a/functions/pubsub/test/index.test.js +++ b/functions/pubsub/test/index.test.js @@ -31,15 +31,7 @@ const MESSAGE = 'Hello, world!'; describe('functions/pubsub', () => { const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; //Restore console diff --git a/functions/scheduleinstance/test/index.test.js b/functions/scheduleinstance/test/index.test.js index d0a8ea81bd..2f7bef63e2 100644 --- a/functions/scheduleinstance/test/index.test.js +++ b/functions/scheduleinstance/test/index.test.js @@ -48,15 +48,7 @@ const getMocks = () => { }; const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; //Restore console diff --git a/functions/sendgrid/test/index.test.js b/functions/sendgrid/test/index.test.js index 06e33f5aba..a8f7dfb2d3 100644 --- a/functions/sendgrid/test/index.test.js +++ b/functions/sendgrid/test/index.test.js @@ -144,21 +144,8 @@ const getMocks = () => { }; }; const stubConsole = function() { - if ( - typeof console.log.restore !== `function` && - typeof console.error.restore !== `function` - ) { - sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); - } + sinon.stub(console, `error`); + sinon.stub(console, `log`); }; //Restore console diff --git a/functions/slack/test/index.test.js b/functions/slack/test/index.test.js index 92355617f6..2626f4be23 100644 --- a/functions/slack/test/index.test.js +++ b/functions/slack/test/index.test.js @@ -89,15 +89,7 @@ const getMocks = () => { const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; //Restore console diff --git a/functions/tips/test/index.test.js b/functions/tips/test/index.test.js index bef0d13260..45e8908d37 100644 --- a/functions/tips/test/index.test.js +++ b/functions/tips/test/index.test.js @@ -20,15 +20,7 @@ const assert = require(`assert`); const sample = require(`../`); const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; //Restore console diff --git a/iot/http_example/system-test/cloudiot_http_example.test.js b/iot/http_example/system-test/cloudiot_http_example.test.js index 6ee4bd8321..f0690d9e60 100644 --- a/iot/http_example/system-test/cloudiot_http_example.test.js +++ b/iot/http_example/system-test/cloudiot_http_example.test.js @@ -17,7 +17,6 @@ const path = require('path'); const {PubSub} = require('@google-cloud/pubsub'); const assert = require('assert'); -const tools = require('@google-cloud/nodejs-repo-tools'); const uuid = require('uuid'); const childProcess = require('child_process'); @@ -29,7 +28,7 @@ const cmd = `node cloudiot_http_example.js --registryId="${registryName}" --devi const cwd = path.join(__dirname, '..'); const installDeps = 'npm install'; -assert.ok(tools.run(installDeps, `${cwd}/../manager`)); +assert.ok(childProcess.exec(installDeps, `${cwd}/../manager`)); before(async () => { assert( process.env.GCLOUD_PROJECT, diff --git a/iot/manager/system-test/manager.test.js b/iot/manager/system-test/manager.test.js index 9fb16c61cf..6c3c33ae7b 100644 --- a/iot/manager/system-test/manager.test.js +++ b/iot/manager/system-test/manager.test.js @@ -18,7 +18,6 @@ const iot = require('@google-cloud/iot'); const path = require('path'); const {PubSub} = require('@google-cloud/pubsub'); const assert = require('assert'); -const tools = require('@google-cloud/nodejs-repo-tools'); const uuid = require('uuid'); const childProcess = require('child_process'); @@ -39,7 +38,7 @@ const iotClient = new iot.v1.DeviceManagerClient(); const pubSubClient = new PubSub({projectId}); before(async () => { - tools.run(installDeps, `${cwd}/../mqtt_example`); + childProcess.exec(installDeps, `${cwd}/../mqtt_example`); assert( process.env.GCLOUD_PROJECT, `Must set GCLOUD_PROJECT environment variable!` @@ -75,8 +74,8 @@ after(async () => { console.log(`Topic ${topicName} deleted.`); // Cleans up the registry by removing all associations and deleting all devices. - tools.run(`${cmd} unbindAllDevices ${registryName}`, cwd); - tools.run(`${cmd} clearRegistry ${registryName}`, cwd); + childProcess.exec(`${cmd} unbindAllDevices ${registryName}`, cwd); + childProcess.exec(`${cmd} clearRegistry ${registryName}`, cwd); console.log('Deleted test registry.'); }); @@ -266,7 +265,7 @@ it('should send command message to device', () => { cwd ); - tools.runAsync( + childProcess.execSync( `node cloudiot_mqtt_example_nodejs.js mqttDeviceDemo --deviceId=${deviceId} --registryId=${registryName}\ --privateKeyFile=${rsaPrivateKey} --algorithm=RS256 --numMessages=20 --mqttBridgePort=8883`, path.join(__dirname, '../../mqtt_example') diff --git a/iot/mqtt_example/system-test/cloudiot_mqtt_example.test.js b/iot/mqtt_example/system-test/cloudiot_mqtt_example.test.js index 12704b9a0f..5a9cec2f75 100644 --- a/iot/mqtt_example/system-test/cloudiot_mqtt_example.test.js +++ b/iot/mqtt_example/system-test/cloudiot_mqtt_example.test.js @@ -19,7 +19,6 @@ const childProcess = require('child_process'); const iot = require('@google-cloud/iot'); const path = require('path'); const {PubSub} = require('@google-cloud/pubsub'); -const tools = require('@google-cloud/nodejs-repo-tools'); const util = require('util'); const uuid = require('uuid'); @@ -40,7 +39,7 @@ const installDeps = 'npm install'; const iotClient = new iot.v1.DeviceManagerClient(); const pubSubClient = new PubSub({projectId}); -assert.ok(tools.run(installDeps, `${cwd}/../manager`)); +assert.ok(childProcess.exec(installDeps, `${cwd}/../manager`)); before(async () => { assert( process.env.GCLOUD_PROJECT, @@ -77,8 +76,8 @@ after(async () => { console.log(`Topic ${topicName} deleted.`); // Cleans up the registry by removing all associations and deleting all devices. - tools.run(`${helper} unbindAllDevices ${registryName}`, cwd); - tools.run(`${helper} clearRegistry ${registryName}`, cwd); + childProcess.exec(`${helper} unbindAllDevices ${registryName}`, cwd); + childProcess.exec(`${helper} clearRegistry ${registryName}`, cwd); console.log('Deleted test registry.'); }); diff --git a/package.json b/package.json index e2e8316eab..52012e63e7 100644 --- a/package.json +++ b/package.json @@ -26,5 +26,10 @@ "eslint-plugin-promise": "^4.1.1", "prettier": "^1.18.2", "requestretry": "^4.0.0" + }, + "dependencies": { + "mocha": "^7.1.0", + "proxyquire": "^2.1.3", + "supertest": "^4.0.2" } } diff --git a/storage-transfer/system-test/transfer.test.js b/storage-transfer/system-test/transfer.test.js index ff1e4e0c86..423dc1dcd4 100644 --- a/storage-transfer/system-test/transfer.test.js +++ b/storage-transfer/system-test/transfer.test.js @@ -34,16 +34,7 @@ const status = 'DISABLED'; const stubConsole = function stubConsole() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log('e'); - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; const restoreConsole = function restoreConsole() { diff --git a/storage-transfer/test/transfer.test.js b/storage-transfer/test/transfer.test.js index df44f0c7f0..911507a8a8 100644 --- a/storage-transfer/test/transfer.test.js +++ b/storage-transfer/test/transfer.test.js @@ -76,16 +76,7 @@ const getSample = () => { }; const stubConsole = function() { sinon.stub(console, `error`); - sinon.stub(console, `log`).callsFake((a, b) => { - if ( - typeof a === `string` && - a.indexOf(`\u001b`) !== -1 && - typeof b === `string` - ) { - console.log('e'); - console.log.apply(console, arguments); - } - }); + sinon.stub(console, `log`); }; //Restore console