Skip to content

Commit

Permalink
tests now work (required resolutions of quick-lru)
Browse files Browse the repository at this point in the history
  • Loading branch information
arietrouw committed Nov 17, 2023
1 parent c7f36ee commit 5beaa27
Show file tree
Hide file tree
Showing 103 changed files with 428 additions and 400 deletions.
6 changes: 4 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ const generateJestConfig = ({ esModules }: { esModules: string[] }) => {
const esModulesList = Array.isArray(esModules) ? esModules.join('|') : esModules
return {
coveragePathIgnorePatterns: ['<rootDir>/(.*)/dist'],
globalSetup: './jestSetup/globalSetup.ts',
globalTeardown: './jestSetup/globalTeardown.ts',
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
preset: 'ts-jest/presets/default-esm',
setupFiles: ['dotenv/config'],
setupFilesAfterEnv: ['jest-sorted', 'jest-extended/all'],
setupFilesAfterEnv: ['jest-sorted', 'jest-extended/all', './jestSetup/setupFiles.ts'],
testRegex: '(/__tests__/.*|(\\.|/)((!perf\\.)test|spec))\\.tsx?$',
testTimeout: 200000,
transform: {
Expand All @@ -23,7 +25,7 @@ const generateJestConfig = ({ esModules }: { esModules: string[] }) => {
}
}

const config = generateJestConfig({ esModules: ['is-ip', 'ip-regex', 'lodash-es', 'uuid', 'lodash-es'] })
const config = generateJestConfig({ esModules: ['is-ip', 'ip-regex', 'lodash-es', 'uuid', 'lodash-es', 'quick-lru'] })

// eslint-disable-next-line import/no-default-export
export default config
16 changes: 16 additions & 0 deletions jestSetup/globalSetup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable no-var */
import { config } from 'dotenv'
config()
import { Config } from 'jest'
import { SuperTest, Test } from 'supertest'

// Augment global scope with shared variables (must be var)
declare global {
var req: SuperTest<Test>
}

/**
* Jest global setup method runs before any tests are run
* https://jestjs.io/docs/configuration#globalsetup-string
*/
module.exports = async (_globalConfig: Config, _projectConfig: Config) => {}
11 changes: 11 additions & 0 deletions jestSetup/globalTeardown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { config } from 'dotenv'
config()
import { Config } from 'jest'

/**
* Jest global teardown method runs after all tests are run
* https://jestjs.io/docs/configuration#globalteardown-string
*/
module.exports = async (_globalConfig: Config, _projectConfig: Config) => {

}
10 changes: 10 additions & 0 deletions jestSetup/setupFiles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ForgetPromise } from '@xylabs/forget'

beforeAll(() => {
// Can be async, before each test file
})

afterAll(async () => {
// Can be async, after each test file
await ForgetPromise.awaitInactive()
})
3 changes: 3 additions & 0 deletions jestSetup/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@xylabs/tsconfig-jest"
}
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"resolutions": {
"axios": "^1",
"bn.js": "^5",
"quick-lru": "^5"
},
"description": "Typescript/Javascript Plugins for XYO Platform",
"exports": {
".": {
"browser": {
Expand Down
6 changes: 3 additions & 3 deletions packages/payload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/address-payload-plugin": "workspace:~",
Expand All @@ -28,7 +28,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -64,7 +64,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions packages/payload/packages/address/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/payload-model": "^2.79.8",
Expand All @@ -18,7 +18,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -54,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions packages/payload/packages/blockchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/ethereum-blockchain-payload-plugins": "workspace:~",
Expand All @@ -18,7 +18,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -54,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/gas-ethereum-blockchain-payload-plugins": "workspace:~",
Expand All @@ -18,7 +18,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -54,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/etherchain-gas-ethereum-blockchain-payload-plugins": "workspace:~",
Expand All @@ -19,7 +19,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -55,7 +55,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/payload-model": "^2.79.8",
Expand All @@ -18,7 +18,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -54,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/etherchain-ethereum-gas-v2-payload-plugin": "workspace:~",
Expand All @@ -18,7 +18,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -54,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/payload-model": "^2.79.8",
Expand All @@ -18,7 +18,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -54,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/payload-model": "^2.79.8",
Expand All @@ -18,7 +18,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -54,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/payload-model": "^2.79.8",
Expand All @@ -18,7 +18,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -54,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"bugs": {
"email": "support@xyo.network",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
"url": "https://github.com/XYOracleNetwork/plugins/issues"
},
"dependencies": {
"@xyo-network/payload-model": "^2.79.8",
Expand All @@ -18,7 +18,7 @@
"@xylabs/tsconfig": "^3.1.21",
"typescript": "^5.2.2"
},
"description": "Primary SDK for using XYO Protocol 2.0",
"description": "Typescript/Javascript Plugins for XYO Platform",
"docs": "dist/docs.json",
"exports": {
".": {
Expand Down Expand Up @@ -54,7 +54,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
"url": "https://github.com/XYOracleNetwork/plugins.git"
},
"sideEffects": false,
"types": "dist/node/index.d.ts",
Expand Down
Loading

0 comments on commit 5beaa27

Please sign in to comment.