@@ -7,15 +7,15 @@ import { resolveHardhatConfigPath } from "../../src/config.js";
7
7
import { createHardhatRuntimeEnvironment } from "../../src/hre.js" ;
8
8
import { builtinPlugins } from "../../src/internal/builtin-plugins/index.js" ;
9
9
import {
10
- getHardhatRuntimeEnvironmentSingleton ,
11
- resetHardhatRuntimeEnvironmentSingleton ,
12
- setHardhatRuntimeEnvironmentSingleton ,
13
- } from "../../src/internal/hre-singleton .js" ;
10
+ getGlobalHardhatRuntimeEnvironment ,
11
+ resetGlobalHardhatRuntimeEnvironment ,
12
+ setGlobalHardhatRuntimeEnvironment ,
13
+ } from "../../src/internal/global- hre-instance .js" ;
14
14
import { useFixtureProject } from "../helpers/project.js" ;
15
15
16
16
describe ( "HRE" , ( ) => {
17
17
afterEach ( ( ) => {
18
- resetHardhatRuntimeEnvironmentSingleton ( ) ;
18
+ resetGlobalHardhatRuntimeEnvironment ( ) ;
19
19
} ) ;
20
20
21
21
describe ( "createHardhatRuntimeEnvironment" , ( ) => {
@@ -26,30 +26,30 @@ describe("HRE", () => {
26
26
} ) ;
27
27
} ) ;
28
28
29
- describe ( "getHardhatRuntimeEnvironmentSingleton " , ( ) => {
30
- it ( "Should return undefined if it wasn 't set" , ( ) => {
31
- assert . equal ( getHardhatRuntimeEnvironmentSingleton ( ) , undefined ) ;
32
- assert . equal ( getHardhatRuntimeEnvironmentSingleton ( ) , undefined ) ;
29
+ describe ( "getGlobalHardhatRuntimeEnvironment " , ( ) => {
30
+ it ( "Should return undefined if the global instance isn 't set" , ( ) => {
31
+ assert . equal ( getGlobalHardhatRuntimeEnvironment ( ) , undefined ) ;
32
+ assert . equal ( getGlobalHardhatRuntimeEnvironment ( ) , undefined ) ;
33
33
} ) ;
34
34
35
35
it ( "should return the same instance after it's set" , async ( ) => {
36
36
const hre = await createHardhatRuntimeEnvironment ( { } ) ;
37
- setHardhatRuntimeEnvironmentSingleton ( hre ) ;
37
+ setGlobalHardhatRuntimeEnvironment ( hre ) ;
38
38
39
- const hre1 = getHardhatRuntimeEnvironmentSingleton ( ) ;
40
- const hre2 = getHardhatRuntimeEnvironmentSingleton ( ) ;
39
+ const hre1 = getGlobalHardhatRuntimeEnvironment ( ) ;
40
+ const hre2 = getGlobalHardhatRuntimeEnvironment ( ) ;
41
41
42
42
assert . ok ( hre1 === hre , "The instances are not the same" ) ;
43
43
assert . ok ( hre2 === hre , "The instances are not the same" ) ;
44
44
} ) ;
45
45
46
- it ( "should include the builtin plugins" , async ( ) => {
46
+ it ( "should include the builtin plugins when initialized using createHardhatRuntimeEnvironment " , async ( ) => {
47
47
const hre = await createHardhatRuntimeEnvironment ( { } ) ;
48
- setHardhatRuntimeEnvironmentSingleton ( hre ) ;
49
- const singletonHre = getHardhatRuntimeEnvironmentSingleton ( ) ;
48
+ setGlobalHardhatRuntimeEnvironment ( hre ) ;
49
+ const globalHre = getGlobalHardhatRuntimeEnvironment ( ) ;
50
50
51
- assert . ok ( singletonHre === hre , "The instances are not the same" ) ;
52
- assert . deepEqual ( singletonHre . config . plugins , builtinPlugins ) ;
51
+ assert . ok ( globalHre === hre , "The instances are not the same" ) ;
52
+ assert . deepEqual ( globalHre . config . plugins , builtinPlugins ) ;
53
53
} ) ;
54
54
} ) ;
55
55
0 commit comments