MCPcopy
hub / github.com/electron-userland/electron-builder / createExtraMetadataTest

Function createExtraMetadataTest

test/src/extraMetadataTest.ts:9–48  ·  view source on GitHub ↗
(asar: boolean)

Source from the content-addressed store, hash-verified

7import { app, modifyPackageJson } from "./helpers/packTester"
8
9function createExtraMetadataTest(asar: boolean) {
10 return app({
11 targets: Platform.LINUX.createTarget(DIR_TARGET),
12 config: coerceTypes({
13 asar,
14 linux: {
15 executableName: "new-name",
16 },
17 extraMetadata: {
18 version: "1.0.0-beta.19",
19 foo: {
20 bar: 12,
21 updated: "true",
22 disabled: "false",
23 },
24 rootKey: "false",
25 rootKeyT: "true",
26 rootKeyN: "null",
27 },
28 }),
29 }, {
30 projectDirCreated: projectDir => modifyPackageJson(projectDir, data => {
31 data.scripts = {}
32 data.devDependencies = {foo: "boo"}
33 data.foo = {
34 bar: 42,
35 existingProp: 22,
36 }
37 }),
38 packed: async context => {
39 await assertThat(path.join(context.getContent(Platform.LINUX), "new-name")).isFile()
40 if (asar) {
41 expect(await readAsarJson(path.join(context.getResources(Platform.LINUX), "app.asar"), "package.json")).toMatchSnapshot()
42 }
43 else {
44 expect(await readJson(path.join(context.getResources(Platform.LINUX), "app", "package.json"))).toMatchSnapshot()
45 }
46 }
47 })
48}
49
50test.ifDevOrLinuxCi("extra metadata", createExtraMetadataTest(true))
51test.ifDevOrLinuxCi("extra metadata (no asar)", createExtraMetadataTest(false))

Callers 1

Calls 8

appFunction · 0.90
coerceTypesFunction · 0.90
modifyPackageJsonFunction · 0.90
assertThatFunction · 0.90
readAsarJsonFunction · 0.90
readJsonFunction · 0.85
createTargetMethod · 0.80
isFileMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…