From 31c2ada22273fa064c7de579578ceea77a55b736 Mon Sep 17 00:00:00 2001 From: Joel Mukuthu Date: Fri, 15 Sep 2023 19:18:10 +0200 Subject: [PATCH] chore: attempt to fix CI --- test/unexpected-knex.spec.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/unexpected-knex.spec.js b/test/unexpected-knex.spec.js index 38fa199..532900c 100644 --- a/test/unexpected-knex.spec.js +++ b/test/unexpected-knex.spec.js @@ -7,6 +7,9 @@ const unexpectedRequire = require('unexpected-require'); const unexpectedKnex = require('../lib/unexpected-knex'); const dontIndent = require('dedent-js'); const assertErrorOuput = process.env.ASSERT_ERROR_OUTPUT !== 'false'; +const packageJson = require('fs') + .readFileSync(require('path').resolve(__dirname, '../package.json')) + .toString(); // 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 @@ -71,13 +74,17 @@ describe('unexpected-knex', function () { // matters is the require() context context[filename] = ''; return context; - }, {}), + }, { + '../package.json': packageJson, + }), }; const requireContext = filenames.reduce((context, filename) => { const absolutePath = path.resolve(migrationsDirectory, filename); context[absolutePath] = migrations[filename]; return context; - }, {}); + }, { + // '../package.json': packageJson, + }); return expect.apply(expect, [ subject, 'with fs mocked out',