diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 0000000..813a474 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,3 @@ +{ + "presets": [["@babel/preset-env", { "targets": { "node": "current" } }], "@babel/preset-typescript"] +} diff --git a/jest.config.json b/jest.config.json deleted file mode 100644 index d2f5206..0000000 --- a/jest.config.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "projects": ["/packages/*"], - "collectCoverageFrom": ["/src/**/*.ts"], - "coverageThreshold": { - "global": { - "branches": 20, - "functions": 30, - "lines": 30, - "statements": 30 - } - } -} diff --git a/jest.config.ts b/jest.config.ts new file mode 100644 index 0000000..01993f7 --- /dev/null +++ b/jest.config.ts @@ -0,0 +1,26 @@ +import fs from "fs" +import type { Config } from "@jest/types" + +const projects = fs + .readdirSync("./packages", { withFileTypes: true }) + .filter((directory) => directory.isDirectory()) + .map(({ name }) => ({ + rootDir: `packages/${name}`, + displayName: name, + moduleNameMapper: { + "@zk-kit/types": "/../../types/zk-kit/index.d.ts" + } + })) + +export default async (): Promise => ({ + projects, + collectCoverageFrom: ["/src/**/*.ts", "!/src/**/index.ts", "!/src/**/*.d.ts"], + coverageThreshold: { + global: { + branches: 20, + functions: 30, + lines: 30, + statements: 30 + } + } +}) diff --git a/package.json b/package.json index 2122a3c..bf714df 100644 --- a/package.json +++ b/package.json @@ -7,13 +7,13 @@ "bugs": "https://github.com/appliedzkp/zk-kit/issues", "private": true, "scripts": { - "install": "npm run bootstrap && npm run build", - "bootstrap": "lerna bootstrap --no-ci", + "install": "yarn bootstrap && yarn build", + "bootstrap": "lerna bootstrap", "build": "lerna run build", "build:watch": "lerna run --parallel build:watch -- -- --watch", "test": "jest --coverage", "test:watch": "jest --coverage --watch", - "test:prod": "npm run lint && npm test", + "test:prod": "yarn lint && yarn test", "lint": "eslint . --ext .js,.jsx,.ts,.tsx", "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix", "prettier": "prettier -c .", @@ -32,6 +32,9 @@ "circom" ], "devDependencies": { + "@babel/core": "^7.16.7", + "@babel/preset-env": "^7.16.8", + "@babel/preset-typescript": "^7.16.7", "@commitlint/cli": "^16.0.2", "@commitlint/config-conventional": "^16.0.0", "@rollup/plugin-typescript": "^8.3.0", @@ -39,6 +42,7 @@ "@types/node": "^17.0.9", "@typescript-eslint/eslint-plugin": "^5.9.1", "@typescript-eslint/parser": "^5.9.1", + "babel-jest": "^27.4.6", "benny": "^3.7.1", "commitizen": "^4.2.4", "cz-conventional-changelog": "^3.3.0", @@ -51,7 +55,6 @@ "prettier": "^2.5.1", "rimraf": "^3.0.2", "rollup": "^2.64.0", - "ts-jest": "^27.1.3", "ts-node": "^10.4.0", "tslib": "^2.3.1", "typescript": "^4.5.4" diff --git a/packages/identity/jest.config.json b/packages/identity/jest.config.json deleted file mode 100644 index a46df71..0000000 --- a/packages/identity/jest.config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "displayName": "identity", - "transform": { - "\\.ts$": "ts-jest" - } -} diff --git a/packages/incremental-merkle-tree/jest.config.json b/packages/incremental-merkle-tree/jest.config.json deleted file mode 100644 index cd92765..0000000 --- a/packages/incremental-merkle-tree/jest.config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "displayName": "incremental-merkle-tree", - "transform": { - "\\.ts$": "ts-jest" - } -} diff --git a/packages/protocols/jest.config.json b/packages/protocols/jest.config.json deleted file mode 100644 index ca4facb..0000000 --- a/packages/protocols/jest.config.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "displayName": "protocols", - "transform": { - "\\.ts$": "ts-jest" - }, - "preset": "ts-jest/presets/js-with-ts-esm" -} diff --git a/packages/sparse-merkle-tree/jest.config.json b/packages/sparse-merkle-tree/jest.config.json deleted file mode 100644 index 3b1616f..0000000 --- a/packages/sparse-merkle-tree/jest.config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "displayName": "sparse-merkle-tree", - "transform": { - "\\.ts$": "ts-jest" - } -}