Skip to content

Commit

Permalink
Fix artifact files paths
Browse files Browse the repository at this point in the history
  • Loading branch information
matejchalk committed Mar 25, 2024
1 parent fb38e3d commit 7a3399e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
rm,
writeFile
} from 'node:fs/promises'
import { join, resolve } from 'node:path'
import { join } from 'node:path'
import { simpleGit, type SimpleGit } from 'simple-git'
import type { ActionInputs } from '../src/inputs'
import { run } from '../src/main'
Expand Down Expand Up @@ -152,8 +152,11 @@ describe('code-pushup action', () => {
Parameters<ArtifactClient['uploadArtifact']>
>(
'code-pushup-report',
['report.json', 'report.md'],
resolve(join(workDir, '.code-pushup')),
expect.arrayContaining([
expect.stringContaining('report.json'),
expect.stringContaining('report.md')
]),
expect.stringContaining('.code-pushup'),
{ retentionDays: 14 }
)

Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/persist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export function persistedCliFiles({
}): PersistedCliFiles {
const rootDir = path.join(directory, PERSIST_OUTPUT_DIR)
const filename = isDiff ? `${PERSIST_FILENAME}-diff` : PERSIST_FILENAME
const files = PERSIST_FORMAT.map(format => `${filename}.${format}`)
const filePaths = PERSIST_FORMAT.reduce(
(acc, format) => ({
...acc,
[`${format}FilePath`]: path.join(rootDir, `${filename}.${format}`)
}),
{} as Omit<PersistedCliFiles, 'artifactData'>
)
const files = Object.values(filePaths)

return {
...filePaths,
Expand Down

0 comments on commit 7a3399e

Please sign in to comment.