|
1 | 1 | "use strict"; |
2 | 2 |
|
3 | 3 | 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"); |
8 | 4 |
|
9 | 5 | describe("set-release-id-in-config-yml", function () { |
10 | 6 | 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 | + |
11 | 21 | const fixtureDir = fs.mkdtempSync( |
12 | 22 | path.join(os.tmpdir(), "sinon-release-config-"), |
13 | 23 | ); |
@@ -43,7 +53,7 @@ describe("set-release-id-in-config-yml", function () { |
43 | 53 |
|
44 | 54 | const written = fs.readFileSync(configPath, "utf8"); |
45 | 55 |
|
46 | | - assert.match(written, /current_release: v21\.0\.2/); |
| 56 | + assert.match(written, `current_release: ${expectedRelease}`); |
47 | 57 | assert.match(written, /current_major_version: 21/); |
48 | 58 | }); |
49 | 59 | }); |
0 commit comments