Skip to content

Commit 4443896

Browse files
jkwluiNimJay
authored andcommitted
refactor: wrap execSync with encoding: utf-8 (#226)
1 parent 2f0febd commit 4443896

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

cloud-language/snippets/test/analyze.v1.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ const fs = require('fs');
1919
const path = require('path');
2020
const {Storage} = require('@google-cloud/storage');
2121
const {assert} = require('chai');
22-
const {execSync} = require('child_process');
22+
const cp = require('child_process');
2323
const uuid = require('uuid');
2424

25+
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
26+
2527
describe('analyze.v1', () => {
2628
const storage = new Storage();
2729
const cmd = 'node analyze.v1.js';

cloud-language/snippets/test/analyze.v1beta2.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ const fs = require('fs');
1919
const path = require('path');
2020
const {Storage} = require('@google-cloud/storage');
2121
const {assert} = require('chai');
22-
const {execSync} = require('child_process');
22+
const cp = require('child_process');
2323
const uuid = require('uuid');
2424

25+
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
26+
2527
const storage = new Storage();
2628
const cmd = 'node analyze.v1beta2.js';
2729
const bucketName = `nodejs-docs-samples-test-${uuid.v4()}`;

cloud-language/snippets/test/automlNaturalLanguage.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
'use strict';
1717

1818
const {assert} = require('chai');
19-
const {execSync} = require('child_process');
19+
const cp = require('child_process');
20+
21+
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2022

2123
const cmdDataset = 'node automl/automlNaturalLanguageDataset.js';
2224
const cmdModel = 'node automl/automlNaturalLanguageModel.js';

cloud-language/snippets/test/quickstart.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
'use strict';
1717

1818
const {assert} = require('chai');
19-
const {execSync} = require('child_process');
19+
const cp = require('child_process');
20+
21+
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
2022

2123
describe('quickstart', () => {
2224
it('should analyze sentiment in text', async () => {

0 commit comments

Comments
 (0)