Skip to content

Commit

Permalink
refactor: wrap execSync with encoding: utf-8 (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwlui authored and JustinBeckwith committed Apr 5, 2019
1 parent 9dcebcb commit bd3241a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion cloud-language/snippets/test/analyze.v1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ const fs = require('fs');
const path = require('path');
const {Storage} = require('@google-cloud/storage');
const {assert} = require('chai');
const {execSync} = require('child_process');
const cp = require('child_process');
const uuid = require('uuid');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

describe('analyze.v1', () => {
const storage = new Storage();
const cmd = 'node analyze.v1.js';
Expand Down
4 changes: 3 additions & 1 deletion cloud-language/snippets/test/analyze.v1beta2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ const fs = require('fs');
const path = require('path');
const {Storage} = require('@google-cloud/storage');
const {assert} = require('chai');
const {execSync} = require('child_process');
const cp = require('child_process');
const uuid = require('uuid');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const storage = new Storage();
const cmd = 'node analyze.v1beta2.js';
const bucketName = `nodejs-docs-samples-test-${uuid.v4()}`;
Expand Down
4 changes: 3 additions & 1 deletion cloud-language/snippets/test/automlNaturalLanguage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
'use strict';

const {assert} = require('chai');
const {execSync} = require('child_process');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

const cmdDataset = 'node automl/automlNaturalLanguageDataset.js';
const cmdModel = 'node automl/automlNaturalLanguageModel.js';
Expand Down
4 changes: 3 additions & 1 deletion cloud-language/snippets/test/quickstart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
'use strict';

const {assert} = require('chai');
const {execSync} = require('child_process');
const cp = require('child_process');

const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});

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

0 comments on commit bd3241a

Please sign in to comment.