* Update README.md

* test setup

* Update build.yml
This commit is contained in:
James Ives 2019-11-20 09:13:01 -05:00 committed by GitHub
parent 69928fe0f1
commit 08316f5f4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 4 deletions

View File

@ -1,5 +1,5 @@
name: unit-tests
on: [push, pull_request]
on: [pull_request, push]
jobs:
unit-test:
runs-on: ubuntu-latest

1
__tests__/env.js Normal file
View File

@ -0,0 +1 @@
process.env.UNIT_TEST = true

View File

@ -7,5 +7,6 @@ module.exports = {
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
verbose: true,
setupFiles: ["<rootDir>/__tests__/env.js"]
}

View File

@ -6,6 +6,7 @@ const { pusher, repository } = github.context.payload;
export const workspace: any = process.env.GITHUB_WORKSPACE;
export const folder = core.getInput("FOLDER", { required: true });
export const root = ".";
export const isTest = process.env.UNIT_TEST;
// Required action data.
export const action = {

View File

@ -1,7 +1,7 @@
import * as core from "@actions/core";
import { cp } from "@actions/io";
import { execute } from "./util";
import { workspace, action, root, repositoryPath } from "./constants";
import { workspace, action, root, repositoryPath, isTest } from "./constants";
/** Generates the branch if it doesn't exist on the remote.
* @returns {Promise}
@ -104,7 +104,7 @@ export async function deploy(): Promise<any> {
temporaryDeploymentDirectory
);
if (!hasFilesToCommit && workspace) {
if (!hasFilesToCommit && !isTest) {
console.log("There is nothing to commit. Exiting...");
return Promise.resolve();
}