mirror of https://github.com/lukechilds/node.git
Browse Source
Remove the command line flag that was needed for N-API module loading. Re: https://github.com/nodejs/vm/issues/9 PR-URL: https://github.com/nodejs/node/pull/14902 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Hitesh Kanwathirtha <digitalinfinity@gmail.com>canary-base
committed by
Michael Dawson
15 changed files with 86 additions and 70 deletions
@ -0,0 +1,12 @@ |
|||
{ |
|||
"targets": [ |
|||
{ |
|||
"target_name": "test_warning", |
|||
"sources": [ "test_warning.c" ] |
|||
}, |
|||
{ |
|||
"target_name": "test_warning2", |
|||
"sources": [ "test_warning2.c" ] |
|||
} |
|||
] |
|||
} |
@ -0,0 +1,18 @@ |
|||
'use strict'; |
|||
|
|||
if (process.argv[2] === 'child') { |
|||
const common = require('../../common'); |
|||
console.log(require(`./build/${common.buildType}/test_warning`)); |
|||
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'], |
|||
'Modules loaded correctly'); |
|||
assert.deepStrictEqual(result.stderr.toString().split(warning).length, 2, |
|||
'Warning was displayed only once'); |
|||
} |
@ -0,0 +1,11 @@ |
|||
#include <node_api.h> |
|||
#include "../common.h" |
|||
|
|||
napi_value Init(napi_env env, napi_value exports) { |
|||
napi_value result; |
|||
NAPI_CALL(env, |
|||
napi_create_uint32(env, 42, &result)); |
|||
return result; |
|||
} |
|||
|
|||
NAPI_MODULE(test_warning, Init) |
@ -0,0 +1,11 @@ |
|||
#include <node_api.h> |
|||
#include "../common.h" |
|||
|
|||
napi_value Init(napi_env env, napi_value exports) { |
|||
napi_value result; |
|||
NAPI_CALL(env, |
|||
napi_create_uint32(env, 1337, &result)); |
|||
return result; |
|||
} |
|||
|
|||
NAPI_MODULE(test_warning2, Init) |
Loading…
Reference in new issue