Skip to content

Commit

Permalink
test: force clean slate before each test
Browse files Browse the repository at this point in the history
  • Loading branch information
timorthi committed Dec 19, 2023
1 parent e2bc612 commit 25cd3bc
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions test/integration2/migrate/migration-lifecycle-integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ describe('Migrations Lifecycle Hooks', function () {
describe(db, () => {
let knex;

before(async () => {
// Force clean slate before each test
beforeEach(async () => {
rimraf.sync(path.join(__dirname, './migration'));
knex = logger(getKnexForDb(db));
// make sure lock was not left from previous failed test run
Expand All @@ -27,21 +28,7 @@ describe('Migrations Lifecycle Hooks', function () {
});
});

describe('knex.migrate.latest - lifecycle hooks', function () {
before(() => {
return knex.migrate.rollback(
{ directory: 'test/integration2/migrate/test' },
true
);
});

afterEach(() => {
return knex.migrate.rollback(
{ directory: 'test/integration2/migrate/test' },
true
);
});

describe('knex.migrate.latest', function () {
describe('beforeAll', function () {
it('runs before the migrations batch', async function () {
let count;
Expand Down

0 comments on commit 25cd3bc

Please sign in to comment.