jest-environment-knex
knex environment in Jest
Tested against SQlite3 and Postgres. See __tests__
Install
$ npm install --save-dev jest-environment-knex
$ yarn -D jest-environment-knex
Usage
const { knex } = global;
beforeAll(async () => {
await knex.migrate.latest();
await knex.seed.run();
});
test("should list all tables", async () => {
const query = `
SELECT table_name FROM information_schema.tables
WHERE table_schema = current_schema() AND table_catalog = ?
`;
const results = await knex.raw(query, [knex.client.database()]);
expect(results.rows.map(row => row.table_name).sort()).toMatchSnapshot();
});
Release policy
Auto
Trigger a custom build on Travis (in the "More options" right menu) on the master
branch with a custom config:
env:
global:
- RELEASE=true
You can change the lerna arguments though the LERNA_ARGS
variable.
env:
global:
- STANDARD_VERSION_ARGS="--release-as major"
- RELEASE=true