diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 539cbb10f..4ddfab6e4 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -279,6 +279,7 @@ All definitions files include a header with the author and editors, so at some p
* [mysql](https://github.com/felixge/node-mysql) (by [William Johnston](https://github.com/wjohnsto))
* [nconf](https://github.com/flatiron/nconf) (by [Jeff Goddard](https://github.com/jedigo))
* [needle](https://github.com/tomas/needle) (by [San Chen](https://github.com/bigsan))
+* [nexpect](https://github.com/nodejitsu/nexpect) (by [vvakame](https://github.com/vvakame))
* [noble](https://github.com/sandeepmistry/noble) (by [Seon-Wook Park](https://github.com/swook))
* [nock](https://github.com/pgte/nock) (by [bonnici](https://github.com/bonnici))
* [Node.js](http://nodejs.org/) (from TypeScript samples)
diff --git a/nexpect/nexpect-tests.ts b/nexpect/nexpect-tests.ts
new file mode 100644
index 000000000..d58432922
--- /dev/null
+++ b/nexpect/nexpect-tests.ts
@@ -0,0 +1,33 @@
+///
+
+import nexpect = require('nexpect');
+
+nexpect.spawn("echo", ["hello"])
+ .expect("hello")
+ .run((err, stdout, exitcode) => {
+ if (!err) {
+ console.log("hello was echoed");
+ }
+ });
+
+nexpect.spawn("ls -la /tmp/undefined", {stream: 'stderr'})
+ .expect("No such file or directory")
+ .run((err) => {
+ if (!err) {
+ console.log("checked that file doesn't exists");
+ }
+ });
+
+nexpect.spawn("node --interactive")
+ .expect(">")
+ .sendline("console.log('testing')")
+ .expect("testing")
+ .sendline("process.exit()")
+ .run((err) => {
+ if (!err) {
+ console.log("node process started, console logged, process exited");
+ }
+ else {
+ console.log(err)
+ }
+ });
diff --git a/nexpect/nexpect.d.ts b/nexpect/nexpect.d.ts
new file mode 100644
index 000000000..4996c2b4f
--- /dev/null
+++ b/nexpect/nexpect.d.ts
@@ -0,0 +1,35 @@
+// Type definitions for nexpect 0.4.2
+// Project: https://github.com/nodejitsu/nexpect
+// Definitions by: vvakame
+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare module "nexpect" {
+ import child_process = require("child_process");
+
+ function spawn(command:string[], options?:ISpawnOptions):IChain;
+
+ function spawn(command:string, params?:any[], options?:ISpawnOptions):IChain;
+
+ function spawn(command:string, options?:ISpawnOptions):IChain;
+
+ interface IChain {
+ expect(expectation:string):IChain;
+ expect(expectation:RegExp):IChain;
+ wait(expectation:string):IChain;
+ wait(expectation:RegExp):IChain;
+ sendline(line:string):IChain;
+ sendEof():IChain;
+ run(callback:(err:Error, output:string[], exit:any /* string | number */)=>void):child_process.ChildProcess;
+ }
+
+ interface ISpawnOptions {
+ cwd?:string;
+ env?:any;
+ ignoreCase?:any;
+ stripColors?:any;
+ stream?:any;
+ verbose?:any;
+ }
+}