Skip to content

Commit

Permalink
Getting util test to work
Browse files Browse the repository at this point in the history
  • Loading branch information
troelsfr committed Nov 10, 2022
1 parent 2599b2c commit 7799d8b
Show file tree
Hide file tree
Showing 10 changed files with 1,825 additions and 1,027 deletions.
23 changes: 23 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@aspect_rules_js//npm:defs.bzl", "npm_link_package")
load("@npm//:defs.bzl", "npm_link_all_packages")

Expand Down Expand Up @@ -58,6 +59,7 @@ npm_link_all_packages(name = "node_modules")
exports_files([
"package.json",
"tsconfig.base.json",
"tsconfig.test.json",
])

exports_files(["docs"])
Expand All @@ -72,3 +74,24 @@ copy_to_bin(
srcs = ["tsconfig.base.json"],
visibility = ["//visibility:public"],
)

copy_to_bin(
name = "tsconfig.test",
srcs = [
"tsconfig.base.json",
"tsconfig.test.json",
],
visibility = ["//visibility:public"],
)

copy_to_bin(
name = "jest-setup",
srcs = ["jest-setup.js"],
visibility = ["//zilliqa/js/util:__subpackages__"],
)

js_library(
name = "jest_config",
srcs = ["jest.config.js"],
visibility = ["//visibility:public"],
)
20 changes: 20 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ http_archive(
url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v1.6.6.tar.gz",
)

http_archive(
name = "aspect_rules_jest",
sha256 = "6d6303372879579cff3c615d0f53ec1cea8a919ed457ffcd375ef5ac2aaaa0b4",
strip_prefix = "rules_jest-0.11.1",
url = "https://github.com/aspect-build/rules_jest/archive/refs/tags/v0.11.1.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")

rules_js_dependencies()
Expand All @@ -125,6 +132,19 @@ nodejs_register_toolchains(
node_version = DEFAULT_NODE_VERSION,
)

load("@aspect_rules_jest//jest:dependencies.bzl", "rules_jest_dependencies")

rules_jest_dependencies()

# Fetches the npm packages for jest-cli.
load("@aspect_rules_jest//jest:repositories.bzl", "jest_repositories")

jest_repositories(name = "jest")

load("@jest//:npm_repositories.bzl", jest_npm_repositories = "npm_repositories")

jest_npm_repositories()

load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")

npm_translate_lock(
Expand Down
18 changes: 18 additions & 0 deletions jest-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (C) 2018 Zilliqa
//
// This file is part of zilliqa-js
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

// require('jest-fetch-mock').enableMocks();
21 changes: 21 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (C) 2018 Zilliqa
//
// This file is part of zilliqa-js
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const config = {
testMatch: ["<rootDir>/zilliqa/js/**/test/?(*.)+(spec|test).(ts|js)"],
};

module.exports = config;
23 changes: 18 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "protobufjs-project",
"dependencies": {
"protobufjs": "6.11.3",
"long": "5.2.0",
"@jest/expect": "^29.3.1",
"@jest/expect-utils": "^29.3.1",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@types/bip39": "^2.4.0",
"@types/bn.js": "^5.1.0",
"@types/camelcase": "^4.1.0",
"@types/elliptic": "^6.4.14",
"@types/hdkey": "^0.7.0",
"@types/jest": "^29.2.2",
"@types/long": "^4.0.0",
"@types/node": "^12.0.0",
"@types/react": "^17.0.0",
Expand All @@ -20,23 +21,34 @@
"@typescript-eslint/eslint-plugin": "^4.31.1",
"@typescript-eslint/parser": "^4.31.1",
"aes-js": "^3.1.1",
"ansi-styles": "^6.2.1",
"bip39": "^2.5.0",
"bn.js": "^4.11.8",
"buffer-from": "^1.1.2",
"camelcase": "^5.0.0",
"clsx": "^1.2.1",
"cross-fetch": "2.2.5",
"elliptic": "^6.5.0",
"eslint": "^7.32.0",
"expect": "^29.3.1",
"hash.js": "^1.1.5",
"hdkey": "^1.1.0",
"hmac-drbg": "^1.0.1",
"jest": ">=24 <25",
"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",
"jest-get-type": "^29.2.0",
"jest-matcher-utils": "^29.3.1",
"long": "^4.0.0",
"mitt": "^1.1.3",
"mock-socket": "^9.0.2",
"node-fetch": "^3.2.10",
"pbkdf2": "^3.0.16",
"pretty-format": "^29.3.1",
"prism-react-renderer": "^1.3.5",
"protobufjs": "6.11.3",
"rc-steps": "^3.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand All @@ -55,11 +67,12 @@
"scrypt-js": "^3.0.1",
"semver": "^7.3.8",
"sodium-randbytes": "0.14.0",
"source-map": "^0.7.4",
"source-map-support": "^0.5.21",
"style-loader": "^1.0.0",
"styled-components": "^4.3.2",
"tailwindcss": "^3.1.8",
"terser": ">=5.7.1 <5.9.0",
"ts-jest": "^24.0.2",
"ts-loader": "8.0.4",
"tslib": "2.3.1",
"typescript": "^4.1.2",
Expand All @@ -74,8 +87,8 @@
"worker-plugin": "^5.0.1"
},
"devDependencies": {
"@types/node": "18.7.18",
"@types/long": "4.0.2",
"@types/node": "18.7.18",
"@types/protobufjs": "6.0.0"
},
"pnpm": {
Expand Down
Loading

0 comments on commit 7799d8b

Please sign in to comment.