@morpho-org/morpho-test 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/lib/hardhat.js +3 -26
- package/package.json +6 -22
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @morpho-org/morpho-test
|
|
2
|
+
|
|
3
|
+
[![npm package][npm-img]][npm-url]
|
|
4
|
+
[![Downloads][downloads-img]][downloads-url]
|
|
5
|
+
|
|
6
|
+
Lightweight developer package that includes helpers to run hardhat and jest tests.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @morpho-org/morpho-test
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
yarn add @morpho-org/morpho-test
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### jest
|
|
23
|
+
|
|
24
|
+
When running a jest test suite, you may encounter the following error:
|
|
25
|
+
|
|
26
|
+
```log
|
|
27
|
+
node:internal/modules/esm/utils:211
|
|
28
|
+
throw new ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG();
|
|
29
|
+
^
|
|
30
|
+
|
|
31
|
+
TypeError: A dynamic import callback was invoked without --experimental-vm-modules
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
To fix this, [run jest using experimental VM modules](https://jestjs.io/docs/ecmascript-modules).
|
|
35
|
+
|
|
36
|
+
[downloads-img]: https://img.shields.io/npm/dt/@morpho-org/morpho-test
|
|
37
|
+
[downloads-url]: https://www.npmtrends.com/@morpho-org/morpho-test
|
|
38
|
+
[npm-img]: https://img.shields.io/npm/v/@morpho-org/morpho-test
|
|
39
|
+
[npm-url]: https://www.npmjs.com/package/@morpho-org/morpho-test
|
package/lib/hardhat.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
@@ -30,7 +7,7 @@ exports.setUp = exports.resetAfterEach = exports.reset = exports.mine = void 0;
|
|
|
30
7
|
const sinon_1 = __importDefault(require("sinon"));
|
|
31
8
|
const hardhat_network_helpers_1 = require("@nomicfoundation/hardhat-network-helpers");
|
|
32
9
|
try {
|
|
33
|
-
|
|
10
|
+
import("@nomicfoundation/hardhat-ethers");
|
|
34
11
|
const { ethers } = require("hardhat");
|
|
35
12
|
Object.defineProperty(ethers.provider, "_networkName", {
|
|
36
13
|
value: "mainnet",
|
|
@@ -48,8 +25,8 @@ const reset = ({ url, blockNumber, } = {}) => {
|
|
|
48
25
|
if (url === null)
|
|
49
26
|
return (0, hardhat_network_helpers_1.reset)();
|
|
50
27
|
const { config } = require("hardhat");
|
|
51
|
-
url
|
|
52
|
-
blockNumber
|
|
28
|
+
url ??= config.networks.hardhat.forking?.url;
|
|
29
|
+
blockNumber ??= config.networks.hardhat.forking?.blockNumber;
|
|
53
30
|
return (0, hardhat_network_helpers_1.reset)(url, blockNumber);
|
|
54
31
|
};
|
|
55
32
|
exports.reset = reset;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/morpho-test",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib"
|
|
@@ -9,27 +9,19 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"prepublish": "yarn build",
|
|
12
|
-
"add:morpho-test": "yarn add",
|
|
13
12
|
"build": "tsc --build tsconfig.build.json",
|
|
14
|
-
"
|
|
15
|
-
"test": "jest",
|
|
16
|
-
"test:morpho-test": "yarn test"
|
|
13
|
+
"test": "jest"
|
|
17
14
|
},
|
|
18
15
|
"dependencies": {
|
|
19
|
-
"@nomicfoundation/hardhat-chai-matchers": "^2.0.2",
|
|
20
16
|
"@nomicfoundation/hardhat-ethers": "^3.0.4",
|
|
21
17
|
"@nomicfoundation/hardhat-network-helpers": "^1.0.9",
|
|
22
18
|
"chai": "^4.3.10",
|
|
23
19
|
"chai-as-promised": "^7.1.2",
|
|
24
20
|
"chai-exclude": "^2.1.0",
|
|
25
21
|
"ethers": "^6.12.1",
|
|
26
|
-
"ethers-types": "^3.16.0",
|
|
27
22
|
"hardhat": "^2.20.1",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"jest": "^29.6.2",
|
|
31
|
-
"rxjs": "^7.8.1",
|
|
32
|
-
"sinon": "^17.0.1",
|
|
23
|
+
"jest": "^29.7.0",
|
|
24
|
+
"sinon": "^18.0.0",
|
|
33
25
|
"sinon-chai": "^3.7.0"
|
|
34
26
|
},
|
|
35
27
|
"devDependencies": {
|
|
@@ -42,18 +34,10 @@
|
|
|
42
34
|
"@types/sinon-chai": "^3.2.12",
|
|
43
35
|
"dotenv": "^16.3.1",
|
|
44
36
|
"mocha": "^10.4.0",
|
|
45
|
-
"ts-jest": "^29.
|
|
37
|
+
"ts-jest": "^29.2.2",
|
|
46
38
|
"ts-node": "^10.9.2",
|
|
47
39
|
"typescript": "^5.4.5"
|
|
48
40
|
},
|
|
49
|
-
"peerDependencies": {
|
|
50
|
-
"rxjs": "^7.8.1"
|
|
51
|
-
},
|
|
52
|
-
"peerDependenciesMeta": {
|
|
53
|
-
"rxjs": {
|
|
54
|
-
"optional": true
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
41
|
"publishConfig": {
|
|
58
42
|
"access": "public"
|
|
59
43
|
},
|
|
@@ -76,5 +60,5 @@
|
|
|
76
60
|
],
|
|
77
61
|
"preset": "ts-jest"
|
|
78
62
|
},
|
|
79
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "a5ea9ba44a3291f52e0f1fa1f477d0702faf29f1"
|
|
80
64
|
}
|