diff --git a/texttospeech/package.json b/texttospeech/package.json index ee964dfafc..3e22ab1b40 100644 --- a/texttospeech/package.json +++ b/texttospeech/package.json @@ -19,7 +19,6 @@ }, "devDependencies": { "chai": "^4.2.0", - "execa": "^1.0.0", "mocha": "^6.0.0" }, "optionalDependencies": { diff --git a/texttospeech/test/audioProfile.test.js b/texttospeech/test/audioProfile.test.js index e96bf8e061..1219b851b6 100644 --- a/texttospeech/test/audioProfile.test.js +++ b/texttospeech/test/audioProfile.test.js @@ -17,14 +17,9 @@ const fs = require('fs'); const {assert} = require('chai'); -const execa = require('execa'); +const {execSync} = require('child_process'); const cmd = 'node audioProfile.js'; -const exec = async cmd => { - const res = await execa.shell(cmd); - assert.isEmpty(res.stderr); - return res.stdout; -}; const text = 'Hello Everybody! This is an Audio Profile Optimized Sound Byte.'; const outputFile1 = 'phonetest.mp3'; const outputFile2 = 'homeTheatreTest.mp3'; @@ -45,7 +40,7 @@ describe('audio profile', () => { it('should synthesize Speech for Telephone Audio Profile', async () => { assert.strictEqual(fs.existsSync(outputFile1), false); - const output = await exec( + const output = execSync( `${cmd} synthesize '${text}' -f ${outputFile1} -e telephony-class-application` ); assert.match( @@ -57,7 +52,7 @@ describe('audio profile', () => { it('should synthesize Speech for Home Theatre Audio Profile', async () => { assert.strictEqual(fs.existsSync(outputFile2), false); - const output = await exec( + const output = execSync( `${cmd} synthesize '${text}' -f ${outputFile2} -e large-home-entertainment-class-device` ); assert.match( @@ -69,7 +64,7 @@ describe('audio profile', () => { it('should synthesize Speech for Car Audio Audio Profile', async () => { assert.strictEqual(fs.existsSync(outputFile3), false); - const output = await exec( + const output = execSync( `${cmd} synthesize '${text}' -f ${outputFile3} -e large-automotive-class-device` ); assert.match( @@ -81,7 +76,7 @@ describe('audio profile', () => { it('should synthesize Speech for Watch Audio Profile', async () => { assert.strictEqual(fs.existsSync(outputFile4), false); - const output = await exec( + const output = execSync( `${cmd} synthesize '${text}' -f ${outputFile4} -e wearable-class-device` ); assert.match( diff --git a/texttospeech/test/listVoices.test.js b/texttospeech/test/listVoices.test.js index 80b46da6b1..c35bd671eb 100644 --- a/texttospeech/test/listVoices.test.js +++ b/texttospeech/test/listVoices.test.js @@ -16,13 +16,13 @@ 'use strict'; const {assert} = require('chai'); -const execa = require('execa'); +const {execSync} = require('child_process'); const cmd = 'node listVoices.js'; describe('list voices', () => { it('should list voices', async () => { - const {stdout} = await execa.shell(`${cmd} list-voices`); + const stdout = execSync(`${cmd} list-voices`); assert.match(stdout, /SSML Voice Gender: FEMALE/); assert.match(stdout, /Natural Sample Rate Hertz: 24000/); }); diff --git a/texttospeech/test/quickstart.test.js b/texttospeech/test/quickstart.test.js index 09bf7c22ac..946f908c2e 100644 --- a/texttospeech/test/quickstart.test.js +++ b/texttospeech/test/quickstart.test.js @@ -17,7 +17,7 @@ const fs = require('fs'); const {assert} = require('chai'); -const execa = require('execa'); +const {execSync} = require('child_process'); const outputFile = 'output.mp3'; @@ -32,7 +32,7 @@ describe('quickstart', () => { it('should synthesize speech to local mp3 file', async () => { assert.strictEqual(fs.existsSync(outputFile), false); - const {stdout} = await execa.shell('node quickstart'); + const stdout = execSync('node quickstart'); assert.match(stdout, /Audio content written to file: output.mp3/); assert.ok(fs.existsSync(outputFile)); }); diff --git a/texttospeech/test/synthesize.test.js b/texttospeech/test/synthesize.test.js index 34e2c9538f..45b7500918 100644 --- a/texttospeech/test/synthesize.test.js +++ b/texttospeech/test/synthesize.test.js @@ -18,13 +18,8 @@ const fs = require('fs'); const path = require('path'); const {assert} = require('chai'); -const execa = require('execa'); +const {execSync} = require('child_process'); -const exec = async cmd => { - const res = await execa.shell(cmd); - assert.isEmpty(res.stderr); - return res.stdout; -}; const cmd = 'node synthesize.js'; const text = 'Hello there.'; const ssml = 'Hello there.'; @@ -47,9 +42,7 @@ describe('synthesize', () => { it('should synthesize audio from text', async () => { assert.strictEqual(fs.existsSync(outputFile), false); - const output = await exec( - `${cmd} text '${text}' --outputFile ${outputFile}` - ); + const output = execSync(`${cmd} text '${text}' --outputFile ${outputFile}`); assert.match( output, new RegExp(`Audio content written to file: ${outputFile}`) @@ -59,9 +52,7 @@ describe('synthesize', () => { it('should synthesize audio from ssml', async () => { assert.strictEqual(fs.existsSync(outputFile), false); - const output = await exec( - `${cmd} ssml "${ssml}" --outputFile ${outputFile}` - ); + const output = execSync(`${cmd} ssml "${ssml}" --outputFile ${outputFile}`); assert.match( output, new RegExp(`Audio content written to file: ${outputFile}`) @@ -71,7 +62,7 @@ describe('synthesize', () => { it('should synthesize audio from text file', async () => { assert.strictEqual(fs.existsSync(outputFile), false); - const output = await exec( + const output = execSync( `${cmd} text-file ${files[0].localPath} --outputFile ${outputFile}` ); assert.match( @@ -83,7 +74,7 @@ describe('synthesize', () => { it('should synthesize audio from ssml file', async () => { assert.strictEqual(fs.existsSync(outputFile), false); - const output = await exec( + const output = execSync( `${cmd} ssml-file ${files[1].localPath} --outputFile ${outputFile}` ); assert.match(