Fixes #136 Globber now also supports new line as separator.

This commit is contained in:
Nick Cipollo
2021-10-25 08:03:03 -04:00
parent 15ede536e2
commit 01e1051edf
3 changed files with 22 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ describe("ArtifactGlobber", () => {
expect(warnMock).not.toBeCalled()
})
it("splits multiple paths", () => {
it("splits multiple paths with comma separator", () => {
const globber = createArtifactGlobber()
const expectedArtifacts =
@@ -69,6 +69,21 @@ describe("ArtifactGlobber", () => {
expect(warnMock).not.toBeCalled()
})
it("splits multiple paths with new line separator and trims start", () => {
const globber = createArtifactGlobber()
const expectedArtifacts =
globResults
.concat(globResults)
.map((path) => new Artifact(path, contentType))
expect(globber.globArtifactString('path1\n path2', 'raw', false))
.toEqual(expectedArtifacts)
expect(globMock).toBeCalledWith('path1')
expect(globMock).toBeCalledWith('path2')
expect(warnMock).not.toBeCalled()
})
it("warns when no glob results are produced and empty results shouldn't throw", () => {
const globber = createArtifactGlobber([])