-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jest works terribly with ESM, needing its own weird setup for TS, module name remapping and so on. Native test runner looks mature enough, and even module mocks work fairly well. Using native `assert` instead of jest's `expect` was a pain in the ass, so opted for using modern assertion library `earl` instead. * Importing JSONs from root works not as good, so moved config schema inside the sources * Moved codegen from `postinstall` to `codegen` script, so it could be separately from install; needed for docker build, where `yarn install` is called before `COPY src` * Yarn upgrade also solved some issue down the road * Adding `.js` to all imports is a ESM requirement (even if it's originally `.ts` files) * mockHelpers.ts will probably be moved to `@eng-automation/testing`
- Loading branch information
1 parent
20f2614
commit d542bfe
Showing
44 changed files
with
1,656 additions
and
3,027 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
data | ||
build | ||
test | ||
test | ||
src/configSchema.ts |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
yarnPath: .yarn/releases/yarn-4.3.0.cjs | ||
nodeLinker: node-modules | ||
|
||
yarnPath: .yarn/releases/yarn-4.6.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 was deleted.
Oops, something went wrong.
This file was deleted.
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 |
---|---|---|
|
@@ -4,24 +4,24 @@ | |
"description": "", | ||
"main": "build/start.js", | ||
"scripts": { | ||
"build": "tsc", | ||
"build": "tsc && cp package.json build/", | ||
"build:docker": "docker build -t polkadot-testnet-faucet .", | ||
"dev": "concurrently \"tsc -w\" \"node --watch -r dotenv/config ./build/src/start.js\"", | ||
"dev:db": "docker run -e 'POSTGRESQL_EXTRA_FLAGS=-c log_statement=all' -e 'POSTGRESQL_PASSWORD=postgres' -e 'POSTGRESQL_DATABASE=faucet' -v \"$(pwd)/data:/bitnami/postgresql\" -p 5432:5432 bitnami/postgresql:15", | ||
"fix": "yarn lint:fix && yarn format:fix", | ||
"format": "npx prettier ./src ./client/src ./client/tests --check", | ||
"format:fix": "npx prettier ./src ./client/src ./client/tests --write", | ||
"generate:papi": "papi generate", | ||
"generate:types": "echo \"declare const schema: $(cat env.faucet.config.json); export default schema;\" > env.faucet.config.json.d.ts", | ||
"generate:types": "echo \"export const schema = $(cat env.faucet.config.json) as const;\" > src/configSchema.ts", | ||
"lint": "npx eslint ./src/ ./client/src ./client/tests --ext .js,.ts,.svelte", | ||
"lint:fix": "npx eslint ./src/ ./client/src ./client/tests --ext .js,.ts,.svelte --fix", | ||
"migrations:generate": "typeorm migration:generate -d build/src/db/dataSource.js", | ||
"migrations:run": "typeorm migration:run -d build/src/db/dataSource.js", | ||
"postinstall": "yarn generate:types && yarn generate:papi", | ||
"codegen": "yarn generate:types && yarn generate:papi", | ||
"start": "node ./build/src/start.js", | ||
"e2e:zombienet": "rm -rf e2e/zombienet && npx --yes @zombienet/[email protected] --provider native --dir e2e/zombienet spawn e2e/zombienet.native.toml", | ||
"test": "jest", | ||
"test:e2e": "jest -c jest.e2e.config.js --runInBand --forceExit", | ||
"test": "node --experimental-test-module-mocks --loader ts-node/esm --import ./src/test/setup.unit.ts --test ./src/**/*.test.ts", | ||
"test:e2e": "node --test --loader ts-node/esm ./src/faucet.e2e.ts", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"imports": { | ||
|
@@ -64,7 +64,7 @@ | |
"confmgr": "^1.0.8", | ||
"cors": "^2.8.5", | ||
"express": "4.19.2", | ||
"matrix-js-sdk": "^26.1.0", | ||
"matrix-js-sdk": "^35.1.0", | ||
"pg": "^8.11.2", | ||
"polkadot-api": "^1.6.5", | ||
"prom-client": "^14.2.0", | ||
|
@@ -77,24 +77,24 @@ | |
"@eng-automation/testing": "^1.5.1", | ||
"@types/body-parser": "^1.19.2", | ||
"@types/express": "^4.17.13", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20", | ||
"@types/node": "^22.10.5", | ||
"@types/request": "^2.48.8", | ||
"@types/supertest": "^2.0.12", | ||
"concurrently": "^8.2.2", | ||
"earl": "^1.3.0", | ||
"eslint-plugin-security": "^1.5.0", | ||
"jest": "^29.7.0", | ||
"joi": "^17.13.1", | ||
"lint-staged": "^12.3.8", | ||
"rxjs": "^7.8.1", | ||
"simple-git-hooks": "^2.7.0", | ||
"supertest": "^6.3.3", | ||
"testcontainers": "v10.8.1", | ||
"ts-jest": "^29.1.4", | ||
"testcontainers": "^10.16.0", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.4.5" | ||
}, | ||
"type": "module", | ||
"engines": { | ||
"node": "^22" | ||
}, | ||
"packageManager": "yarn@4.3.0" | ||
"packageManager": "yarn@4.6.0" | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { Initial1692350473907 } from "./1692350473907-initial"; | ||
import { Initial1692350473907 } from "./1692350473907-initial.js"; | ||
|
||
export const migrations = [Initial1692350473907]; |
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
Oops, something went wrong.