Skip to content

Commit

Permalink
test: Fix tests depending on package version
Browse files Browse the repository at this point in the history
  • Loading branch information
the-spyke committed Dec 31, 2020
1 parent 960fe0b commit 2436b24
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/index.test.int.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use strict";

const { writeFileSync } = require("fs");
const path = require("path");

const { afterEach, beforeEach, describe, expect, test } = require("@jest/globals");
Expand All @@ -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");

Expand Down Expand Up @@ -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\"");
Expand Down

0 comments on commit 2436b24

Please sign in to comment.