You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On following the documentation to use the jest-postgres package, I ran into the following error:
✗ yarn run test
yarn run v1.22.19
$ jest --passWithNoTests --runInBand --no-cache
Determining test suites to run...initdb: warning: enabling "trust" authentication forlocal connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
PostgresError: syntax error at or near "describe"
at ErrorResponse (/Users/sid/Developer/clean-architecture/node_modules/@shelf/postgres-local/node_modules/postgres/cjs/src/connection.js:765:26)
at handle (/Users/sid/Developer/clean-architecture/node_modules/@shelf/postgres-local/node_modules/postgres/cjs/src/connection.js:468:6)
at Socket.data (/Users/sid/Developer/clean-architecture/node_modules/@shelf/postgres-local/node_modules/postgres/cjs/src/connection.js:312:9)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
Error: Jest: Got error running globalSetup - /Users/sid/Developer/clean-architecture/node_modules/@shelf/jest-postgres/lib/setup.js, reason: [PostgresError: syntax error at or near "describe"]
at runGlobalHook (/Users/sid/Developer/clean-architecture/node_modules/@jest/core/build/runGlobalHook.js:117:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runJest (/Users/sid/Developer/clean-architecture/node_modules/@jest/core/build/runJest.js:327:5)
at async _run10000 (/Users/sid/Developer/clean-architecture/node_modules/@jest/core/build/cli/index.js:344:7)
at async runCLI (/Users/sid/Developer/clean-architecture/node_modules/@jest/core/build/cli/index.js:199:3)
at async Object.run (/Users/sid/Developer/clean-architecture/node_modules/jest-cli/build/run.js:124:37)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I did update my pg_hba.conf file under /opt/homebrew/var/postgresql@15 to include the following line:
host all all 0.0.0.0/0 md5
I restarted my server using brew services restart postgresql@15 and tried running my tests again, but it fails again.
/* eslint-disable *//** * For a detailed explanation regarding each configuration property, visit: * https://jestjs.io/docs/configuration */const{defaults: tsjPreset}=require('ts-jest/presets');/** @type {import('jest').Config} */constconfig={// An array of glob patterns indicating a set of files for which coverage information should be collectedcollectCoverageFrom: ['<rootDir>/src/**/*.ts','!<rootDir>/src/main/**/*.ts'],// The directory where Jest should output its coverage filescoverageDirectory: 'coverage',// Indicates which provider should be used to instrument code for coveragecoverageProvider: 'v8',// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single modulemoduleNameMapper: {'@domain/(.*)': '<rootDir>/src/domain/$1','@application/(.*)': '<rootDir>/src/application/$1','@infrastructure/(.*)': '<rootDir>/src/infrastructure/$1','@main/(.*)': '<rootDir>/src/main/$1','@test/(.*)': '<rootDir>/src/test/$1',},// A preset that is used as a base for Jest's configurationpreset: '@shelf/jest-postgres',// A list of paths to directories that Jest should use to search for files inroots: ['<rootDir>/test'],// A map from regular expressions to paths to transformerstransform: {
...tsjPreset.transform,},};module.exports=config;
The text was updated successfully, but these errors were encountered:
On following the documentation to use the
jest-postgres
package, I ran into the following error:I did update my
pg_hba.conf
file under/opt/homebrew/var/postgresql@15
to include the following line:I restarted my server using
brew services restart postgresql@15
and tried running my tests again, but it fails again.jest-postgres-config.js
:test/test.spec.ts
:jest.config.js
:The text was updated successfully, but these errors were encountered: