This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add test to check that nargo has been built from a clean commit
- Loading branch information
1 parent
ed7677e
commit 8ce38ad
Showing
2 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |