I'm getting Knex:Error Pool2 - Error: SQLITE_CANTOPEN: unable to open database file
when runnnig a mocha test with Knex/SQLite
My knexfile:
module.exports = {
test: {
client: 'sqlite3',
connection: {
filename: ':memory:',
}
}
...
The only reference I find when I google is to someone who mispelled ':memory'.
How should I debug this? Is there a way to turn on verbose logging for knex/SQLite?
I believe the error happens in the initialization, before the tests, and before the beforeEach()
. When I switch from sqlite3 to mysql (which we use in our dev setup), it just works.
The problem was that knex wasn't properly initialized.
I had
var knexfile = require('../knexfile');
var knex = require('knex')(environment);
// instead of require('knex')(knexfile[enviornment])