Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@ jobs:

- name: Test
run: |
cd packages/core && yarn test

- name: Test React Lite
run: |
cd packages/react-lite && yarn test
npx --yes lerna@7 run test -- --passWithNoTests
10 changes: 5 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@
"@chain-registry/client": "^1.49.11",
"@chain-registry/keplr": "^1.69.13",
"@chain-registry/types": "^0.46.11",
"@cosmjs/amino": "^0.32.3",
"@cosmjs/cosmwasm-stargate": "^0.32.3",
"@cosmjs/proto-signing": "^0.32.3",
"@cosmjs/stargate": "^0.32.3",
"@cosmjs/amino": "^0.36.2",
"@cosmjs/cosmwasm-stargate": "^0.36.2",
"@cosmjs/proto-signing": "^0.36.2",
"@cosmjs/stargate": "^0.36.2",
"@dao-dao/cosmiframe": "^1.0.0",
"@walletconnect/types": "2.11.0",
"bowser": "2.11.0",
"cosmjs-types": "^0.9.0",
"cosmjs-types": "^0.10.1",
"events": "3.3.0",
"nock": "13.5.4",
"uuid": "^9.0.1"
Expand Down
3 changes: 3 additions & 0 deletions packages/cosmos-kit/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
*/

module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',

// All imported modules in your tests should be mocked automatically
// automock: false,

Expand Down
21 changes: 21 additions & 0 deletions packages/ins/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
babelConfig: false,
tsconfig: 'tsconfig.json',
},
],
},
transformIgnorePatterns: [
'node_modules/(?!(chain-registry)/)',
],
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testPathIgnorePatterns: ['cjs/*', 'esm/*'],
modulePathIgnorePatterns: ['cjs/*', 'esm/*'],
};
5 changes: 0 additions & 5 deletions packages/ins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@
"bugs": {
"url": "https://github.com/hyperweb-io/cosmos-kit/issues"
},
"jest": {
"testPathIgnorePatterns": [
"dist/"
]
},
"dependencies": {
"@babel/runtime": "7.11.2"
}
Expand Down
14 changes: 7 additions & 7 deletions packages/ins/src/name-service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Chains } from '@chain-registry/types';
import { Chain } from '@chain-registry/types';
import { CosmWasmClient } from '@cosmjs/cosmwasm-stargate';

export type NameServiceName = string;
Expand All @@ -18,10 +18,10 @@ export type NameServiceRegistry = NameServiceInfo[];

export type ParsedInsName =
| {
name: string;
resolver: string;
nameservice: string;
}
name: string;
resolver: string;
nameservice: string;
}
| undefined;

/**
Expand All @@ -44,13 +44,13 @@ export const parseINSName = (name: string): ParsedInsName => {
* @Module INS
*/
export class INS {
chains: Chains;
chains: Chain[];
ins_registry: NameServiceRegistry;

/**
* This class is used to resolve names and addresses.
*/
constructor(chains: Chains, ins_registry: NameServiceRegistry) {
constructor(chains: Chain[], ins_registry: NameServiceRegistry) {
this.chains = chains;
this.ins_registry = ins_registry;
}
Expand Down
1 change: 0 additions & 1 deletion packages/react-lite/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
const path = require('path');
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
Expand Down
6 changes: 6 additions & 0 deletions packages/react-lite/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// adds polyfill for TextEncoder/TextDecoder because jsdom doesn't support them
// https://github.com/jsdom/jsdom/issues/2524
const { TextEncoder, TextDecoder } = require('util');
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you think this addition is needed? TextEncoder is widely adopted for a long time. Would be really strange if your JS envirnment does not have it.

https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I know. I use [email protected] but probably the issue is in jest env. Tests failed with the error that this stuff is not available

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll double check a bit later whether the issue is in env. Because jsdom doesn’t even provide fetch api which is also widely available.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I am not at all familiar with those. But I think we should adapt the comment a bit to highlight where the limitation is (and when we can remove the polyfill).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related issue in jsdom-> jsdom/jsdom#2524


Object.setPrototypeOf(window, {
keplr: {
enable: () => Promise.resolve(),
Expand Down
2 changes: 1 addition & 1 deletion packages/walletconnect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@
]
},
"dependencies": {
"@cosmjs/proto-signing": "^0.32.3",
"@cosmos-kit/core": "^2.16.6",
"@walletconnect/sign-client": "^2.9.0",
"@walletconnect/utils": "^2.9.0",
"events": "3.3.0"
},
"peerDependencies": {
"@cosmjs/amino": ">=0.32.3",
"@cosmjs/proto-signing": ">=0.32.3",
"@walletconnect/types": "2.11.0"
}
}
2 changes: 1 addition & 1 deletion wallets/bitgetwallet-extension/src/extension/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getBitgetwalletFromExtension: () => Promise<
return void 0;
}

const bitgetWallet = (window as BitgetwalletWindow).bitgetWallet.keplr;
const bitgetWallet = (window as unknown as BitgetwalletWindow).bitgetWallet.keplr;

if (bitgetWallet) {
return bitgetWallet;
Expand Down
6 changes: 3 additions & 3 deletions wallets/cosmos-extension-metamask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
"dependencies": {
"@chain-registry/keplr": "^1.69.13",
"@cosmos-kit/core": "^2.16.6",
"@cosmsnap/snapper": "^0.2.5",
"cosmjs-types": ">=0.9.0"
"@cosmsnap/snapper": "^0.2.5"
},
"peerDependencies": {
"@cosmjs/amino": ">=0.32.3",
"@cosmjs/proto-signing": ">=0.32.3"
"@cosmjs/proto-signing": ">=0.32.3",
"cosmjs-types": ">=0.9.0"
}
}
6 changes: 3 additions & 3 deletions wallets/cosmostation-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
},
"dependencies": {
"@chain-registry/cosmostation": "^1.67.13",
"@cosmos-kit/core": "^2.16.6",
"cosmjs-types": "^0.9.0"
"@cosmos-kit/core": "^2.16.6"
},
"peerDependencies": {
"@cosmjs/amino": ">=0.32.3",
"@cosmjs/proto-signing": ">=0.32.3"
"@cosmjs/proto-signing": ">=0.32.3",
"cosmjs-types": ">=0.9.0"
}
}
2 changes: 1 addition & 1 deletion wallets/tailwind-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@cosmos-kit/core": "^2.16.6"
},
"devDependencies": {
"@cosmjs/proto-signing": "^0.32.3",
"@cosmjs/proto-signing": ">=0.32.3",
"@tailwindzone/connect": "^1.1.0"
}
}
Loading