Skip to content

The agent that grows with you

test(desktop): drop progress-log assertions

ethernet39a487e6d7e7
diff --git a/apps/desktop/scripts/batch-sign-binaries.test.mjs b/apps/desktop/scripts/batch-sign-binaries.test.mjs
index a1e42a7bf23..16e55919432 100644
--- a/apps/desktop/scripts/batch-sign-binaries.test.mjs
+++ b/apps/desktop/scripts/batch-sign-binaries.test.mjs
@@ -4,7 +4,7 @@ import os from 'node:os'
import path from 'node:path'
import { Arch, Packager, Platform, WinPackager } from 'app-builder-lib'
-import { afterEach, test, vi } from 'vitest'
+import { afterEach, test } from 'vitest'
import builderConfig from '../electron-builder.config.cjs'
@@ -29,30 +29,6 @@ function tmpTree() {
return dir
}
-test('batch phase logs arrive before execution and completion logs only after success', async () => {
- const root = tmpTree()
- fs.writeFileSync(path.join(root, 'binary.exe'), 'inert signing fixture')
- const log = vi.spyOn(console, 'log').mockImplementation(() => {})
- try {
- await batchSignAppTree(root, null, {
- env: { AZURE_SIGN_ENDPOINT: 'https://test.invalid', AZURE_SIGN_ACCOUNT: 'account', AZURE_SIGN_PROFILE: 'profile' },
- signtool: 'signtool.exe', dlib: 'dlib.dll', cache: null, mkdtemp: () => root,
- exec: async (tool, args) => {
- const messages = log.mock.calls.map(([message]) => message)
- const phase = args[0] === 'sign' ? 'signing' : 'timestamping'
- const completed = args[0] === 'sign' ? 'signed' : 'timestamped'
- assert.ok(messages.some(message => message.includes(`${phase} batch 1/1`)))
- assert.ok(!messages.some(message => message.includes(`${completed} batch 1/1`)))
- }
- })
- const messages = log.mock.calls.map(([message]) => message)
- assert.ok(messages.some(message => message.includes('signed batch 1/1')))
- assert.ok(messages.some(message => message.includes('timestamped batch 1/1')))
- } finally {
- log.mockRestore()
- }
-})
-
test('getBinaries collects .exe and .dll recursively, case-insensitive, sorted', () => {
const root = tmpTree()
fs.mkdirSync(path.join(root, 'resources', 'agent-payload', 'tools', 'python', 'bin'), { recursive: true })
diff --git a/apps/desktop/scripts/sanitize-pe-signatures.test.mjs b/apps/desktop/scripts/sanitize-pe-signatures.test.mjs
index 1d7b968d261..43780f7960e 100644
--- a/apps/desktop/scripts/sanitize-pe-signatures.test.mjs
+++ b/apps/desktop/scripts/sanitize-pe-signatures.test.mjs
@@ -2,28 +2,10 @@ import assert from 'node:assert/strict'
import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'
-import { test, vi } from 'vitest'
+import { test } from 'vitest'
import { sanitizeTree } from './sanitize-pe-signatures.mjs'
-test('a slow header scan reports its current file without logging every file', () => {
- const root = fs.mkdtempSync(path.join(os.tmpdir(), 'pe-progress-'))
- const times = [0, 4999, 5000, 5001, 9999, 10000]
- const clock = vi.spyOn(performance, 'now').mockImplementation(() => times.shift())
- const log = vi.spyOn(console, 'log').mockImplementation(() => {})
- try {
- for (let i = 0; i < 5; i++) fs.writeFileSync(path.join(root, `${i}.txt`), 'not PE')
- assert.deepEqual(sanitizeTree(root), { scanned: 0, repaired: [] })
- assert.equal(log.mock.calls.length, 2, 'report at each five-second boundary, not for each file')
- assert.match(log.mock.calls[0][0], /checked 1 files .*checking 1\.txt/)
- assert.match(log.mock.calls[1][0], /checked 4 files .*checking 4\.txt/)
- } finally {
- clock.mockRestore()
- log.mockRestore()
- fs.rmSync(root, { recursive: true, force: true })
- }
-})
-
for (const [magic, countOffset, securityOffset] of [[0x10b, 244, 280], [0x20b, 260, 296]]) {
test(`tree sanitization preserves all bytes except dangling PE ${magic.toString(16)} directories`, () => {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'pe-sanitize-'))