Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test that ensure bundled auto still works #1226

Merged
merged 2 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions packages/cli/__tests__/__snapshots__/bundle.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`bundle should function 1`] = `
"
create-labels

Create your project's labels on github. If labels exist it will update them.

Options

-d, --dry-run Report what command will do but do not actually do anything

Global Options

-V, --version Display auto's version
-v, --verbose Show some more logs. Pass -vv for very verbose logs.
--repo string The repo to set the status on. Defaults to looking in
the package definition for the platform
--owner string The owner of the GitHub repo. Defaults to reading from
the package definition for the platform
--github-api string GitHub API to use
--plugins string[] Plugins to load auto with. (defaults to just npm)
-h, --help Display the help output

Examples

$ auto create-labels

"
`;
23 changes: 23 additions & 0 deletions packages/cli/__tests__/bundle.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import path from "path";
import { execSync } from "child_process";

test("bundle should function", () => {
const type =
(process.platform === "win32" && "win.exe") ||
(process.platform === "darwin" && "macos") ||
"linux";
const zip = path.join(__dirname, `../binary/auto-${type}`);
const binary = path.join(__dirname, "../auto");

execSync(`gunzip -c ${zip} > ${binary}`);
execSync(`chmod +x ${binary}`);

expect(
// Using this command because it is unlikely to change very much
execSync(`${binary} create-labels --help`, {
encoding: "utf8",
})
).toMatchSnapshot();

execSync(`rm ${binary}`);
});