@@ -4,15 +4,15 @@ import type { VerificationProvidersConfig } from "hardhat/types/config";
44import type { HardhatRuntimeEnvironment } from "hardhat/types/hre" ;
55
66import { assert } from "chai" ;
7- import chalk from "chalk" ;
87import sinon from "sinon" ;
98
10- import { internalVerifyAction } from "../../src/internal/tasks/verify.js" ;
9+ import { verify } from "../../src/internal/tasks/verify.js" ;
1110import { useEphemeralIgnitionProject } from "../test-helpers/use-ignition-project.js" ;
1211
13- describe . only ( "ignition verify task" , ( ) => {
12+ describe ( "ignition verify task" , ( ) => {
1413 useEphemeralIgnitionProject ( "minimal" ) ;
1514
15+ // TODO: replace with disableConsole() once converted to `node:test`
1616 let consoleLogStub : sinon . SinonStub ;
1717 let consoleWarnStub : sinon . SinonStub ;
1818 let consoleErrorStub : sinon . SinonStub ;
@@ -48,14 +48,15 @@ describe.only("ignition verify task", () => {
4848 if ( args . provider !== undefined ) {
4949 verifyCallsByProvider . push ( args . provider ) ;
5050 }
51+
5152 return true ;
5253 } ;
5354
5455 const mockGetVerificationInformation = async function * ( ) {
5556 yield exampleVerifyInfo ;
5657 } ;
5758
58- await internalVerifyAction (
59+ await verify (
5960 { deploymentId : "test-deployment" , force : false } ,
6061 this . hre ,
6162 mockVerifyContract ,
@@ -66,23 +67,6 @@ describe.only("ignition verify task", () => {
6667 assert . include ( verifyCallsByProvider , "etherscan" ) ;
6768 assert . include ( verifyCallsByProvider , "blockscout" ) ;
6869 assert . include ( verifyCallsByProvider , "sourcify" ) ;
69-
70- const logCalls = consoleLogStub . getCalls ( ) . map ( ( c ) => c . args [ 0 ] ) ;
71- assert . isTrue (
72- logCalls . some ( ( log : string ) =>
73- log . includes ( chalk . cyan . bold ( "\n=== Etherscan ===" ) ) ,
74- ) ,
75- ) ;
76- assert . isTrue (
77- logCalls . some ( ( log : string ) =>
78- log . includes ( chalk . cyan . bold ( "\n=== Blockscout ===" ) ) ,
79- ) ,
80- ) ;
81- assert . isTrue (
82- logCalls . some ( ( log : string ) =>
83- log . includes ( chalk . cyan . bold ( "\n=== Sourcify ===" ) ) ,
84- ) ,
85- ) ;
8670 } ) ;
8771
8872 it ( "should continue verification on other providers when one fails" , async function ( ) {
@@ -94,18 +78,20 @@ describe.only("ignition verify task", () => {
9478 ) => {
9579 if ( args . provider !== undefined ) {
9680 verifyCallsByProvider . push ( args . provider ) ;
81+
9782 if ( args . provider === "blockscout" ) {
9883 throw new Error ( "Blockscout verification failed" ) ;
9984 }
10085 }
86+
10187 return true ;
10288 } ;
10389
10490 const mockGetVerificationInformation = async function * ( ) {
10591 yield exampleVerifyInfo ;
10692 } ;
10793
108- await internalVerifyAction (
94+ await verify (
10995 { deploymentId : "test-deployment" , force : false } ,
11096 this . hre ,
11197 mockVerifyContract ,
@@ -116,39 +102,33 @@ describe.only("ignition verify task", () => {
116102 assert . include ( verifyCallsByProvider , "etherscan" ) ;
117103 assert . include ( verifyCallsByProvider , "blockscout" ) ;
118104 assert . include ( verifyCallsByProvider , "sourcify" ) ;
119-
120- const errorCalls = consoleErrorStub . getCalls ( ) . map ( ( c ) => c . args [ 0 ] ) ;
121- assert . isTrue (
122- errorCalls . some ( ( err : string ) =>
123- err . includes ( chalk . red ( "Blockscout verification failed" ) ) ,
124- ) ,
125- ) ;
126105 } ) ;
127106
128- it ( "should warn when no providers are enabled" , async function ( ) {
129- const originalConfig = this . hre . config . verify ;
130- ( this . hre . config . verify as any ) = {
131- etherscan : { enabled : false , apiKey : "" } ,
132- blockscout : { enabled : false } ,
133- sourcify : { enabled : false } ,
134- } ;
107+ it ( "should not verify when no providers are enabled" , async function ( ) {
108+ let verifyContractCalled = false ;
109+
110+ await verify (
111+ { deploymentId : "test-deployment" , force : false } ,
112+ {
113+ ...this . hre ,
114+ config : {
115+ ...this . hre . config ,
116+ verify : {
117+ etherscan : { enabled : false , apiKey : "" as any } ,
118+ blockscout : { enabled : false } ,
119+ sourcify : { enabled : false } ,
120+ } ,
121+ } ,
122+ } ,
123+ async ( ) => {
124+ verifyContractCalled = true ;
125+
126+ return true ;
127+ } ,
128+ async function * ( ) { } ,
129+ ) ;
135130
136- try {
137- await internalVerifyAction (
138- { deploymentId : "test-deployment" , force : false } ,
139- this . hre ,
140- async ( ) => true ,
141- async function * ( ) { } ,
142- ) ;
143-
144- assert . isTrue (
145- consoleWarnStub . calledWith (
146- chalk . yellow ( "\n⚠️ No verification providers are enabled." ) ,
147- ) ,
148- ) ;
149- } finally {
150- this . hre . config . verify = originalConfig ;
151- }
131+ assert . isFalse ( verifyContractCalled ) ;
152132 } ) ;
153133
154134 it ( "should verify multiple contracts on all enabled providers" , async function ( ) {
@@ -188,7 +168,7 @@ describe.only("ignition verify task", () => {
188168 } ;
189169 } ;
190170
191- await internalVerifyAction (
171+ await verify (
192172 { deploymentId : "test-deployment" , force : false } ,
193173 this . hre ,
194174 mockVerifyContract ,
@@ -229,7 +209,7 @@ describe.only("ignition verify task", () => {
229209 yield exampleVerifyInfo ;
230210 } ;
231211
232- await internalVerifyAction (
212+ await verify (
233213 { deploymentId : "test-deployment" , force : true } ,
234214 this . hre ,
235215 mockVerifyContract ,
@@ -243,14 +223,14 @@ describe.only("ignition verify task", () => {
243223 ) ;
244224 } ) ;
245225
246- it ( "should skip contracts when artifacts cannot be resolved" , async function ( ) {
226+ it ( "should not verify if contracts artifacts cannot be resolved" , async function ( ) {
247227 let verifyContractCalled = false ;
248228
249229 const mockGetVerificationInformation = async function * ( ) {
250230 yield "contracts/Foo.sol:Foo" ;
251231 } ;
252232
253- await internalVerifyAction (
233+ await verify (
254234 { deploymentId : "test-deployment" , force : false } ,
255235 this . hre ,
256236 async ( ) => {
0 commit comments