This repository has been archived by the owner on Jun 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
setup/teardown #9
Comments
Closed
We had a discussion going on about forking jest-dev-server and rewriting it since its not maintained anymore actively. It would be cool to have especially with device / browser enumeration a way of executing commands before and after for e.g. setting up a database and cleaning it up afterwards. Additional to that it would be nice to have jest-dev-server functionality, either integrated or providing support for it so we could start e.g. a backend or the frontend with it. |
Closed
Probably it does not make much sense to use jest-dev-server there. I thought about the following:
e.g. const waitOn = require('wait-on');
module.exports = {
browsers: ['chromium', 'webkit'],
contextOptions: {
viewport: {
width: 1234,
height: 789,
},
},
setup: async (state, { execCommand, runInBackground }) => {
await execCommand('createdb foobar');
// start the backend
runInBackground('python manage.py runserver');
runInBackground('nginx -d');
// Wait until its reachable
await waitOn({
resources: 'http://localhost:8080'
});
},
teardown: async (state, { execCommand, killBackgroundProcesses }) => {
await killBackgroundProcesses();
await execCommand('dropdb foobar');
}
}; |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We should have hooks for setting up some test servers or other long running processes when the test run starts and shutting them down when the test run ends. I believe jest already has apis for this, but its a question of integrating with them.
The text was updated successfully, but these errors were encountered: