mirror of
https://github.com/SrIzan10/nodemon.git
synced 2026-05-01 10:55:09 +00:00
3
test/fixtures/some 'file
vendored
3
test/fixtures/some 'file
vendored
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "OK"
|
||||
3
test/fixtures/some \file
vendored
3
test/fixtures/some \file
vendored
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "OK"
|
||||
2
test/fixtures/some file
vendored
2
test/fixtures/some file
vendored
@@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
console.log('OK');
|
||||
2
test/fixtures/some"file
vendored
2
test/fixtures/some"file
vendored
@@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
console.log('OK');
|
||||
3
test/fixtures/some\"file
vendored
3
test/fixtures/some\"file
vendored
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "OK"
|
||||
82
test/fork/run-mac-only.test.js
Normal file
82
test/fork/run-mac-only.test.js
Normal file
@@ -0,0 +1,82 @@
|
||||
const fs = require('fs');
|
||||
const assert = require('assert');
|
||||
const utils = require('../utils');
|
||||
const appJS = utils.appjs;
|
||||
const run = utils.run;
|
||||
|
||||
const filenames = [
|
||||
[__dirname + 'some\\\"file', '#!/usr/bin/env node\nconsole.log("OK");'],
|
||||
[__dirname + 'some\ \\file', '#!/bin/sh\necho "OK"'],
|
||||
];
|
||||
|
||||
if (!process.env.TRAVIS && process.platform !== 'win32') {
|
||||
describe('nodemon fork (mac only)', () => {
|
||||
before(() => {
|
||||
filenames.map(file => fs.writeFileSync(file[0], file[1], 'utf8'));
|
||||
});
|
||||
|
||||
after(() => {
|
||||
filenames.map(file => fs.unlinkSync(file[0]));
|
||||
});
|
||||
|
||||
it('should start a fork exec with quotes and escaping', done => {
|
||||
var found = false;
|
||||
var p = run({
|
||||
exec: 'bin/nodemon.js',
|
||||
// make nodemon verbose so we can check the filters being applied
|
||||
args: ['-q', '--exec', filenames[0][0]]
|
||||
}, {
|
||||
error: function (data) {
|
||||
p.send('quit');
|
||||
done(new Error(data));
|
||||
},
|
||||
output: function (data) {
|
||||
// process.stdout.write(data);
|
||||
if (data.trim() === 'OK') {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
p.on('message', function (event) {
|
||||
if (event.type === 'start') {
|
||||
setTimeout(function () {
|
||||
p.send('quit');
|
||||
done();
|
||||
assert(found, '"OK" message was found');
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should start a fork exec with spaces and slashes', done => {
|
||||
var found = false;
|
||||
var p = run({
|
||||
exec: 'bin/nodemon.js',
|
||||
// make nodemon verbose so we can check the filters being applied
|
||||
args: ['-q', '--exec', `"${filenames[1][0]}`]
|
||||
}, {
|
||||
error: function (data) {
|
||||
p.send('quit');
|
||||
done(new Error(data));
|
||||
},
|
||||
output: function (data) {
|
||||
// process.stdout.write(data);
|
||||
if (data.trim() === 'OK') {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
p.on('message', function (event) {
|
||||
if (event.type === 'start') {
|
||||
setTimeout(function () {
|
||||
p.send('quit');
|
||||
done();
|
||||
assert(found, '"OK" message was found');
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
/*global describe:true, it: true */
|
||||
var assert = require('assert'),
|
||||
utils = require('../utils'),
|
||||
appjs = utils.appjs,
|
||||
run = utils.run;
|
||||
utils = require('../utils'),
|
||||
appjs = utils.appjs,
|
||||
run = utils.run;
|
||||
|
||||
describe('nodemon fork', function () {
|
||||
it('should start a fork', function (done) {
|
||||
@@ -30,77 +30,17 @@ describe('nodemon fork', function () {
|
||||
// make nodemon verbose so we can check the filters being applied
|
||||
args: ['-q', '--exec', 'test/fixtures/app\\ with\\ spaces.js']
|
||||
}, {
|
||||
error: function (data) {
|
||||
p.send('quit');
|
||||
done(new Error(data));
|
||||
},
|
||||
output: function (data) {
|
||||
// process.stdout.write(data);
|
||||
if (data.trim() === 'OK') {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
p.on('message', function (event) {
|
||||
if (event.type === 'start') {
|
||||
setTimeout(function () {
|
||||
error: function (data) {
|
||||
p.send('quit');
|
||||
done();
|
||||
assert(found, '"OK" message was found');
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should start a fork exec with quotes and escaping', function (done) {
|
||||
var found = false;
|
||||
var p = run({
|
||||
exec: 'bin/nodemon.js',
|
||||
// make nodemon verbose so we can check the filters being applied
|
||||
args: ['-q', '--exec', 'test/fixtures/some\\\"file']
|
||||
}, {
|
||||
error: function (data) {
|
||||
p.send('quit');
|
||||
done(new Error(data));
|
||||
},
|
||||
output: function (data) {
|
||||
// process.stdout.write(data);
|
||||
if (data.trim() === 'OK') {
|
||||
found = true;
|
||||
done(new Error(data));
|
||||
},
|
||||
output: function (data) {
|
||||
// process.stdout.write(data);
|
||||
if (data.trim() === 'OK') {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
p.on('message', function (event) {
|
||||
if (event.type === 'start') {
|
||||
setTimeout(function () {
|
||||
p.send('quit');
|
||||
done();
|
||||
assert(found, '"OK" message was found');
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should start a fork exec with spaces and slashes', function (done) {
|
||||
var found = false;
|
||||
var p = run({
|
||||
exec: 'bin/nodemon.js',
|
||||
// make nodemon verbose so we can check the filters being applied
|
||||
args: ['-q', '--exec', '"test/fixtures/some\ \\file"']
|
||||
}, {
|
||||
error: function (data) {
|
||||
p.send('quit');
|
||||
done(new Error(data));
|
||||
},
|
||||
output: function (data) {
|
||||
// process.stdout.write(data);
|
||||
if (data.trim() === 'OK') {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
p.on('message', function (event) {
|
||||
if (event.type === 'start') {
|
||||
@@ -120,16 +60,16 @@ describe('nodemon fork', function () {
|
||||
// make nodemon verbose so we can check the filters being applied
|
||||
args: ['-q', '--exec', '"test/fixtures/app with spaces.js" foo'],
|
||||
}, {
|
||||
error: function (data) {
|
||||
p.send('quit');
|
||||
done(new Error(data));
|
||||
},
|
||||
output: function (data) {
|
||||
if (data.trim() === 'foo') {
|
||||
found = true;
|
||||
error: function (data) {
|
||||
p.send('quit');
|
||||
done(new Error(data));
|
||||
},
|
||||
output: function (data) {
|
||||
if (data.trim() === 'foo') {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
p.on('message', function (event) {
|
||||
if (event.type === 'start') {
|
||||
@@ -151,17 +91,17 @@ describe('nodemon fork', function () {
|
||||
// make nodemon verbose so we can check the filters being applied
|
||||
args: ['-q', '--exec', 'test/fixtures/app\\ with\\ spaces.js foo']
|
||||
}, {
|
||||
error: function (data) {
|
||||
p.send('quit');
|
||||
done(new Error(data));
|
||||
},
|
||||
output: function (data) {
|
||||
// process.stdout.write(data);
|
||||
if (data.trim() === 'foo') {
|
||||
found = true;
|
||||
error: function (data) {
|
||||
p.send('quit');
|
||||
done(new Error(data));
|
||||
},
|
||||
output: function (data) {
|
||||
// process.stdout.write(data);
|
||||
if (data.trim() === 'foo') {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
p.on('message', function (event) {
|
||||
if (event.type === 'start') {
|
||||
@@ -173,4 +113,4 @@ describe('nodemon fork', function () {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user