From a90ad2899d7cd9bb529a60e7d5d46469e9c02846 Mon Sep 17 00:00:00 2001 From: Joel Mukuthu Date: Fri, 15 Sep 2023 19:03:38 +0200 Subject: [PATCH] test: fix the "Module not found" errors in the migration tests --- test/unexpected-knex.spec.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/unexpected-knex.spec.js b/test/unexpected-knex.spec.js index 6414c03..38fa199 100644 --- a/test/unexpected-knex.spec.js +++ b/test/unexpected-knex.spec.js @@ -8,6 +8,11 @@ const unexpectedKnex = require('../lib/unexpected-knex'); const dontIndent = require('dedent-js'); const assertErrorOuput = process.env.ASSERT_ERROR_OUTPUT !== 'false'; +// This file is `require`d here so that it's cached by Node.js before we go +// ahead and mock out `require`, since knex's migrator require's it while doing +// its job. +require('knex/lib/util/import-file.js'); + describe('unexpected-knex', function () { const host = process.env.PGHOST || 'localhost'; const knex = Knex({