-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: core chain ada & jest * fix: yarn 3.5.0
- Loading branch information
1 parent
5b43668
commit 1fdd7cc
Showing
75 changed files
with
34,613 additions
and
19,359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ __generated__ | |
.DS_Store | ||
.idea/ | ||
.vscode/ | ||
.chat/ | ||
packages/core/src/chains/_x/ | ||
|
||
dist | ||
build-electron | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-3.5.0.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// require('react-native-reanimated').setUpTests(); | ||
|
||
// FIX: ReferenceError: self is not defined | ||
global.self = global.self || global; | ||
|
||
class LocalStorageMock { | ||
constructor() { | ||
this.store = {}; | ||
} | ||
|
||
clear() { | ||
this.store = {}; | ||
} | ||
|
||
getItem(key) { | ||
return this.store[key] || null; | ||
} | ||
|
||
setItem(key, value) { | ||
this.store[key] = String(value); | ||
} | ||
|
||
removeItem(key) { | ||
delete this.store[key]; | ||
} | ||
} | ||
|
||
global.localStorage = new LocalStorageMock(); | ||
global.$$onekeyAppStorage = new LocalStorageMock(); | ||
global.fetch = require('node-fetch'); | ||
global.WebSocket = require('isomorphic-ws'); | ||
|
||
jest.mock('react-native-zip-archive', () => ({ | ||
zip: jest.fn(), | ||
})); | ||
|
||
jest.mock('react-native-file-logger', () => ({ | ||
FileLogger: { | ||
configure: jest.fn(), | ||
write: jest.fn(), | ||
}, | ||
LogLevel: { | ||
Debug: 0, | ||
Info: 1, | ||
Warning: 2, | ||
Error: 3, | ||
}, | ||
})); | ||
|
||
jest.mock('react-native-device-info', () => ({ | ||
getBuildNumber: jest.fn(), | ||
getDeviceId: jest.fn(), | ||
getIncrementalSync: jest.fn(), | ||
getModel: jest.fn(), | ||
getSystemName: jest.fn(), | ||
getSystemVersion: jest.fn(), | ||
getTotalMemorySync: jest.fn(), | ||
getUsedMemorySync: jest.fn(), | ||
})); | ||
|
||
// ** shim TextEncoder | ||
// const { TextEncoder, TextDecoder } = require('util'); | ||
// global.TextEncoder = TextEncoder; | ||
// global.TextDecoder = TextDecoder; | ||
|
||
// ** shim App variables | ||
// require('./packages/app/shim'); | ||
|
||
// ** Array, Buffer, Error | ||
// https://github.com/facebook/jest/issues/2549 | ||
|
||
// ** asm.js support | ||
// Linking failure in asm.js: Unexpected stdlib member | ||
|
||
// ** await import() support | ||
// Error: You need to run with a version of node that supports ES Modules in the VM API. See https://jestjs.io/docs/ecmascript-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// https://jestjs.io/docs/configuration | ||
const { defaults } = require('jest-config'); | ||
const util = require('node:util'); | ||
const exec = util.promisify(require('node:child_process').exec); | ||
|
||
module.exports = async () => { | ||
const { stdout } = await exec('yarn config get cacheFolder'); | ||
const cacheDirectory = stdout.trim().replace('\n', ''); | ||
return { | ||
// ts-jest, react-native, jest-expo, jest-expo/web, | ||
preset: 'jest-expo/web', // require *.web.ts, do not require *.native.ts | ||
coverageProvider: 'v8', | ||
cacheDirectory: `${cacheDirectory}/.app-mono-jest-cache`, | ||
setupFilesAfterEnv: [ | ||
'./jest-setup.js', | ||
'./node_modules/react-native-gesture-handler/jestSetup.js', | ||
], | ||
// buffer type incorrect if use [jsdom] https://github.com/facebook/jest/issues/4422 | ||
// jest-environment-node, node, jsdom | ||
testEnvironment: 'jest-environment-node', | ||
verbose: true, | ||
moduleFileExtensions: [ | ||
...defaults.moduleFileExtensions, | ||
'd.ts', | ||
'jest.ts', // not working | ||
'jest.tsx', | ||
'ts', | ||
'tsx', | ||
], | ||
// 'extensionsToTreatAsEsm': ['.wasm', '.ts'], | ||
// 'globals': { | ||
// 'ts-jest': { | ||
// 'useESM': true, | ||
// }, | ||
// }, | ||
moduleNameMapper: { | ||
// '^(\\.{1,2}/.*/cardano_message_signing_bg\\.wasm\\.js)$': '$1', | ||
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': | ||
'<rootDir>/__mocks__/fileMock.js', | ||
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js', | ||
'@onekeyhq/kit/src/background/instance/backgroundApiProxy': | ||
'<rootDir>/__mocks__/backgroundApiProxyMock.js', | ||
'@emurgo/cardano-serialization-lib-browser': | ||
'@emurgo/cardano-serialization-lib-nodejs', | ||
'@emurgo/cardano-message-signing-browser': | ||
'@emurgo/cardano-message-signing-nodejs', | ||
'\\./adaWebSdk$': | ||
'<rootDir>/packages/core/src/chains/ada/sdkAda/sdk/adaWebSdk.jest.ts', | ||
}, | ||
// TODO unify with transpile modules | ||
transformIgnorePatterns: ['nodo_modules/react-native-reanimated'], | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest', | ||
}, | ||
reporters: [ | ||
'default', | ||
[ | ||
'./node_modules/jest-html-reporter', | ||
{ | ||
'pageTitle': 'Test Report', | ||
}, | ||
], | ||
], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,11 +65,15 @@ | |
"@babel/plugin-proposal-private-methods": "^7.18.6", | ||
"@babel/plugin-proposal-private-property-in-object": "^7.21.11", | ||
"@babel/preset-env": "^7.22.9", | ||
"@emurgo/cardano-message-signing-nodejs": "^1.0.1", | ||
"@emurgo/cardano-serialization-lib-nodejs": "^11.5.0", | ||
"@expo/webpack-config": "^18.1.3", | ||
"@open-wc/webpack-import-meta-loader": "^0.4.7", | ||
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11", | ||
"@tamagui/babel-plugin": "1.71.0", | ||
"@types/chrome": "^0.0.248", | ||
"@types/elliptic": "^6.4.16", | ||
"@types/jest": "^29.5.6", | ||
"@types/lodash": "^4.14.200", | ||
"@types/memoizee": "^0.4.10", | ||
"@types/react": "^18.2.29", | ||
|
@@ -101,6 +105,9 @@ | |
"eslint-plugin-react": "^7.31.11", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"html-webpack-plugin": "^5.5.3", | ||
"jest": "^29.7.0", | ||
"jest-expo": "^49.0.0", | ||
"jest-html-reporter": "^3.10.2", | ||
"node-notifier": "^10.0.1", | ||
"patch-package": "^7.0.0", | ||
"prettier": "^2.8.1", | ||
|
@@ -109,12 +116,17 @@ | |
"react-refresh": "^0.14.0", | ||
"style-loader": "^3.3.3", | ||
"tamagui-loader": "1.71.0", | ||
"ts-jest": "^29.1.1", | ||
"ultra-runner": "^3.10.5", | ||
"webpack": "5.88.2", | ||
"webpack-bundle-analyzer": "^4.9.1", | ||
"webpack-cli": "5.1.4", | ||
"webpack-dev-server": "^4.15.1", | ||
"webpack-manifest-plugin": "^5.0.0", | ||
"webpack-subresource-integrity": "^5.2.0-rc.1" | ||
} | ||
}, | ||
"resolutions": { | ||
"tronweb@^5.1.0": "5.1.0" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
Oops, something went wrong.