Entitlements reference check compares forward-slash paths on every OS (false 'not referenced by CODE_SIGN_ENTITLEMENTS' on Windows); test, pitfall 103

This commit is contained in:
CRTkafa 2026-10-22 16:03:07 +08:00
parent e7874a2c25
commit cbba936ed8
4 changed files with 33 additions and 3 deletions

View file

@ -0,0 +1,18 @@
// The entitlements file the pbxproj names is "referenced" on every OS (Windows paths use backslashes; pitfall 103).
import { expect, test } from 'bun:test';
import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { readProjectEntitlements } from '../cli/apple/signing';
test('CODE_SIGN_ENTITLEMENTS = App/App.entitlements matches ios/App/App/App.entitlements', () => {
const root = mkdtempSync(join(tmpdir(), 'sb-ent-'));
mkdirSync(join(root, 'ios/App/App.xcodeproj'), { recursive: true });
mkdirSync(join(root, 'ios/App/App'), { recursive: true });
writeFileSync(join(root, 'ios/App/App.xcodeproj/project.pbxproj'), 'buildSettings = { CODE_SIGN_ENTITLEMENTS = App/App.entitlements; };\n');
writeFileSync(join(root, 'ios/App/App/App.entitlements'), '<plist><dict><key>com.apple.developer.game-center</key><true/></dict></plist>');
const r = readProjectEntitlements(root)!;
expect(r).toHaveLength(1);
expect(r[0]!.file).toBe('ios/App/App/App.entitlements');
expect(r[0]!.referenced).toBe(true);
});