Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny-signal committed Jan 5, 2022
1 parent 383897f commit 4068bd1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/snapshots/globTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Object {
exports[`outside link 2`] = `
Object {
"offset": "5281",
"size": 4,
"size": "@size",
}
`;

Expand Down
3 changes: 2 additions & 1 deletion test/src/globTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ test.ifNotWindows(
await fs.symlink(tempDir, path.join(projectDir, "o-dir"))
},
packed: async context => {
expect((await readAsar(path.join(context.getResources(Platform.LINUX), "app.asar"))).getFile("o-dir/foo", false)).toMatchSnapshot()
const file = (await readAsar(path.join(context.getResources(Platform.LINUX), "app.asar"))).getFile("o-dir/foo", false)
expect(removeUnstableProperties(file)).toMatchSnapshot()
},
}
)
Expand Down
19 changes: 17 additions & 2 deletions test/src/helpers/packTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,15 +521,30 @@ export function removeUnstableProperties(data: any) {
// to ensure that some property exists
return `@${name}`
}
// Keep existing test coverage
if (value.integrity) {
delete value.integrity
}
return value
})
)
}

export async function verifyAsarFileTree(resourceDir: string) {
const fs = await readAsar(path.join(resourceDir, "app.asar"))
// console.log(resourceDir + " " + JSON.stringify(fs.header, null, 2))
expect(fs.header).toMatchSnapshot()

const stableHeader = JSON.parse(
JSON.stringify(fs.header, (name, value) => {
// Keep existing test coverage
if (value.integrity) {
delete value.integrity
}
return value
})
)

// console.log(resourceDir + " " + JSON.stringify(stableHeader, null, 2))
expect(stableHeader).toMatchSnapshot()
}

export function toSystemIndependentPath(s: string): string {
Expand Down

0 comments on commit 4068bd1

Please sign in to comment.