From 2436b24e5339837b43f4c80596da849dcac65511 Mon Sep 17 00:00:00 2001 From: Anton Alexandrenok Date: Thu, 31 Dec 2020 15:56:12 +0300 Subject: [PATCH] test: Fix tests depending on package version --- tests/index.test.int.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/index.test.int.js b/tests/index.test.int.js index e180582..dde26b0 100644 --- a/tests/index.test.int.js +++ b/tests/index.test.int.js @@ -1,5 +1,6 @@ "use strict"; +const { writeFileSync } = require("fs"); const path = require("path"); const { afterEach, beforeEach, describe, expect, test } = require("@jest/globals"); @@ -9,6 +10,11 @@ const { dirSync } = require("tmp"); const gitDummyCommit = require("git-dummy-commit"); const shell = require("shelljs"); +const pkgJson = JSON.stringify({ + ...require("../package.json"), + version: "1.0.0", +}); + const URL = require("../package.json").repository.url; const getPreset = require("../src/index.js"); @@ -60,7 +66,7 @@ describe("Changelog Preset", () => { shell.config.resetForTesting(); shell.cd(temp.name); - shell.cp(require.resolve("../package.json"), temp.name); + writeFileSync(path.join(temp.name, "package.json"), pkgJson); shell.mkdir("git-templates"); shell.exec("git init --template=./git-templates"); shell.exec("git config user.email \"bot@example.com\"");