fix: make it possible for windows to checkout (#1270)

Fixes #1255
This commit is contained in:
Remy Sharp
2018-02-27 16:43:09 +00:00
committed by GitHub
parent 94b526f80a
commit 0f39b2e349
7 changed files with 114 additions and 105 deletions

View File

@@ -1,3 +0,0 @@
#!/bin/sh
echo "OK"

View File

@@ -1,3 +0,0 @@
#!/bin/sh
echo "OK"

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env node
console.log('OK');

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env node
console.log('OK');

View File

@@ -1,3 +0,0 @@
#!/bin/sh
echo "OK"

View 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);
}
});
});
});
}

View File

@@ -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 () {
}
});
});
});
});