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 { NetworkUserConfig } from "hardhat/types";
|
||||||
import { utils } from "ethers";
|
import { utils } from "ethers";
|
||||||
import Web3 from "web3";
|
import Web3 from "web3";
|
||||||
|
import "./scripts/tests/run-tests"
|
||||||
|
|
||||||
|
|
||||||
dotenvConfig({ path: resolve(__dirname, "./.env") });
|
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-core": "^1.0.0",
|
||||||
"@uniswap/v3-periphery": "^1.3.0",
|
"@uniswap/v3-periphery": "^1.3.0",
|
||||||
"chalk": "^5.0.0",
|
"chalk": "^5.0.0",
|
||||||
|
"command-line-args": "^4.0.7",
|
||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"hardhat-docgen": "^1.2.0",
|
"hardhat-docgen": "^1.2.0",
|
||||||
"inquirer": "^8.2.0",
|
"inquirer": "^8.2.0",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"solc": "^0.8.10",
|
"solc": "^0.8.10",
|
||||||
"typechain": "^6.0.5"
|
"typechain": "^6.0.5",
|
||||||
|
"yargs": "^13.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nomiclabs/hardhat-ethers": "^2.0.3",
|
"@nomiclabs/hardhat-ethers": "^2.0.3",
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "hardhat run scripts/tests/global-test.ts",
|
"test": "hardhat run scripts/tests/global-test.ts",
|
||||||
"coverage": "./node_modules/.bin/solidity-coverage",
|
"coverage": "./node_modules/.bin/solidity-coverage",
|
||||||
"check": "node status-checks/huskyCheck.js",
|
"check": "ts-node status-checks/huskyCheck.ts",
|
||||||
"check-husky": "node status-checks/huskyCheck.js",
|
"check-husky": "ts-node status-checks/huskyCheck.ts",
|
||||||
"deploy": "node scripts/deployConnectorsFromCmd.js",
|
"deploy": "ts-node scripts/deployConnectorsFromCmd.ts",
|
||||||
"test:runner": "hardhat run scripts/tests/run-tests.ts",
|
"test:runner": "hardhat run_tests_on",
|
||||||
"typechain": "hardhat typechain",
|
"typechain": "hardhat typechain",
|
||||||
"compile": "hardhat compile",
|
"compile": "hardhat compile",
|
||||||
"deploy:runner": "hardhat run scripts/deployment/deployConnectorsFromCmd.ts"
|
"deploy:runner": "hardhat run scripts/deployment/deployConnectorsFromCmd.ts"
|
||||||
|
|
|
@ -4,17 +4,29 @@ import { promises as fs } from "fs";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import { execScript } from "./command";
|
import { execScript } from "./command";
|
||||||
|
|
||||||
|
import { task } from "hardhat/config";
|
||||||
|
|
||||||
|
|
||||||
let start: number, end: number;
|
let start: number, end: number;
|
||||||
|
|
||||||
async function testRunner() {
|
task("run_tests_on", "runs specified test on a specified chain")
|
||||||
const { chain } = await inquirer.prompt([
|
.addPositionalParam("chain")
|
||||||
{
|
.addPositionalParam("test")
|
||||||
name: "chain",
|
.setAction(async (taskArgs) => {
|
||||||
message: "What chain do you want to run tests on?",
|
const chain = taskArgs.chain;
|
||||||
type: "list",
|
const test = taskArgs.test;
|
||||||
choices: ["mainnet", "polygon", "avalanche", "arbitrum"],
|
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);
|
const testsPath = join(__dirname, "../../test", chain);
|
||||||
await fs.access(testsPath);
|
await fs.access(testsPath);
|
||||||
const availableTests = await fs.readdir(testsPath);
|
const availableTests = await fs.readdir(testsPath);
|
||||||
|
@ -22,14 +34,6 @@ async function testRunner() {
|
||||||
throw new Error(`No tests available for ${chain}`);
|
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();
|
start = Date.now();
|
||||||
let path: string;
|
let path: string;
|
||||||
if (testName === "all") {
|
if (testName === "all") {
|
||||||
|
@ -59,10 +63,3 @@ async function testRunner() {
|
||||||
end = Date.now();
|
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"
|
"lodash" "^4.17.15"
|
||||||
"yargs" "^13.3.0"
|
"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=="
|
"integrity" "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw=="
|
||||||
"resolved" "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz"
|
"resolved" "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz"
|
||||||
"version" "13.3.2"
|
"version" "13.3.2"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user