From 81bdf00982c5c808b4273d1fda7d4bde04130af3 Mon Sep 17 00:00:00 2001 From: eric sciple Date: Wed, 18 Dec 2019 13:24:01 -0500 Subject: [PATCH] fix Buffer deprecation warnings (#265) --- packages/exec/__tests__/exec.test.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/exec/__tests__/exec.test.ts b/packages/exec/__tests__/exec.test.ts index a4fbc234..4cf322f5 100644 --- a/packages/exec/__tests__/exec.test.ts +++ b/packages/exec/__tests__/exec.test.ts @@ -53,7 +53,7 @@ describe('@actions/exec', () => { expect(outstream.write).toBeCalledWith( `[command]${toolpath} /c echo hello${os.EOL}` ) - expect(outstream.write).toBeCalledWith(new Buffer(`hello${os.EOL}`)) + expect(outstream.write).toBeCalledWith(Buffer.from(`hello${os.EOL}`)) } else { expect(outstream.write).toBeCalledWith( `[command]${toolpath} -l -a${os.EOL}` @@ -83,7 +83,7 @@ describe('@actions/exec', () => { expect(outstream.write).toBeCalledWith( `[command]${toolpath} /c echo hello${os.EOL}` ) - expect(outstream.write).toBeCalledWith(new Buffer(`hello${os.EOL}`)) + expect(outstream.write).toBeCalledWith(Buffer.from(`hello${os.EOL}`)) } else { expect(outstream.write).toBeCalledWith( `[command]${toolpath} -l -a${os.EOL}` @@ -113,7 +113,7 @@ describe('@actions/exec', () => { expect(outstream.write).toBeCalledWith( `[command]${toolpath} /c echo hello${os.EOL}` ) - expect(outstream.write).toBeCalledWith(new Buffer(`hello${os.EOL}`)) + expect(outstream.write).toBeCalledWith(Buffer.from(`hello${os.EOL}`)) } else { expect(outstream.write).toBeCalledWith( `[command]${toolpath} -l -a${os.EOL}` @@ -205,7 +205,7 @@ describe('@actions/exec', () => { expect(exitCode).toBe(0) expect(outstream.write).toBeCalledWith( - new Buffer('this is output to stderr') + Buffer.from('this is output to stderr') ) }) @@ -229,7 +229,7 @@ describe('@actions/exec', () => { expect(failed).toBe(true) expect(errstream.write).toBeCalledWith( - new Buffer('this is output to stderr') + Buffer.from('this is output to stderr') ) }) @@ -264,11 +264,11 @@ describe('@actions/exec', () => { const _testExecOptions = getExecOptions() _testExecOptions.listeners = { stdout: (data: Buffer) => { - expect(data).toEqual(new Buffer('this is output to stdout')) + expect(data).toEqual(Buffer.from('this is output to stdout')) stdoutCalled = true }, stderr: (data: Buffer) => { - expect(data).toEqual(new Buffer('this is output to stderr')) + expect(data).toEqual(Buffer.from('this is output to stderr')) stderrCalled = true } }