diff --git a/jest.config.js b/jest.config.js index 94a6afaeb..923810a38 100644 --- a/jest.config.js +++ b/jest.config.js @@ -17,6 +17,14 @@ const config = { testMatch: ["/zilliqa/js/**/test/?(*.)+(spec|test).(ts|js)"], + testURL: "http://localhost", + collectCoverage: true, + collectCoverageFrom: [ + "/packages/*/src/**/*.{ts,js}", + "!**/node_modules/**", + ], + automock: false, + resetMocks: false, setupFiles: ["/jest-setup.js"], }; diff --git a/package.json b/package.json index 457120d91..65ef56d7b 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ "hdkey": "^1.1.0", "hmac-drbg": "^1.0.1", "jest": "^27.1.3", - "ts-jest": "^27.1.3", "jest-diff": "^29.3.1", "jest-environment-jsdom": "^29.3.1", "jest-fetch-mock": "3.0.3", @@ -43,7 +42,7 @@ "jest-matcher-utils": "^29.3.1", "long": "^4.0.0", "mitt": "^1.1.3", - "mock-socket": "^9.0.2", + "mock-socket": "^9.1.5", "node-fetch": "^3.2.10", "pbkdf2": "^3.0.16", "pretty-format": "^29.3.1", @@ -73,6 +72,7 @@ "styled-components": "^4.3.2", "tailwindcss": "^3.1.8", "terser": ">=5.7.1 <5.9.0", + "ts-jest": "^27.1.3", "ts-loader": "8.0.4", "tslib": "2.3.1", "typescript": "^4.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3679c4289..22bbd447f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,7 +45,7 @@ specifiers: jest-matcher-utils: ^29.3.1 long: ^4.0.0 mitt: ^1.1.3 - mock-socket: ^9.0.2 + mock-socket: ^9.1.5 node-fetch: ^3.2.10 pbkdf2: ^3.0.16 pretty-format: ^29.3.1 diff --git a/zilliqa/js/blockchain/BUILD b/zilliqa/js/blockchain/BUILD index dbb338b06..edaa72e86 100644 --- a/zilliqa/js/blockchain/BUILD +++ b/zilliqa/js/blockchain/BUILD @@ -62,7 +62,11 @@ npm_package( ts_project( name = "test_src", - srcs = glob( + srcs = [ + "//zilliqa/js:aes-js.d", + "//zilliqa/js:hmac-drbg.d", + "//zilliqa/js:pbkdf2.d", + ] + glob( [ "src/*.ts", "src/**/*.ts", @@ -92,6 +96,10 @@ ts_project( "//:node_modules/@types/node", "//:node_modules/@typescript-eslint/eslint-plugin", "//:node_modules/@typescript-eslint/parser", + "//:node_modules/@zilliqa-js/account", + "//:node_modules/@zilliqa-js/core", + "//:node_modules/@zilliqa-js/crypto", + "//:node_modules/@zilliqa-js/util", "//:node_modules/ansi-styles", "//:node_modules/bn.js", "//:node_modules/buffer-from", diff --git a/zilliqa/js/contract/BUILD b/zilliqa/js/contract/BUILD index 7dcfa9b88..33fa2a5c3 100644 --- a/zilliqa/js/contract/BUILD +++ b/zilliqa/js/contract/BUILD @@ -65,7 +65,11 @@ npm_package( ts_project( name = "test_src", - srcs = glob( + srcs = [ + "//zilliqa/js:aes-js.d", + "//zilliqa/js:hmac-drbg.d", + "//zilliqa/js:pbkdf2.d", + ] + glob( [ "src/*.ts", "src/**/*.ts", @@ -95,6 +99,11 @@ ts_project( "//:node_modules/@types/node", "//:node_modules/@typescript-eslint/eslint-plugin", "//:node_modules/@typescript-eslint/parser", + "//:node_modules/@zilliqa-js/account", + "//:node_modules/@zilliqa-js/blockchain", + "//:node_modules/@zilliqa-js/core", + "//:node_modules/@zilliqa-js/crypto", + "//:node_modules/@zilliqa-js/util", "//:node_modules/ansi-styles", "//:node_modules/bn.js", "//:node_modules/buffer-from", @@ -109,6 +118,7 @@ ts_project( "//:node_modules/pretty-format", "//:node_modules/source-map", "//:node_modules/tslib", + "//:node_modules/utility-types", ], ) diff --git a/zilliqa/js/subscriptions/BUILD b/zilliqa/js/subscriptions/BUILD index cac8a38c1..a129f63bc 100644 --- a/zilliqa/js/subscriptions/BUILD +++ b/zilliqa/js/subscriptions/BUILD @@ -57,7 +57,9 @@ npm_package( ts_project( name = "test_src", - srcs = glob( + srcs = [ + "//zilliqa/js:aes-js.d", + ] + glob( [ "src/*.ts", "src/**/*.ts", @@ -85,6 +87,7 @@ ts_project( "//:node_modules/@types/jest", "//:node_modules/@types/long", "//:node_modules/@types/node", + "//:node_modules/@types/websocket", "//:node_modules/@typescript-eslint/eslint-plugin", "//:node_modules/@typescript-eslint/parser", "//:node_modules/ansi-styles", @@ -97,10 +100,13 @@ ts_project( "//:node_modules/jest-get-type", "//:node_modules/jest-matcher-utils", "//:node_modules/long", + "//:node_modules/mitt", + "//:node_modules/mock-socket", "//:node_modules/node-fetch", "//:node_modules/pretty-format", "//:node_modules/source-map", "//:node_modules/tslib", + "//:node_modules/websocket", ], )