Skip to content

Commit

Permalink
chore(test): better skip usage in tape
Browse files Browse the repository at this point in the history
  • Loading branch information
paambaati committed May 6, 2023
1 parent 7e816f4 commit f5e5c88
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,45 @@ import {
FILE_ARTIFACTS,
} from '../src/main';

test.skip('🧪 verifyChecksumAndSignature() should download the CC reporter and pass all validations (happy path).', async (t) => {
if (platform() === 'darwin' && arch() === 'arm64') {
t.skip(
'Skipping integration test because the CC reporter is not available on macOS Apple Silicon!'
);
}
t.plan(1);
let capturedOutput = '';
const stdHook = hookStd((text: string) => {
capturedOutput += text;
});
test.skip(
'🧪 verifyChecksumAndSignature() should download the CC reporter and pass all validations (happy path).',
{
// NOTE: Skipping integration test because the CC reporter is not available on macOS Apple Silicon!
skip: platform() === 'darwin' && arch() === 'arm64',
},
async (t) => {
t.plan(1);
let capturedOutput = '';
const stdHook = hookStd((text: string) => {
capturedOutput += text;
});

try {
await downloadAndRecord(DOWNLOAD_URL, EXECUTABLE);
await verifyChecksumAndSignature(DOWNLOAD_URL, EXECUTABLE);
stdHook.unhook();
} catch (err) {
stdHook.unhook();
t.fail(err);
} finally {
for (const artifact of FILE_ARTIFACTS) {
try {
unlinkSync(artifact);
} catch {}
try {
await downloadAndRecord(DOWNLOAD_URL, EXECUTABLE);
await verifyChecksumAndSignature(DOWNLOAD_URL, EXECUTABLE);
stdHook.unhook();
} catch (err) {
stdHook.unhook();
t.fail(err);
} finally {
for (const artifact of FILE_ARTIFACTS) {
try {
unlinkSync(artifact);
} catch {}
}
}
}

t.equal(
capturedOutput,
[
`::debug::ℹ️ Verifying CC Reporter checksum...`,
`::debug::✅ CC Reported checksum verification completed...`,
`::debug::ℹ️ Verifying CC Reporter GPG signature...`,
`::debug::✅ CC Reported GPG signature verification completed...`,
``,
].join(EOL),
'should download the reporter and correctly pass checksum and signature verification steps.'
);
t.end();
});
t.equal(
capturedOutput,
[
`::debug::ℹ️ Verifying CC Reporter checksum...`,
`::debug::✅ CC Reported checksum verification completed...`,
`::debug::ℹ️ Verifying CC Reporter GPG signature...`,
`::debug::✅ CC Reported GPG signature verification completed...`,
``,
].join(EOL),
'should download the reporter and correctly pass checksum and signature verification steps.'
);
t.end();
}
);

0 comments on commit f5e5c88

Please sign in to comment.