From 3c0750e1d4aa4352e32da5bfd63f89117cdd529c Mon Sep 17 00:00:00 2001 From: Coby Date: Wed, 20 Nov 2024 19:01:47 -0500 Subject: [PATCH] rebasing --- package.json | 2 +- run-tests.sh | 11 +++++++++++ src/db/sql/events-actions/queries.ts | 2 +- tests/resolvers.test.ts | 12 +++++++++++- 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100755 run-tests.sh diff --git a/package.json b/package.json index ee4ba94..ed0074b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "build": "npm run clean && npx tsc", "start": "node build/src/index.js", "dev": "cross-env NODE_NO_WARNINGS=1 npx nodemon src/index.ts", - "test": "npx tsc && for testfile in $(find build/tests -type f -name '*.test.js'); do node $testfile; done", + "test": "./run-tests.sh", "clean": "rimraf ./build", "gen-test-mocks": "cross-env NODE_NO_WARNINGS=1 node --loader ts-node/esm tests/mocked_sql/generate_mock_data.ts", "benchmark": "cross-env NODE_NO_WARNINGS=1 node --loader ts-node/esm benchmark/setup.ts && npx artillery run benchmark/graphql.yaml --output benchmark/report.json", diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 0000000..e727545 --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -e +shopt -s globstar # to expand '**' into nested directories./ + +npm run build + +# find all unit tests in build and run them +for f in ./build/**/*test.js; do + echo "Running $f" + node --enable-source-maps --stack-trace-limit=1000 --test $f; +done diff --git a/src/db/sql/events-actions/queries.ts b/src/db/sql/events-actions/queries.ts index 5b0823f..c425869 100644 --- a/src/db/sql/events-actions/queries.ts +++ b/src/db/sql/events-actions/queries.ts @@ -137,7 +137,7 @@ function emittedEventsCTE(db_client: postgres.Sql) { *, zke.id AS zkapp_event_id, zkf.id AS zkapp_event_element_id, - zkfa.element_ids AS zkapp_event_element_ids, + zke.element_ids AS zkapp_event_element_ids, zkfa.id AS zkapp_event_array_id FROM emitted_zkapp_commands diff --git a/tests/resolvers.test.ts b/tests/resolvers.test.ts index 75bf00f..6d55376 100644 --- a/tests/resolvers.test.ts +++ b/tests/resolvers.test.ts @@ -116,7 +116,17 @@ describe('Query Resolvers', async () => { } }); - after(async () => { + after(() => { + process.on('uncaughtException', (err) => { + console.error('Uncaught exception:', err); + process.exit(1); + }); + + process.on('unhandledRejection', (reason, promise) => { + console.error('Unhandled rejection at:', promise, 'reason:', reason); + process.exit(1); + }); + process.exit(0); });