• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3// Notarization on macOS requires all binaries to be signed.
4// We sign our own binaries but check here if any binaries from our dependencies
5// (e.g. npm) are signed.
6const common = require('../common');
7
8if (!common.isOSX) {
9  common.skip('macOS specific test');
10}
11
12const assert = require('assert');
13const { spawnSync } = require('child_process');
14const path = require('path');
15
16const debuglog = require('util').debuglog('test');
17
18const binaries = [
19  'deps/npm/node_modules/term-size/vendor/macos/term-size',
20];
21
22for (const testbin of binaries) {
23  const bin = path.resolve(__dirname, '..', '..', testbin);
24  debuglog(`Checking ${bin}`);
25  const cp = spawnSync('codesign', [ '-vvvv', bin ], { encoding: 'utf8' });
26  debuglog(cp.stdout);
27  debuglog(cp.stderr);
28  assert.strictEqual(cp.signal, null);
29  assert.strictEqual(cp.status, 0, `${bin} does not appear to be signed.\n` +
30                     `${cp.stdout}\n${cp.stderr}`);
31}
32