How to use the seed function from knex

Find comprehensive JavaScript knex.seed code examples handpicked from public code repositorys.

48
49
50
51
52
53
54
55
56
57
58
requireDir('core', { recurse: true });
requireDir('usercases', { recurse: true });


function cleanDBAndFlushCache(done) {
  logger.info('Cleaning the test DB after each test...');
  knex.seed.run()
    .then(function () {
      client.flushdb(done);
    })
    .catch(function(err) {
fork icon0
star icon1
watch icon0

10
11
12
13
14
15
16
17
18
19
});

beforeEach(async () => {
  await knex.migrate.rollback();
  await knex.migrate.latest();
  await knex.seed.run();
});

describe("POST /cards", () => {
  // Tests for POST /cards
fork icon0
star icon0
watch icon2

15
16
17
18
19
20
21
22
23
24
25
26
})


beforeEach(async () => {
  const context = await browser.newContext()
  page = await context.newPage()
  await db.seed.run({ directory: './server/db/seeds' })
})


afterEach(async () => {
  await page.close()
fork icon0
star icon0
watch icon0