Skip to content

Commit dfebcb5

Browse files
committed
chore: ignore tests in daemon signature
1 parent ee6d558 commit dfebcb5

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

src/daemon/code-signature.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,15 @@ function* walkSignatureFiles(dirPath: string): Generator<string> {
6363
.readdirSync(dirPath, { withFileTypes: true })
6464
.sort((left, right) => left.name.localeCompare(right.name));
6565
for (const entry of entries) {
66+
if (entry.isDirectory() && entry.name === '__tests__') {
67+
continue;
68+
}
6669
const entryPath = path.join(dirPath, entry.name);
6770
if (entry.isDirectory()) {
6871
yield* walkSignatureFiles(entryPath);
6972
continue;
7073
}
71-
if (entry.isFile()) {
74+
if (entry.isFile() && !entry.name.includes('.test.')) {
7275
yield entryPath;
7376
}
7477
}

src/utils/__tests__/daemon-client.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,27 @@ test('computeDaemonCodeSignature fingerprints the daemon source tree', () => {
10521052
}
10531053
});
10541054

1055+
test('computeDaemonCodeSignature ignores source test files', () => {
1056+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-device-daemon-signature-tests-'));
1057+
try {
1058+
const daemonEntryPath = path.join(root, 'src', 'daemon.ts');
1059+
const runtimePath = path.join(root, 'src', 'platforms', 'ios', 'perf.ts');
1060+
const testPath = path.join(root, 'src', 'platforms', 'ios', '__tests__', 'perf.test.ts');
1061+
fs.mkdirSync(path.dirname(testPath), { recursive: true });
1062+
fs.writeFileSync(daemonEntryPath, 'console.log("daemon");\n', 'utf8');
1063+
fs.writeFileSync(runtimePath, 'export const value = 1;\n', 'utf8');
1064+
fs.writeFileSync(testPath, 'export const ignored = 1;\n', 'utf8');
1065+
1066+
const firstSignature = computeDaemonCodeSignature(daemonEntryPath, root);
1067+
fs.writeFileSync(testPath, 'export const ignored = 2;\n', 'utf8');
1068+
const secondSignature = computeDaemonCodeSignature(daemonEntryPath, root);
1069+
1070+
assert.equal(secondSignature, firstSignature);
1071+
} finally {
1072+
fs.rmSync(root, { recursive: true, force: true });
1073+
}
1074+
});
1075+
10551076
test('stopDaemonProcessForTakeover terminates a matching daemon process', async (t) => {
10561077
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-device-daemon-test-'));
10571078
const daemonDir = path.join(root, 'agent-device', 'dist', 'src');

0 commit comments

Comments
 (0)