dimanche 23 décembre 2018

Any recommended ways to execute Jest tests sequentially, in a predefined order?

I've tried a suggestion from a related post (see link below) and it works: create separate files (that don't end in .test) for each test (or group of tests), import them into the main App.test.js, and call the files in the desired order. https://github.com/facebook/jest/issues/6194#issuecomment-419837314

However, I wonder if there are better ways of doing this by using Jest scripts for integration tests. This is not for unit tests.

App.test.js

import { apptestgroup1 } from './apptests.set1'
import { apptestgroup2 } from './apptests.set2'
import { apptestgroup3 } from './apptests.set3'

describe('App tests Group 1', apptestgroup1)
describe('App tests Group 2', apptestgroup2)
describe('App tests Group 3', apptestgroup3)

apptests.set1.js

export const apptestgroup1 = () => {
  it('sets loggedInUser = false when logOut is called', () => {});
  it('renders <Home /> when logOut is called', () => {});
}

apptests.set2.js

(more tests, similar to above)

apptests.set3.js

(more tests, similar to above)

Aucun commentaire:

Enregistrer un commentaire