Skip to content

Commit

Permalink
test: add check on an addon that does not register
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
ezequielgarcia authored and tniessen committed Aug 1, 2017
1 parent bdfbce9 commit 13d6eae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/addons/not-a-binding/binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
'targets': [
{
'target_name': 'binding',
'sources': [ 'not_a_binding.c' ]
}
]
}
3 changes: 3 additions & 0 deletions test/addons/not-a-binding/not_a_binding.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
int foo(void) {
return 0;
}
6 changes: 6 additions & 0 deletions test/addons/not-a-binding/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';
const common = require('../../common');
const assert = require('assert');

const re = /^Error: Module did not self-register\.$/;
assert.throws(() => require(`./build/${common.buildType}/binding`), re);

0 comments on commit 13d6eae

Please sign in to comment.