diff --git a/.gitignore b/.gitignore
index 47fb503..806cace 100644
--- a/.gitignore
+++ b/.gitignore
@@ -97,6 +97,9 @@ Thumbs.db
# Ignore built ts files
__tests__/runner/*
+# Ignore test outputs
+__tests__/outputs
+
# IDE files
.idea
.vscode
diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts
index 9eca35b..040d2f2 100644
--- a/__tests__/main.test.ts
+++ b/__tests__/main.test.ts
@@ -8,6 +8,7 @@
import * as core from '@actions/core'
import * as main from '../src/main'
+import { existsSync, unlinkSync } from 'fs'
// Mock the action's main function
const runMock = jest.spyOn(main, 'run')
@@ -38,6 +39,31 @@ describe('action', () => {
)
})
+ describe('with inputs', () => {
+ beforeEach(() => {
+ process.env['INPUT_include'] = './__tests__/fixtures/*.xml'
+ process.env['INPUT_output-path'] = './__tests__/outputs'
+ if (existsSync('./__tests__/outputs/Sample.xml')) {
+ unlinkSync('./__tests__/outputs/Sample.xml')
+ }
+ })
+ it('successfully outputs reduced reports', async () => {
+ await main.run()
+ expect(runMock).toHaveReturned()
+ expect(errorMock).not.toHaveBeenCalled()
+ expect(setFailedMock).not.toHaveBeenCalled()
+ expect(infoMock).toHaveBeenLastCalledWith(
+ 'junit-reducer exited successfully'
+ )
+ // Expect that file exists there
+ expect(existsSync('./__tests__/outputs/Sample.xml')).toBe(true)
+ })
+ afterEach(() => {
+ delete process.env.INPUT_include
+ delete process.env.INPUT_output
+ })
+ })
+
it('successfully completes with a specific version', async () => {
getInputMock.mockImplementation((name: string): string => {
switch (name) {
diff --git a/dist/index.js b/dist/index.js
index c527056..01f448a 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -6696,7 +6696,7 @@ async function run() {
});
core.addPath(pathToCLI);
const inputs = enumerateInputs();
- const args = Object.entries(inputs).map(([key, value]) => `--${key} = ${value}`);
+ const args = Object.entries(inputs).map(([key, value]) => `--${key}=${value}`);
core.startGroup(`Running junit - reducer with arguments: `);
core.info(Object.entries(inputs)
.map(([key, value]) => `${key}: ${value} `)
diff --git a/output/Sample.xml b/output/Sample.xml
index 48b2bb9..8e1ffcb 100644
--- a/output/Sample.xml
+++ b/output/Sample.xml
@@ -1,8 +1,8 @@
-
+
\ No newline at end of file
diff --git a/src/main.ts b/src/main.ts
index ab4fa1c..11de10b 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -107,7 +107,7 @@ export async function run(): Promise {
const inputs = enumerateInputs()
const args: string[] = Object.entries(inputs).map(
- ([key, value]) => `--${key} = ${value}`
+ ([key, value]) => `--${key}=${value}`
)
core.startGroup(`Running junit - reducer with arguments: `)