Skip to content

Commit e5375a9

Browse files
ezequielgarciaMylesBorins
authored andcommitted
test: add check on an addon that does not register
This commit calls require on a shared library that is not declared as a node module, and therefore does not register properly. PR-URL: #13954 Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 39f6240 commit e5375a9

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

Diff for: test/addons/not-a-binding/binding.gyp

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
'targets': [
3+
{
4+
'target_name': 'binding',
5+
'sources': [ 'not_a_binding.c' ]
6+
}
7+
]
8+
}

Diff for: test/addons/not-a-binding/not_a_binding.c

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
int foo(void) {
2+
return 0;
3+
}

Diff for: test/addons/not-a-binding/test.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
const common = require('../../common');
3+
const assert = require('assert');
4+
5+
const re = /^Error: Module did not self-register\.$/;
6+
assert.throws(() => require(`./build/${common.buildType}/binding`), re);

0 commit comments

Comments
 (0)