Skip to content

Commit

Permalink
Merge pull request #102 from foundry-rs/develop
Browse files Browse the repository at this point in the history
Merge develop to master
  • Loading branch information
tynes authored Aug 17, 2022
2 parents b26d6b4 + 192e4b2 commit 2fcc973
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-masks-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@foundry-rs/hardhat-forge": patch
---

Ignore metadata files when getting contract artifacts
4 changes: 2 additions & 2 deletions packages/hardhat-forge/src/forge/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class ForgeArtifacts implements IArtifacts {
const paths = await glob(path.join(this._out, "**/*.json"), {
ignore: path.join(this._buildInfo, "*.json"),
});
return paths.sort();
return paths.filter((p) => !p.endsWith(".metadata.json")).sort();
}

public async getBuildInfoPaths(): Promise<string[]> {
Expand Down Expand Up @@ -218,7 +218,7 @@ export class ForgeArtifacts implements IArtifacts {
const paths = globSync(path.join(this._out, "**/*.json"), {
ignore: path.join(this._buildInfo, "*.json"),
});
return paths.sort();
return paths.filter((p) => !p.endsWith(".metadata.json")).sort();
}

/**
Expand Down
6 changes: 4 additions & 2 deletions packages/hardhat-forge/test/project.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ describe("Integration tests", function () {
it("Should write artifacts to disk", async function () {
const artifacts = await this.hre.artifacts.getArtifactPaths();
const files = await getAllFiles(this.hre.config.paths.artifacts);
// filter out the debug files
const filtered = files.filter((f) => !f.includes(".dbg.json"));
// filter out the debug files and metadata
const filtered = files
.filter((f) => !f.includes(".dbg.json"))
.filter((f) => !f.includes(".metadata.json"));
assert.equal(artifacts.length, filtered.length);

for (const file of filtered) {
Expand Down

0 comments on commit 2fcc973

Please sign in to comment.