Skip to content

Commit

Permalink
chore: add jest config (#39)
Browse files Browse the repository at this point in the history
* chore: add jest config

* chore: ignore test files from build
  • Loading branch information
mkykadir authored Jun 15, 2023
1 parent 2a840bc commit 9acc5a9
Show file tree
Hide file tree
Showing 4 changed files with 1,744 additions and 22 deletions.
27 changes: 27 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
transform: {},
collectCoverage: true,
collectCoverageFrom: ["src/**/*.ts"],
coveragePathIgnorePatterns: [
"node_modules",
"jest.config.ts",
"src/web3-functions",
"lib/Web3Function.ts",
"hardhat",
".d.ts",
"__test__",
],
testPathIgnorePatterns: ["node_modules", "dist", "lib/binaries"],
extensionsToTreatAsEsm: [".ts"],
coverageReporters: ["lcov", "json", "html"],
globals: {
"ts-jest": {
useESM: true,
},
},
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
};
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"format:check": "prettier --check '*/**/*.{js,json,md,ts}'",
"lint": "eslint --cache .",
"test": "ts-node src/bin/index.ts test",
"test:unit": "node --experimental-vm-modules ./node_modules/.bin/jest src --verbose --detectOpenHandles --forceExit --silent=false",
"benchmark": "ts-node src/bin/index.ts benchmark",
"deploy": "ts-node src/bin/index.ts deploy",
"fetch": "ts-node src/bin/index.ts fetch",
Expand All @@ -90,6 +91,7 @@
},
"devDependencies": {
"@tsconfig/recommended": "^1.0.1",
"@types/jest": "^29.5.1",
"@types/node": "^16.11.12",
"@types/object-hash": "^3.0.2",
"@types/signal-exit": "^3.0.1",
Expand All @@ -99,7 +101,9 @@
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"hardhat": "^2.13.0",
"jest": "^29.5.0",
"prettier": "^2.3.2",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^4.7.0"
},
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["src/web3-functions/**/*"]
"exclude": ["src/web3-functions/**/*", "src/**/__test__"]
}
Loading

0 comments on commit 9acc5a9

Please sign in to comment.