Skip to content

Instantly share code, notes, and snippets.

@tgmarinho
Created October 17, 2025 20:32
Show Gist options
  • Save tgmarinho/08ed0ade7d20cf5b6480a24792be9fa5 to your computer and use it in GitHub Desktop.
Save tgmarinho/08ed0ade7d20cf5b6480a24792be9fa5 to your computer and use it in GitHub Desktop.
~/D/p/d/Switch_Monorepo on SWTC-2764 pnpm test 16:25:58
> @switch/monorepo@ test /Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo
> turbo run test
turbo 2.3.1
• Packages in scope: @switch/api, @switch/frontend, @switch/types
• Running test in 3 packages
• Remote caching disabled
@switch/api:test: cache miss, executing e1b310e70f0018cc
@switch/frontend:test: cache miss, executing 949e40afc7d5b200
@switch/api:test:
@switch/frontend:test:
@switch/api:test:
@switch/api:test: > @switch/[email protected] test /Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api
@switch/api:test: > jest
@switch/api:test:
@switch/frontend:test:
@switch/frontend:test: > @switch/[email protected] test /Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/frontend
@switch/frontend:test: > jest
@switch/frontend:test:
PASS src/test/unit/factories.test.ts
@switch/api:test: factories
@switch/api:test: ✓ buildUser returns minimal valid user fields (3 ms)
@switch/api:test: ✓ buildOrganization returns minimal valid org fields
@switch/api:test: ✓ buildFacility returns minimal valid facility fields
@switch/api:test: ✓ buildList builds the requested number of items (1 ms)
@switch/api:test: ✓ buildProviderUser returns user and providerDetail
@switch/api:test: ✓ buildAdminUser sets is_admin true (1 ms)
@switch/api:test: ✓ buildFacilityUser returns ids
@switch/api:test: ✓ buildPermission returns valid permission shape
@switch/api:test: ✓ buildCertification returns name
@switch/api:test: ✓ buildShift returns minimal valid fields
@switch/api:test: ✓ buildShiftInstance returns minimal valid fields (1 ms)
@switch/api:test: ✓ buildShiftBid returns minimal valid fields
@switch/api:test: ✓ buildTimecard returns minimal valid fields
@switch/api:test: ✓ buildNotification returns minimal valid fields
@switch/api:test: ✓ buildUserModule returns minimal valid fields
@switch/api:test: ✓ buildOrganizationUser returns minimal valid fields
@switch/api:test: ✓ buildShiftTimecode returns minimal valid fields (5 ms)
@switch/api:test:
@switch/api:test: PASS src/test/unit/utils/s3.test.ts
@switch/api:test: s3.getS3Link
@switch/api:test: ✓ returns dev/localhost URL when NODE_ENV is development (61 ms)
@switch/api:test: ✓ returns dev/localhost URL when NODE_ENV is localhost (2 ms)
@switch/api:test: ✓ returns UAT URL when NODE_ENV is uat (2 ms)
@switch/api:test: ✓ returns production URL when NODE_ENV is production (3 ms)
@switch/api:test:
@switch/api:test: PASS src/test/unit/utils/helperFunctions.test.ts
@switch/api:test: helperFunctions
@switch/api:test: isEmptyString
@switch/api:test: ✓ returns true for undefined and empty string (7 ms)
@switch/api:test: ✓ returns false for non-empty values
@switch/api:test: getOrderTypeByNumber
@switch/api:test: ✓ defaults to DESC for null/undefined
@switch/api:test: ✓ returns 'DESC' for '0' and 'ASC' otherwise (1 ms)
@switch/api:test: daylightSavingHour
@switch/api:test: ✓ returns -1 when end offset < start offset (spring forward)
@switch/api:test: ✓ returns 1 when end offset > start offset (fall back)
@switch/api:test: ✓ returns 0 when offsets are equal
@switch/api:test: ✓ throws for invalid timezone string (11 ms)
@switch/api:test: ✓ throws for invalid timezone id
@switch/api:test:
@switch/api:test: PASS src/test/unit/middlewares/auth.middleware.test.ts
@switch/api:test: auth middleware
@switch/api:test: ✓ configures express-jwt for required and optional with correct options (33 ms)
@switch/api:test: ✓ apiKeyAuth rejects when missing api key (3 ms)
@switch/api:test: ✓ apiKeyAuth rejects invalid api key (2 ms)
@switch/api:test: ✓ apiKeyAuth calls next when api key is valid (1 ms)
@switch/api:test:
@switch/api:test: console.error
@switch/api:test: Failed to convert HEIC/HEIF to JPEG: Error: boom
@switch/api:test: at /Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api/src/test/unit/utils/imageConverter.test.ts:82:41
@switch/api:test: at Generator.next (<anonymous>)
@switch/api:test: at /Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api/src/test/unit/utils/imageConverter.test.ts:8:71
@switch/api:test: at new Promise (<anonymous>)
@switch/api:test: at Object.<anonymous>.__awaiter (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api/src/test/unit/utils/imageConverter.test.ts:4:12)
@switch/api:test: at Object.<anonymous> (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api/src/test/unit/utils/imageConverter.test.ts:80:70)est:
@switch/api:test: at Promise.then.completed (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/utils.js:298:28)h/api:test:
@switch/api:test: at new Promise (<anonymous>)
@switch/api:test: at callAsyncCircusFn (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/utils.js:231:10)switch/api:test:
@switch/api:test: at _callCircusTest (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:316:40)
@switch/api:test: at processTicksAndRejections (node:internal/process/task_queues:105:5)
@switch/api:test: at _runTest (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:252:3)
@switch/api:test: at _runTestsForDescribeBlock (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:126:9)
@switch/api:test: at _runTestsForDescribeBlock (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:121:9)
@switch/api:test: at _runTestsForDescribeBlock (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:121:9)
@switch/api:test: at run (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:71:3)
@switch/api:test: at runAndTransformResultsToJestFormat (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
@switch/api:test: at jestAdapter (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
@switch/api:test: at runTestInternal (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-runner/build/runTest.js:367:16)
@switch/api:test: at runTest (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-runner/build/runTest.js:444:34)
@switch/api:test: at Object.worker (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-runner/build/testWorker.js:108:12)
@switch/api:test:
@switch/api:test: 31 | return jpegBuffer
@switch/api:test: 32 | } catch (error) {
@switch/api:test: > 33 | console.error('Failed to convert HEIC/HEIF to JPEG:', error)
@switch/api:test: | ^
@switch/api:test: 34 | throw new Error('Failed to convert HEIC/HEIF to JPEG')
@switch/api:test: 35 | }
@switch/api:test: 36 | }
@switch/api:test:
@switch/api:test: at utils/imageConverter.ts:33:13
@switch/api:test: at Generator.throw (<anonymous>)
@switch/api:test: at rejected (utils/imageConverter.ts:6:65)
@switch/api:test:
@switch/api:test: PASS src/test/unit/app/routes/common/auth/token.utils.test.ts
@switch/api:test: token.utils generateToken
@switch/api:test: ✓ signs payload, upserts token, and returns access object (13 ms)
@switch/api:test: ✓ supports missing optional fields (2 ms)
@switch/api:test:
@switch/api:test: console.error
@switch/api:test: Failed to convert HEIC/HEIF to JPEG: Error: fail
@switch/api:test: at /Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api/src/test/unit/utils/imageConverter.test.ts:123:41
@switch/api:test: at Generator.next (<anonymous>)
@switch/api:test: at /Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api/src/test/unit/utils/imageConverter.test.ts:8:71
@switch/api:test: at new Promise (<anonymous>)
@switch/api:test: at Object.<anonymous>.__awaiter (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api/src/test/unit/utils/imageConverter.test.ts:4:12)
@switch/api:test: at Object.<anonymous> (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api/src/test/unit/utils/imageConverter.test.ts:119:64)st:
@switch/api:test: at Promise.then.completed (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/utils.js:298:28)h/api:test:
@switch/api:test: at new Promise (<anonymous>)
@switch/api:test: at callAsyncCircusFn (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/utils.js:231:10)switch/api:test:
@switch/api:test: at _callCircusTest (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:316:40)
@switch/api:test: at processTicksAndRejections (node:internal/process/task_queues:105:5)
@switch/api:test: at _runTest (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:252:3)
@switch/api:test: at _runTestsForDescribeBlock (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:126:9)
@switch/api:test: at _runTestsForDescribeBlock (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:121:9)
@switch/api:test: at _runTestsForDescribeBlock (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:121:9)
@switch/api:test: at run (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/run.js:71:3)
@switch/api:test: at runAndTransformResultsToJestFormat (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
@switch/api:test: at jestAdapter (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
@switch/api:test: at runTestInternal (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-runner/build/runTest.js:367:16)
@switch/api:test: at runTest (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-runner/build/runTest.js:444:34)
@switch/api:test: at Object.worker (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/node_modules/jest-runner/build/testWorker.js:108:12)
@switch/api:test:
@switch/api:test: 31 | return jpegBuffer
@switch/api:test: 32 | } catch (error) {
@switch/api:test: > 33 | console.error('Failed to convert HEIC/HEIF to JPEG:', error)
@switch/api:test: | ^
@switch/api:test: 34 | throw new Error('Failed to convert HEIC/HEIF to JPEG')
@switch/api:test: 35 | }
@switch/api:test: 36 | }
@switch/api:test:
@switch/api:test: at utils/imageConverter.ts:33:13
@switch/api:test: at Generator.throw (<anonymous>)
@switch/api:test: at rejected (utils/imageConverter.ts:6:65)
@switch/api:test:
@switch/api:test: PASS src/test/unit/utils/apiResponse.test.ts
@switch/api:test: apiResponse
@switch/api:test: ✓ returns defaults when no args provided
@switch/api:test: ✓ includes message when provided
@switch/api:test: ✓ uses provided data and code
@switch/api:test:
@switch/api:test: console.log
@switch/api:test: HEIC error Error: Failed to convert HEIC/HEIF to JPEG
@switch/api:test: at /Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api/src/utils/imageConverter.ts:34:11
@switch/api:test: at Generator.throw (<anonymous>)
@switch/api:test: at rejected (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api/src/utils/imageConverter.ts:6:65)
@switch/api:test: at processTicksAndRejections (node:internal/process/task_queues:105:5)
@switch/api:test:
@switch/api:test: at utils/imageConverter.ts:54:15
@switch/api:test: at Generator.throw (<anonymous>)
@switch/api:test:
@switch/api:test: PASS src/test/unit/utils/imageConverter.test.ts
@switch/api:test: imageConverter
@switch/api:test: isHeicExtension
@switch/api:test: ✓ detects heic/heif case-insensitively (24 ms)
@switch/api:test: ✓ returns false for non-heic extensions
@switch/api:test: isHeicBuffer
@switch/api:test: ✓ returns true for HEIC brands (heic, heif, mif1, msf1) (1 ms)
@switch/api:test: ✓ returns false for other brands
@switch/api:test: ✓ returns false when signature is not ftyp
@switch/api:test: convertHeicToJpeg
@switch/api:test: ✓ returns Buffer when underlying converter resolves a Buffer (1 ms)
@switch/api:test: ✓ converts ArrayBuffer output into Buffer
@switch/api:test: ✓ throws with friendly error when converter fails (97 ms)
@switch/api:test: processImageBuffer
@switch/api:test: ✓ converts when extension is heic
@switch/api:test: ✓ converts when content signature is HEIC even if extension is not (1 ms)
@switch/api:test: ✓ returns original when not HEIC by ext or content (2 ms)
@switch/api:test: ✓ throws friendly error if conversion fails (5 ms)
@switch/api:test:
@switch/api:test: PASS src/test/unit/database.test.ts
@switch/api:test: database helpers
@switch/api:test: ✓ createTestDatabase should authenticate successfully (1 ms)
@switch/api:test: ✓ closeDatabase should close the connection (1 ms)
@switch/api:test:
@switch/api:test: PASS src/test/unit/config.test.ts
@switch/api:test: Test Environment Configuration
@switch/api:test: ✓ should load test environment variables
@switch/api:test:
@switch/api:test: PASS src/test/unit/utils/HttpException.test.ts
@switch/api:test: HttpException
@switch/api:test: ✓ stores error message and code
@switch/api:test: ✓ accepts any message payload
@switch/api:test:
@switch/api:test:
@switch/api:test: RUNS src/test/unit/utils/journal.test.ts
@switch/api:test: PASS src/test/unit/app/routes/common/globals/globals.service.test.ts
@switch/api:test: globals.service
@switch/api:test: getCertifications
@switch/api:test: ✓ returns id and name, excluding id 6 (303 ms)
@switch/api:test: getTerritories
@switch/api:test: ✓ filters by selectedStates and zipCodes and returns label + territories when selecting all states (37 ms)
@switch/api:test: ✓ returns territories only when not all states selected and list non-empty (44 ms)
@switch/api:test: ✓ returns out-of-service-area when no territories found (47 ms)
@switch/api:test: getSubTerritories
@switch/api:test: ✓ filters by territories list (26 ms)
@switch/api:test:
@switch/api:test: PASS src/test/unit/utils/passwordHashing.test.ts
@switch/api:test: passwordHashing
@switch/api:test: ✓ CreateHash returns a non-plaintext hash (105 ms)
@switch/api:test: ✓ ComparePassword returns true for matching password and false otherwise (257 ms)
@switch/api:test:
@switch/api:test: PASS src/test/unit/utils/journal.test.ts
@switch/api:test: journal.getJournalDescription
@switch/api:test: ✓ returns message for shift_create (3 ms)
@switch/api:test: ✓ includes closing reason for shift_cancel and shift_close
@switch/api:test: ✓ formats bid submission with amount and user name
@switch/api:test: ✓ maps status codes in shift_status_change
@switch/api:test: ✓ includes remove reason on shift_remove_provider
@switch/api:test: ✓ handles shift_remove_delete_provider (1 ms)
@switch/api:test: ✓ handles shift_bid_cancel
@switch/api:test: ✓ handles provider cancel green/yellow/red messages
@switch/api:test: ✓ handles immediate boost/blast with pluralization
@switch/api:test: ✓ handles self-assign notifications (1 ms)
@switch/api:test: ✓ handles replacement and self-assign provider messages
@switch/api:test: ✓ formats pre/admin clock-in and clock-out messages with timezone (15 ms)
@switch/api:test: ✓ handles bid edit and withdraw
@switch/api:test: ✓ handles bid rollover for array and single (1 ms)
@switch/api:test: ✓ handles bid remove variants
@switch/api:test: ✓ handles bid remove status
@switch/api:test: ✓ handles pay_rate_override and note
@switch/api:test: ✓ handles shift_edit and formats changes (1 ms)
@switch/api:test: ✓ includes timezone abbreviation in cancellation messages (yellow)
@switch/api:test: journal.getSystemUserId
@switch/api:test: ✓ returns id from user model or undefined
@switch/api:test:
@switch/api:test: FAIL src/test/integration/auth.int.test.ts
@switch/api:test: ● Test suite failed to run
@switch/api:test:
@switch/api:test: ZodError: [
@switch/api:test: {
@switch/api:test: "code": "invalid_type",
@switch/api:test: "expected": "string",
@switch/api:test: "received": "undefined",
@switch/api:test: "path": [
@switch/api:test: "DB",
@switch/api:test: "TEST",
@switch/api:test: "DB_NAME"
@switch/api:test: ],
@switch/api:test: "message": "Required"
@switch/api:test: },
@switch/api:test: {
@switch/api:test: "code": "invalid_type",
@switch/api:test: "expected": "string",
@switch/api:test: "received": "undefined",
@switch/api:test: "path": [
@switch/api:test: "DB",
@switch/api:test: "TEST",
@switch/api:test: "DB_USER"
@switch/api:test: ],
@switch/api:test: "message": "Required"
@switch/api:test: },
@switch/api:test: {
@switch/api:test: "code": "invalid_type",
@switch/api:test: "expected": "string",
@switch/api:test: "received": "undefined",
@switch/api:test: "path": [
@switch/api:test: "DB",
@switch/api:test: "TEST",
@switch/api:test: "DB_PASSWORD"
@switch/api:test: ],
@switch/api:test: "message": "Required"
@switch/api:test: },
@switch/api:test: {
@switch/api:test: "code": "invalid_type",
@switch/api:test: "expected": "string",
@switch/api:test: "received": "undefined",
@switch/api:test: "path": [
@switch/api:test: "DB",
@switch/api:test: "TEST",
@switch/api:test: "DB_HOST"
@switch/api:test: ],
@switch/api:test: "message": "Required"
@switch/api:test: }
@switch/api:test: ]
@switch/api:test:
@switch/api:test: 60 | const envSchema = getCurrentEnvSchema()
@switch/api:test: 61 |
@switch/api:test: > 62 | export const env = envSchema.parse({
@switch/api:test: | ^
@switch/api:test: 63 | PORT: Number(process.env.PORT),
@switch/api:test: 64 | NODE_ENV: process.env.NODE_ENV,
@switch/api:test: 65 | REST_API_KEY: process.env.REST_API_KEY,
@switch/api:test:
@switch/api:test: at Object.get error [as error] (../../../node_modules/zod/lib/types.js:55:31)
@switch/api:test: at ZodObject.parse (../../../node_modules/zod/lib/types.js:160:22)
@switch/api:test: at Object.<anonymous> (utils/config.ts:62:30)
@switch/api:test: at Object.<anonymous> (app/cronjobs/CronjobService.ts:2:1)
@switch/api:test: at Object.<anonymous> (app/cronjobs/handleNotifications.ts:1:1)
@switch/api:test: at Object.<anonymous> (app/routes/admin/organization/organization.service.ts:1:1)
@switch/api:test: at Object.<anonymous> (app/routes/admin/organization/organization.controller.ts:2:1)
@switch/api:test: at Object.<anonymous> (app/routes/routes.ts:4:1)
@switch/api:test: at Object.<anonymous> (test/helpers/createApp.ts:5:1)
@switch/api:test: at Object.<anonymous> (test/integration/auth.int.test.ts:3:1)
@switch/api:test:
@switch/api:test: PASS src/test/unit/app/routes/common/auth/auth.service.test.ts
@switch/api:test: auth.service login
@switch/api:test: ✓ throws 422 when email_or_mobile is missing (533 ms)
@switch/api:test: ✓ throws 422 when password is missing (30 ms)
@switch/api:test: ✓ throws 403 when all associated facilities are inactive (25 ms)
@switch/api:test: ✓ throws 403 when user not found (35 ms)
@switch/api:test: ✓ throws 403 when password does not match (23 ms)
@switch/api:test: ✓ returns user and tokens (non-FACILITY user) (26 ms)
@switch/api:test: ✓ returns user with facility info when FACILITY user (23 ms)
@switch/api:test:
Test Suites: 1 failed, 14 passed, 15 total
@switch/api:test: Tests: 90 passed, 90 total
@switch/api:test: Snapshots: 0 total
@switch/api:test: Time: 1.814 s
@switch/api:test: Ran all test suites.
@switch/api:test:  ELIFECYCLE  Test failed. See above for more details.
@switch/api:test: ERROR: command finished with error: command (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api) /Users/tgmarinho/Library/pnpm/pnpm run test exited (1)
@switch/frontend:test:
@switch/api#test: command (/Users/tgmarinho/Developer/popstand/dcs/Switch_Monorepo/apps/api) /Users/tgmarinho/Library/pnpm/pnpm run test exited (1)
Tasks: 0 successful, 2 total
Cached: 0 cached, 2 total
Time: 7.732s
Failed: @switch/api#test
ERROR run failed: command exited (1)
 ELIFECYCLE  Test failed. See above for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment