Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
feat: add test to check that nargo has been built from a clean commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Feb 15, 2023
1 parent ed7677e commit 8ce38ad
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 5 deletions.
5 changes: 0 additions & 5 deletions test/6_array.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ test("promise resolved", async () => {
promiseResolved = true;
});

test("prints version", async () => {
const processOutput = (await $`${nargoBin} --version`).toString();
assert.match(processOutput, /nargo\s\d{1,2}.\d{1,2}/);
});

test("nargo builds noir/test/test_data/6_array sucessfully", async () => {
await within(async () => {
cd("./noir/crates/nargo/tests/test_data/6_array");
Expand Down
45 changes: 45 additions & 0 deletions test/version.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { suite } from "uvu";
import * as assert from "uvu/assert";
import { cd } from "zx";
import "zx/globals";

const test = suite("nargo");

const nargoBinPath = path.join(process.cwd(), "noir/dist/");
const nargoBin = path.join(nargoBinPath, "nargo");

if (process.platform == "win32") {
$.shell = "powershell";
}

$.quote = (arg) => {
return arg;
};

$.verbose = true;

// Helps detect unresolved ProcessPromise.
let promiseResolved = false;
process.on("exit", () => {
if (!promiseResolved) {
console.error("Error: ProcessPromise never resolved.");
process.exitCode = 1;
}
});

test("promise resolved", async () => {
await $`echo PromiseHelper`;
promiseResolved = true;
});

test("prints version", async () => {
const processOutput = (await $`${nargoBin} --version`).toString();
assert.match(processOutput, /nargo\s\d{1,2}.\d{1,2}/);
});

test("reports a clean commit", async () => {
const processOutput = (await $`${nargoBin} --version`).toString();
assert.not.match(processOutput, /modified/)
});

test.run();

0 comments on commit 8ce38ad

Please sign in to comment.