mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
.
This commit is contained in:
parent
4da860cd59
commit
5473a04c5a
13 changed files with 22679 additions and 8953 deletions
|
|
@ -2,6 +2,8 @@ import * as fs from 'fs'
|
|||
import glob from 'fast-glob'
|
||||
import {FileContent, InputProvider, ReportInput} from './input-provider.js'
|
||||
import {listFiles} from '../utils/git.js'
|
||||
import Zip from 'adm-zip'
|
||||
import path from 'path'
|
||||
|
||||
export class LocalFileProvider implements InputProvider {
|
||||
constructor(
|
||||
|
|
@ -11,16 +13,19 @@ export class LocalFileProvider implements InputProvider {
|
|||
|
||||
async load(): Promise<ReportInput> {
|
||||
const result: FileContent[] = []
|
||||
const zip = new Zip()
|
||||
for (const pat of this.pattern) {
|
||||
const paths = await glob(pat, {dot: true})
|
||||
for (const file of paths) {
|
||||
const dir = path.dirname(file)
|
||||
zip.addLocalFile(file, dir)
|
||||
const content = await fs.promises.readFile(file, {encoding: 'utf8'})
|
||||
result.push({file, content})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
artifactFilePaths: [],
|
||||
trxZip: zip,
|
||||
reports: {
|
||||
[this.name]: result
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue