fix: set safe directory (#1304)

* fix: set safe directory

* fix: naming

* fix: update tests

* fix: dont even check

* fix: add set safe directory

* fix: write test for setSafeDirectory
This commit is contained in:
Tom Hu
2024-02-26 11:31:39 -08:00
committed by GitHub
parent 0cfda1dd0a
commit 2fc4847d3f
9 changed files with 162 additions and 20 deletions

View File

@@ -38,7 +38,10 @@ test('general args', () => {
test('upload args using context', () => {
const expectedArgs = [];
const expectedArgs = [
'--git-service',
'github',
];
const {uploadExecArgs, uploadCommand} = buildUploadExec();
if (context.eventName == 'pull_request') {
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
@@ -65,6 +68,7 @@ test('upload args', () => {
'file': 'coverage.xml',
'files': 'dir1/coverage.xml,dir2/coverage.xml',
'flags': 'test,test2',
'git_service': 'github_enterprise',
'handle_no_reports_found': 'true',
'job_code': '32',
'name': 'codecov',
@@ -110,6 +114,8 @@ test('upload args', () => {
'test',
'-F',
'test2',
'--git-service',
'github_enterprise',
'--handle-no-reports-found',
'--job-code',
'32',
@@ -152,6 +158,7 @@ test('upload args', () => {
test('report args', () => {
const envs = {
git_service: 'github_enterprise',
override_commit: '9caabca5474b49de74ef5667deabaf74cdacc244',
override_pr: 'fakePR',
slug: 'fakeOwner/fakeRepo',
@@ -165,6 +172,8 @@ test('report args', () => {
const {reportExecArgs, reportCommand} = buildReportExec();
const expectedArgs = [
'--git-service',
'github_enterprise',
'-C',
'9caabca5474b49de74ef5667deabaf74cdacc244',
'-P',
@@ -189,7 +198,10 @@ test('report args using context', () => {
for (const env of Object.keys(envs)) {
process.env['INPUT_' + env.toUpperCase()] = envs[env];
}
const expectedArgs : string[] = [];
const expectedArgs : string[] = [
'--git-service',
'github',
];
if (context.eventName == 'pull_request') {
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
}
@@ -206,6 +218,7 @@ test('report args using context', () => {
test('commit args', () => {
const envs = {
git_service: 'github_enterprise',
commit_parent: '83231650328f11695dfb754ca0f540516f188d27',
override_branch: 'thomasrockhu/test',
override_commit: '9caabca5474b49de74ef5667deabaf74cdacc244',
@@ -222,6 +235,8 @@ test('commit args', () => {
const expectedArgs = [
'--parent-sha',
'83231650328f11695dfb754ca0f540516f188d27',
'--git-service',
'github_enterprise',
'-B',
'thomasrockhu/test',
'-C',
@@ -241,7 +256,10 @@ test('commit args', () => {
});
test('commit args using context', () => {
const expectedArgs :string[] = [];
const expectedArgs :string[] = [
'--git-service',
'github',
];
const {commitExecArgs, commitCommand} = buildCommitExec();
if (context.eventName == 'pull_request') {