mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
adding command line args for test:rummer
This commit is contained in:
parent
6f67400b62
commit
c7f9181296
|
@ -13,6 +13,8 @@ import { HardhatUserConfig } from "hardhat/config";
|
|||
import { NetworkUserConfig } from "hardhat/types";
|
||||
import { utils } from "ethers";
|
||||
import Web3 from "web3";
|
||||
import "./scripts/tests/run-tests"
|
||||
|
||||
|
||||
dotenvConfig({ path: resolve(__dirname, "./.env") });
|
||||
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -16,12 +16,14 @@
|
|||
"@uniswap/v3-core": "^1.0.0",
|
||||
"@uniswap/v3-periphery": "^1.3.0",
|
||||
"chalk": "^5.0.0",
|
||||
"command-line-args": "^4.0.7",
|
||||
"dotenv": "^10.0.0",
|
||||
"hardhat-docgen": "^1.2.0",
|
||||
"inquirer": "^8.2.0",
|
||||
"minimist": "^1.2.5",
|
||||
"solc": "^0.8.10",
|
||||
"typechain": "^6.0.5"
|
||||
"typechain": "^6.0.5",
|
||||
"yargs": "^13.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nomiclabs/hardhat-ethers": "^2.0.3",
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
"scripts": {
|
||||
"test": "hardhat run scripts/tests/global-test.ts",
|
||||
"coverage": "./node_modules/.bin/solidity-coverage",
|
||||
"check": "node status-checks/huskyCheck.js",
|
||||
"check-husky": "node status-checks/huskyCheck.js",
|
||||
"deploy": "node scripts/deployConnectorsFromCmd.js",
|
||||
"test:runner": "hardhat run scripts/tests/run-tests.ts",
|
||||
"check": "ts-node status-checks/huskyCheck.ts",
|
||||
"check-husky": "ts-node status-checks/huskyCheck.ts",
|
||||
"deploy": "ts-node scripts/deployConnectorsFromCmd.ts",
|
||||
"test:runner": "hardhat run_tests_on",
|
||||
"typechain": "hardhat typechain",
|
||||
"compile": "hardhat compile",
|
||||
"deploy:runner": "hardhat run scripts/deployment/deployConnectorsFromCmd.ts"
|
||||
|
|
|
@ -4,17 +4,29 @@ import { promises as fs } from "fs";
|
|||
import { join } from "path";
|
||||
import { execScript } from "./command";
|
||||
|
||||
import { task } from "hardhat/config";
|
||||
|
||||
|
||||
let start: number, end: number;
|
||||
|
||||
async function testRunner() {
|
||||
const { chain } = await inquirer.prompt([
|
||||
{
|
||||
name: "chain",
|
||||
message: "What chain do you want to run tests on?",
|
||||
type: "list",
|
||||
choices: ["mainnet", "polygon", "avalanche", "arbitrum"],
|
||||
},
|
||||
]);
|
||||
task("run_tests_on", "runs specified test on a specified chain")
|
||||
.addPositionalParam("chain")
|
||||
.addPositionalParam("test")
|
||||
.setAction(async (taskArgs) => {
|
||||
const chain = taskArgs.chain;
|
||||
const test = taskArgs.test;
|
||||
await testRunner(chain,test)
|
||||
.then(() =>
|
||||
console.log(
|
||||
`🙌 finished the test runner, time taken ${(end - start) / 1000} sec`
|
||||
)
|
||||
)
|
||||
.catch((err) => console.error("❌ failed due to error: ", err));
|
||||
|
||||
});
|
||||
|
||||
async function testRunner(chain: string, testName: string) {
|
||||
|
||||
const testsPath = join(__dirname, "../../test", chain);
|
||||
await fs.access(testsPath);
|
||||
const availableTests = await fs.readdir(testsPath);
|
||||
|
@ -22,14 +34,6 @@ async function testRunner() {
|
|||
throw new Error(`No tests available for ${chain}`);
|
||||
}
|
||||
|
||||
const { testName } = await inquirer.prompt([
|
||||
{
|
||||
name: "testName",
|
||||
message: "For which connector you want to run the tests?",
|
||||
type: "list",
|
||||
choices: ["all", ...availableTests],
|
||||
},
|
||||
]);
|
||||
start = Date.now();
|
||||
let path: string;
|
||||
if (testName === "all") {
|
||||
|
@ -59,10 +63,3 @@ async function testRunner() {
|
|||
end = Date.now();
|
||||
}
|
||||
|
||||
testRunner()
|
||||
.then(() =>
|
||||
console.log(
|
||||
`🙌 finished the test runner, time taken ${(end - start) / 1000} sec`
|
||||
)
|
||||
)
|
||||
.catch((err) => console.error("❌ failed due to error: ", err));
|
||||
|
|
|
@ -13135,7 +13135,7 @@
|
|||
"lodash" "^4.17.15"
|
||||
"yargs" "^13.3.0"
|
||||
|
||||
"yargs@^13.3.0", "yargs@13.3.2":
|
||||
"yargs@^13.3.0", "yargs@^13.3.2", "yargs@13.3.2":
|
||||
"integrity" "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw=="
|
||||
"resolved" "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz"
|
||||
"version" "13.3.2"
|
||||
|
|
Loading…
Reference in New Issue
Block a user