Jest commands do not work when including projects
Closed this issue · 3 comments
james-lukensow commented
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.
erikengervall commented
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 :)
erikengervall commented
- Here's an example on how
projects
could be setup: https://github.com/paularmstrong/jest-multi-project-example - I also added another example using multiple projects: https://github.com/erikengervall/dockest/pull/66/files#diff-8b4783d8a422f9798a9f4788ea5a2fe3
- Here's the documentation for jest's CLI options: https://jestjs.io/docs/en/cli#projects-path1-pathn-
james-lukensow commented
@erikengervall Thanks!