Skip to content

Commit

Permalink
refactor: tests (#301)
Browse files Browse the repository at this point in the history
* fix: save

* fix: save

* fix: save

* fix: save

* fix: save again

* fix: more

* fix: run on main

* fix: skip test for now

* fix: add marketing endpoints

* fix: fixes

* fix: fix

* fix: attempt to fix test

* fix: test

* fix: set build to pass again

* fix: build

* fix: fix test

* fix: fix

* fix: fix

* fix: fix
  • Loading branch information
cgilbe27 authored Feb 5, 2024
1 parent d6a053a commit e14b83b
Show file tree
Hide file tree
Showing 75 changed files with 1,185 additions and 941 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

16 changes: 0 additions & 16 deletions .eslintrc.js

This file was deleted.

16 changes: 16 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"env": {
"browser": true,
"es6": true,
"node": true,
"jest/globals": true
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "jest", "prettier"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
]
}
28 changes: 20 additions & 8 deletions .github/workflows/test-ts-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,27 @@ jobs:
with:
cmd: build

- name: Run Nibiru network in the background (scripts/localnet.sh)
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: nibibot
password: ${{ secrets.NIBIBOT_GIT_TOKEN }}

- name: Checkout nibiru Repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
repository: NibiruChain/nibiru
ref: main
path: "nibiru"
token: ${{ secrets.NIBIBOT_GIT_TOKEN }}

- name: Run Nibiru network in the background
run: |
# Install nibid CLI
# Use https://get.nibiru.fi/ to get the most recent release.
curl -s https://get.nibiru.fi/@v0.21.9! | bash
# Sanity check nibid CLI
nibid version
# Start local network
bash scripts/localnet.sh &
cd nibiru
make chaosnet
cd ..
- name: yarn test
uses: borales/actions-yarn@v4
Expand Down
4 changes: 0 additions & 4 deletions .prettierrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": false,
"endOfLine": "lf"
}
36 changes: 13 additions & 23 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,27 @@ const config: Config = {
verbose: true,
collectCoverage: true,
collectCoverageFrom: [
"src/**/*.{js,jsx,ts,tsx}",
"**/*.{js,jsx,ts,tsx}",
"!**/docs/**",
"!**/node_modules/**",
"!**/coverage/**",
"!**/dist/**",
"!**/nibiru/**",
"!**/index.*.ts",
"!**/index.ts",
"!**/src/protojs/**",
"!jest.config.ts",
"!**/src/gql/utils/generated.ts",
"!**/src/sdk/utils/testutil.ts",
],
coveragePathIgnorePatterns: [
"/docs/",
"/node_modules/",
"/build/",
"/coverage/",
"/dist/",
"/src/protojs/",
"/nibiru",
],
testPathIgnorePatterns: [
"/docs/",
"/node_modules/",
"/build/",
"/coverage/",
"/dist/",
"/src/protojs/",
"/nibiru",
],
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
coverageReporters: ["json-summary", "text", "html", "lcov"],
coverageThreshold: {
global: {
branches: 75,
functions: 75,
lines: 75,
statements: 75,
branches: 85,
functions: 85,
lines: 85,
statements: 85,
},
},
globals: {
Expand Down
45 changes: 20 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
"dist"
],
"scripts": {
"generate-barrels": "barrelsby -c barrelsby.json --delete -l all -s flat -S -e \".test.ts|.config.ts|.codegen.ts\"",
"generate-barrels": "barrelsby -c barrelsby.json --delete -l all -S -e \".test.ts|.config.ts|.codegen.ts\"",
"build": "bash ./scripts/build.sh",
"build:tsc": "rm -rf dist && tsc --build",
"build:watch": "tsc --build --watch",
"docgen": "yarn run typedoc --tsconfig tsconfig.json --plugin typedoc-plugin-markdown --plugin typedoc-plugin-missing-exports",
"docgen:changes": "git diff-index --name-only origin/HEAD -- | grep -q \"src\" && yarn docgen || true",
"clean": "tsc --clean",
"commit": "cz",
"gql-generate": "graphql-code-generator --config codegen.ts",
"gql-generate": "graphql-code-generator --config ./src/gql/graphql-codegen/codegen.ts",
"test": "jest",
"test:verbose": "jest --verbose --detectOpenHandles",
"test:watch": "jest --watch",
"coverage": "jest --coverage",
"lint": "eslint -c './.eslintrc.js' './**/*.{ts,js}'",
"lint": "eslint -c .eslintrc.json './**/*.{ts,js}'",
"lint:ci": "yarn lint . --format junit",
"lint:md": "markdownlint --ignore node_modules --ignore .git",
"localnet": "bash scripts/localnet.sh",
Expand All @@ -35,19 +35,8 @@
"proto-gen": "bash ./scripts/protocgen.sh",
"prettier": "prettier --write . --ignore-path .gitignore",
"eslint": "eslint --fix . --ignore-path .gitignore",
"prepare": "husky install",
"semantic-release": "semantic-release"
},
"lint-staged": {
"*.{js,ts}": [
"eslint --fix",
"prettier --write . --ignore-path .gitignore",
"git add ."
],
"*.json": [
"prettier --write . --ignore-path .gitignore",
"git add ."
]
"semantic-release": "semantic-release",
"prepare": "husky install"
},
"dependencies": {
"@cosmjs/cosmwasm-stargate": "^0.31.0",
Expand All @@ -56,8 +45,7 @@
"@cosmjs/tendermint-rpc": "^0.31.0",
"bignumber.js": "^9.1.1",
"cross-fetch": "4.0.0",
"graphql-ws": "^5.14.0",
"long": "^5.2.0"
"graphql-ws": "^5.14.0"
},
"peerDependencies": {
"@cosmjs/cosmwasm-stargate": "^0.31.0",
Expand All @@ -72,18 +60,15 @@
"@graphql-codegen/cli": "^4.0.1",
"@graphql-codegen/client-preset": "^4.0.1",
"@graphql-codegen/typescript": "^4.0.1",
"@keplr-wallet/types": "^0.12.12",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@types/jest": "^29.1.2",
"@types/long": "^4.0.0",
"@types/node": "^16.11.7",
"@types/node-fetch": "^2.6.2",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.30.7",
"barrelsby": "^2.8.1",
"commitizen": "^4.2.4",
"cosmjs-types": "^0.8.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.5.0",
Expand All @@ -92,12 +77,11 @@
"graphql": "^16.7.1",
"husky": "^7.0.2",
"jest": "^29.0.0",
"jest-junit": "^12.2.0",
"lint-staged": "^13.2.2",
"long": "^5.2.0",
"markdownlint-cli": "^0.28.1",
"prettier": "^2.4.1",
"semantic-release": "19.0.5",
"semantic-release-monorepo": "^7.0.5",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typedoc": "^0.24.8",
Expand All @@ -106,6 +90,17 @@
"typescript": "^4.4.3",
"ws": "^8.14.1"
},
"lint-staged": {
"*.{js,ts}": [
"eslint --fix . --ignore-path .gitignore",
"prettier --write . --ignore-path .gitignore",
"git add ."
],
"*.json": [
"prettier --write . --ignore-path .gitignore",
"git add ."
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
Expand All @@ -116,10 +111,10 @@
"tag": "latest",
"access": "public"
},
"gitHead": "bac1729be8575a9e75bf9e04447a63c45e227c8c",
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
}
},
"gitHead": "bac1729be8575a9e75bf9e04447a63c45e227c8c"
}
Loading

0 comments on commit e14b83b

Please sign in to comment.