summaryrefslogtreecommitdiff
path: root/test/addons-napi/test_warning/test.js
blob: 6909a1ebcddf2117de1d2833e8228fb396f9df37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';

if (process.argv[2] === 'child') {
  const common = require('../../common');
  console.log(require(`./build/${common.buildType}/binding`));
  console.log(require(`./build/${common.buildType}/test_warning2`));
} else {
  const run = require('child_process').spawnSync;
  const assert = require('assert');
  const warning = 'Warning: N-API is an experimental feature and could ' +
                  'change at any time.';

  const result = run(process.execPath, [__filename, 'child']);
  assert.deepStrictEqual(result.stdout.toString().match(/\S+/g), ['42', '1337']);
  assert.deepStrictEqual(result.stderr.toString().split(warning).length, 2);
}