-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #955 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
- Loading branch information
1 parent
c4344b3
commit 0dba4bd
Showing
6 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict' | ||
|
||
var test = require('tape') | ||
var execFile = require('child_process').execFile | ||
var path = require('path') | ||
var addonPath = path.resolve(__dirname, 'node_modules', 'hello_world') | ||
var nodeGyp = path.resolve(__dirname, '..', 'bin', 'node-gyp.js') | ||
|
||
test('build simple addon', function (t) { | ||
t.plan(3) | ||
|
||
// Set the loglevel otherwise the output disappears when run via 'npm test' | ||
var cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose'] | ||
var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) { | ||
var logLines = stderr.toString().trim().split(/\r?\n/) | ||
var lastLine = logLines[logLines.length-1] | ||
t.strictEqual(err, null) | ||
t.strictEqual(lastLine, 'gyp info ok', 'should end in ok') | ||
try { | ||
var binding = require('hello_world') | ||
t.strictEqual(binding.hello(), 'world') | ||
} catch (error) { | ||
t.error(error, 'load module') | ||
} | ||
}) | ||
proc.stdout.setEncoding('utf-8') | ||
proc.stderr.setEncoding('utf-8') | ||
}) |