-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19c2d26
commit cebc23b
Showing
1 changed file
with
12 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import path from "node:path"; | |
import { after, before, beforeEach, describe, it } from "node:test"; | ||
|
||
import { HardhatError } from "@ignored/hardhat-vnext-errors"; | ||
import { getRealPath } from "@ignored/hardhat-vnext-utils/fs"; | ||
import { assertRejectsWithHardhatError } from "@nomicfoundation/hardhat-test-utils"; | ||
|
||
import { | ||
|
@@ -338,22 +339,21 @@ describe("Resolver", () => { | |
}); | ||
|
||
describe("Imports of npm files", () => { | ||
it("Should always treat hardhat/console.sol as an npm file even if other hardhat/ files are local", async () => { | ||
it("Should always treat hardhat/console.sol as resolved from the hh package itself even if other hardhat/ files are local", async () => { | ||
const consoleSol = await resolver.resolveImport( | ||
contractsFileSol, | ||
"hardhat/console.sol", | ||
); | ||
|
||
assertNpmPackageResolvedFile( | ||
consoleSol, | ||
{ | ||
name: "hardhat", | ||
version: "3.0.0", | ||
rootSourceName: "npm/[email protected]/", | ||
}, | ||
"monorepo/node_modules/hardhat", | ||
"console.sol", | ||
); | ||
assert.deepEqual(consoleSol.type, ResolvedFileType.NPM_PACKGE_FILE); | ||
assert.deepEqual(consoleSol.package, { | ||
name: "@ignored/hardhat-vnext", | ||
version: "local", // The test considers it part of the monorepo, because it's the same package | ||
rootSourceName: "npm/@ignored/hardhat-vnext@local/", | ||
rootFsPath: await getRealPath( | ||
path.join(import.meta.dirname, "../../../../../.."), | ||
), | ||
}); | ||
|
||
const hardhatFile = await resolver.resolveImport( | ||
contractsFileSol, | ||
|
@@ -366,7 +366,7 @@ describe("Resolver", () => { | |
{ | ||
context: "", | ||
prefix: "hardhat/console.sol", | ||
target: "npm/hardhat@3.0.0/console.sol", | ||
target: "npm/@ignored/hardhat-vnext@local/console.sol", | ||
}, | ||
]); | ||
}); | ||
|