Fixes #32 Globber will now expand tilde and warn if no results are found

This commit is contained in:
Nick Cipollo
2021-03-12 12:39:55 -05:00
parent f7b694c6d5
commit 5b1448e480
6 changed files with 129 additions and 21 deletions

View File

@@ -3,8 +3,8 @@ import * as github from "@actions/github";
import {Inputs} from "../src/Inputs";
import {GithubReleases} from "../src/Releases";
import {GithubArtifactUploader} from "../src/ArtifactUploader";
import {Artifact} from "../src/Artifact";
import * as path from "path";
import {FileArtifactGlobber} from "../src/ArtifactGlobber";
// This test is currently intended to be manually run during development. To run:
// - Make sure you have an environment variable named GITHUB_TOKEN assigned to your token
@@ -27,28 +27,33 @@ describe.skip('Integration Test', () => {
})
function getInputs(): Inputs {
const artifactPath = path.join(__dirname, 'Integration.test.ts')
// new
const MockInputs = jest.fn<Inputs, any>(() => {
return {
allowUpdates: true,
artifacts: [new Artifact(artifactPath)],
createdReleaseBody: "release body",
createdReleaseName: "release name",
artifacts: artifacts(),
createdReleaseBody: "This release was generated by release-action's integration test",
createdReleaseName: "Releases Action Integration Test",
commit: "",
draft: false,
owner: "ncipollo",
prerelease: true,
prerelease: false,
replacesArtifacts: true,
repo: "actions-playground",
tag: "0.0.71",
tag: "release-action-test",
token: getToken(),
updatedReleaseBody: "updated body",
updatedReleaseName: "updated name"
updatedReleaseBody: "This release was generated by release-action's integration test",
updatedReleaseName: "Releases Action Integration Test"
}
})
return new MockInputs();
}
function artifacts() {
const globber = new FileArtifactGlobber()
const artifactPath = path.join(__dirname, 'Integration.test.ts')
const artifactString = `~/Desktop/test.txt,blarg.tx, ${artifactPath}`
return globber.globArtifactString(artifactString, "raw")
}
function getToken(): string {
return process.env.GITHUB_TOKEN ?? ""