Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bwrigley's avatar

Trying to switch Dusk to use sqlite test DB

I'm trying to configure Dusk to use a sqlite DB instead of mysql as I currently have, in the (vain?) hope that this will speed my tests up a little.

My project is a Laravel 10 /Vue 3 project running inside Homestead Vagrant 2.3.3 with Ubuntu. And I'm running Vite on Windows 10, so outside the vm.

I have a .env.dusk.local file used when I run Dusk with:

DB_CONNECTION=sqlite
DB_DATABASE=/home/vagrant/Code/testproject/database/dusk.sqlite
DB_FOREIGN_KEYS=true

and I have created the empty dusk.sqlite file in database directory.

When I run my test suite (from inside the vm) the first thing I see is that dusk.sqllite-journal is created in my database directory. After about 10 seconds I get the error in laravel.log

[previous exception] [object] (Illuminate\Database\SQLiteDatabaseDoesNotExistException(code: 0): Database file at path [/home/vagrant/Code/testproject/database/dusk.sqlite] does not exist. Ensure this is an absolute path to the database. at 
G:\Sites\Laravel\testproject\vendor\laravel\framework\src\Illuminate\Database\Connectors\SQLiteConnector.php:34)

then 30 seconds later in the terminal:

SQLSTATE[HY000]: General error: 5 database is locked (Connection: sqlite, SQL: create table "migrations" ("id" integer primary key autoincrement not null, "migration" varchar not null, "batch" integer not null))

I'd be very grateful if anyone has any insights. I'm especially confused why the log file is showing windows paths when I'm running this from the CLI inside the vm.

0 likes
0 replies

Please or to participate in this conversation.