diff --git a/v-next/hardhat/src/internal/hre-intialization.ts b/v-next/hardhat/src/internal/hre-intialization.ts index 09e76a1fc2..3b3de8a77d 100644 --- a/v-next/hardhat/src/internal/hre-intialization.ts +++ b/v-next/hardhat/src/internal/hre-intialization.ts @@ -42,7 +42,7 @@ export async function createHardhatRuntimeEnvironment( const resolvedProjectRoot = await resolveProjectRoot(projectRoot); if (unsafeOptions.resolvedPlugins === undefined) { - const plugins = [...(config.plugins ?? []), ...builtinPlugins]; + const plugins = [...builtinPlugins, ...(config.plugins ?? [])]; const resolvedPlugins = await resolvePluginList( resolvedProjectRoot, diff --git a/v-next/hardhat/test/internal/example-mock-artifacts-plugin-using-test.ts b/v-next/hardhat/test/internal/example-mock-artifacts-plugin-using-test.ts index 764942b30b..1eba638df7 100644 --- a/v-next/hardhat/test/internal/example-mock-artifacts-plugin-using-test.ts +++ b/v-next/hardhat/test/internal/example-mock-artifacts-plugin-using-test.ts @@ -8,8 +8,8 @@ import { describe, it } from "node:test"; import { task } from "../../src/config.js"; import { createMockHardhatRuntimeEnvironment } from "../test-helpers/create-mock-hardhat-runtime-environment.js"; -describe.only("createMockHardhatRuntimeEnvironment", () => { - it.only("should allow plugins that leverage the artifact hre object", async () => { +describe("createMockHardhatRuntimeEnvironment", () => { + it("should allow plugins that leverage the artifact hre object", async () => { // arrange const exampleArtifact: Artifact = { _format: "hh-sol-artifact-1", diff --git a/v-next/hardhat/test/test-helpers/create-mock-hardhat-runtime-environment.ts b/v-next/hardhat/test/test-helpers/create-mock-hardhat-runtime-environment.ts index c803e25b82..a88e4dd9b2 100644 --- a/v-next/hardhat/test/test-helpers/create-mock-hardhat-runtime-environment.ts +++ b/v-next/hardhat/test/test-helpers/create-mock-hardhat-runtime-environment.ts @@ -8,7 +8,6 @@ import type { CompilerOutput, } from "../../src/types/artifacts.js"; import type { GlobalOptions } from "../../src/types/global-options.js"; -import type { HookContext } from "../../src/types/hooks.js"; import type { HardhatRuntimeEnvironment } from "../../src/types/hre.js"; import type { HardhatPlugin } from "../../src/types/plugins.js"; @@ -133,15 +132,20 @@ export async function createMockHardhatRuntimeEnvironment( const mockArtifactsPlugin: HardhatPlugin = { id: "mock-artifacts", - // dependencies: [async () => artifacts], + dependencies: [async () => artifacts], hookHandlers: { hre: async () => { return { created: async ( - _context: HookContext, - hre: HardhatRuntimeEnvironment, - ): Promise => { - hre.artifacts = new MockArtifactsManager(); + context, + hre, + next, + ): Promise => { + const updatedHre = await next(context, hre); + + updatedHre.artifacts = new MockArtifactsManager(); + + return updatedHre; }, }; },