Skip to content

Commit ce9e376

Browse files
committed
Fix ASAR integrity check
1 parent 9d8a0e4 commit ce9e376

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

packages/testing/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ export const build = async (root, overrides: Partial<UserConfig> = {}, hooks: Bu
4141
join(root, globalWorkspacePath), // All default commoners outputs, including services and temporary files
4242
]
4343

44-
await CommonersBuild(updatedConfig, hooks)
44+
const buildMetadata = await CommonersBuild(updatedConfig, hooks)
4545

4646
return {
47+
metadata: buildMetadata,
4748
cleanup: async (relativePathsToRemove = []) => {
4849
const toRemove = [...AUTOCLEAR, ...relativePathsToRemove.map(path => join(root, path))]
4950
toRemove.forEach(path => removeDirectory(path))

tests/utils.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ export const registerBuildTest = (
251251

252252
describeCommand(name, () => {
253253
let triggerAssetsBuilt
254+
let triggerBuildComplete
254255
const assetsBuilt = new Promise(res => (triggerAssetsBuilt = res))
256+
const buildComplete = new Promise(res => (triggerBuildComplete = res))
255257

256258
const skipPackageStep = isMobile
257259

@@ -282,6 +284,9 @@ export const registerBuildTest = (
282284

283285
const _output = await build(projectBase, opts, hooks)
284286
Object.assign(output, _output)
287+
288+
// Store build metadata for later use
289+
triggerBuildComplete(_output)
285290
}, buildWaitTime)
286291

287292
// Cleanup build outputs
@@ -295,18 +300,22 @@ export const registerBuildTest = (
295300
// Add ASAR integrity verification for Electron builds
296301
if (isElectron) {
297302
test('ASAR integrity is properly configured', async () => {
298-
const baseDir = (await assetsBuilt) as string
303+
// Use the artifact directory (final output), not the web directory (temp build)
304+
const builtOutput = (await buildComplete) as any
305+
const { metadata = {} } = builtOutput
306+
const artifactDir = metadata?.artifact || (await assetsBuilt)
299307

300308
// Find the built .app or .exe
301309
const { name } = config
302310
let appPath: string | null = null
303311

304312
if (process.platform === 'darwin') {
305-
// macOS - look for .app bundle
306-
appPath = join(baseDir, `${name}.app`)
313+
// macOS - look for .app bundle in mac-arm64 or mac-x64 subdirectory
314+
const macDir = join(artifactDir, 'mac-arm64')
315+
appPath = join(macDir, `${name}.app`)
307316
} else if (process.platform === 'win32') {
308317
// Windows - look for .exe
309-
appPath = join(baseDir, `${name}.exe`)
318+
appPath = join(artifactDir, `${name}.exe`)
310319
}
311320

312321
if (!appPath) {

0 commit comments

Comments
 (0)