Skip to content

Commit 024321c

Browse files
committed
fix: skip Node specific tests in browser env
1 parent b836fcc commit 024321c

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

test/scripts/set-release-id-in-config-yml-test.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
"use strict";
22

33
const assert = require("@sinonjs/referee").assert;
4-
const childProcess = require("child_process");
5-
const fs = require("fs");
6-
const os = require("os");
7-
const path = require("path");
84

95
describe("set-release-id-in-config-yml", function () {
106
it("updates current release and major version in a config file", function () {
7+
if (typeof window !== "undefined") {
8+
this.skip();
9+
}
10+
11+
const nodeRequire = module.require.bind(module);
12+
const childProcess = nodeRequire("child_process");
13+
const fs = nodeRequire("fs");
14+
const os = nodeRequire("os");
15+
const path = nodeRequire("path");
16+
const packageJsonPath = path.resolve(__dirname, "../..", "package.json");
17+
const expectedRelease = `v${
18+
JSON.parse(fs.readFileSync(packageJsonPath, "utf8")).version
19+
}`;
20+
1121
const fixtureDir = fs.mkdtempSync(
1222
path.join(os.tmpdir(), "sinon-release-config-"),
1323
);
@@ -43,7 +53,7 @@ describe("set-release-id-in-config-yml", function () {
4353

4454
const written = fs.readFileSync(configPath, "utf8");
4555

46-
assert.match(written, /current_release: v21\.0\.2/);
56+
assert.match(written, `current_release: ${expectedRelease}`);
4757
assert.match(written, /current_major_version: 21/);
4858
});
4959
});

0 commit comments

Comments
 (0)