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

Custom manifest file support #107

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Changes from 1 commit
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
43 changes: 43 additions & 0 deletions app.tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { red } from "ansicolor";
import { getManifestFileName, main } from "./app";
import { version } from "./package.json";
import { cpSync, mkdtempSync, rmdirSync, writeFileSync } from "fs";
import { join, resolve } from "path";
import { tmpdir } from "os";
BowTiedRadone marked this conversation as resolved.
Show resolved Hide resolved

describe("Command-line arguments handling", () => {
const initialArgv = process.argv;
Expand Down Expand Up @@ -379,4 +382,44 @@ describe("Custom manifest detection", () => {
// Assert
expect(actual).toBe("Clarinet.toml");
});

it("returns the custom manifest file name for a project that has one", () => {
// Setup
const exampleProject = "example";
const tempDir = mkdtempSync(join(tmpdir(), "simnet-test-"));

// Create a custom manifest file complying with the Rendezvous convention:
// `Clarinet-<target-contract-name>.toml`.
const expected = "Clarinet-counter.toml";

cpSync(exampleProject, tempDir, { recursive: true });

writeFileSync(
BowTiedRadone marked this conversation as resolved.
Show resolved Hide resolved
resolve(tempDir, expected),
`
[project]
name = "example"
telemetry = false
cache_dir = "./.cache"
[contracts.counter]
path = "contracts/counter.clar"
clarity_version = 3
epoch = 3.0
[repl.analysis]
passes = ["check_checker"]
check_checker = { trusted_sender = false, trusted_caller = false, callee_filter = false }
`
);

// Exercise
const actual = getManifestFileName(tempDir, "counter");

// Verify
expect(actual).toBe(expected);

// Teardown
rmdirSync(tempDir, { recursive: true });
});
});