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

feat: add test to check that nargo has been built from a clean commit #8

Merged
merged 2 commits into from
Feb 21, 2023
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
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, /is dirty: true/)
});

test.run();