From 21a1e2948d977d4477e71e5e0f60f5e99ee85d77 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Mon, 8 Mar 2021 19:25:23 -0500 Subject: [PATCH] Actually update tests --- src/buildExec.test.ts | 11 +++++++++-- src/buildExec.ts | 2 -- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/buildExec.test.ts b/src/buildExec.test.ts index 41cfeca8b..a51f4951d 100644 --- a/src/buildExec.test.ts +++ b/src/buildExec.test.ts @@ -1,8 +1,11 @@ import buildExec from './buildExec'; +const github = require('@actions/github'); +const context = github.context; test('no arguments', () => { const {execArgs, filepath, failCi} = buildExec(); - expect(execArgs.slice(0, -2)).toEqual([ + + args = [ 'codecov.sh', '-n', '', @@ -10,7 +13,11 @@ test('no arguments', () => { '', '-Q', 'github-action', - ]); + ]; + if (context.eventName == 'pull_request') { + args.push('-C', `${context.payload.pull_request.head.sha}`); + } + expect(execArgs).toEqual(args); expect(filepath).toEqual('codecov.sh'); expect(failCi).toBeFalsy(); }); diff --git a/src/buildExec.ts b/src/buildExec.ts index 95ff21685..555f80c7d 100644 --- a/src/buildExec.ts +++ b/src/buildExec.ts @@ -71,8 +71,6 @@ const buildExec = () => { } } - console.log(context); - if (token) { options.env.CODECOV_TOKEN = token; }