erikengervall/dockest

Jest commands do not work when including projects

Closed this issue · 3 comments

When running the script and processing all the test files, everything runs correctly. But when I try to filter the test to run just one file via the jest projects, I get errors relating to beforeEach, afterEach is undefined.

Example...

const {
  default: Dockest,
  runners: { PostgresRunner },
} = require('dockest')

const dockest = new Dockest({
  jest: {
    lib: require('jest'),
    projects: ['src/server/server.test.js']
  },
  runners: {
    postgres: new PostgresRunner({
      service: 'db',
      host: 'localhost',
      database: 'database',
      username: 'username',
      password: 'password',
      port: 5432,
      commands: ['sequelize db:migrate', 'sequelize db:seed:all'],
    }),
  },
})

dockest.run()

Yes, if I remove "projects" from the jest config, all test scripts are run without error.

Hey @whnunlife,

This would definitely be a great addition for the library. I'll look into this specific issue and see if we can make this possible

In the meantime, while developing locally, I'd recommend using docker-compose up and jest seperately for maximized development speed :)