Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make it possible for windows to checkout #1270

Merged
merged 2 commits into from
Feb 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions test/fixtures/some 'file

This file was deleted.

3 changes: 0 additions & 3 deletions test/fixtures/some \file

This file was deleted.

2 changes: 0 additions & 2 deletions test/fixtures/some file

This file was deleted.

2 changes: 0 additions & 2 deletions test/fixtures/some"file

This file was deleted.

3 changes: 0 additions & 3 deletions test/fixtures/some\"file

This file was deleted.

82 changes: 82 additions & 0 deletions test/fork/run-mac-only.test.js
Original file line number Diff line number Diff line change
@@ -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') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not run this on Travis?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember, but it was carried across from the original tests. I suspect it made things blow up, and it was a very, very specific test.

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);
}
});
});
});
}
124 changes: 32 additions & 92 deletions test/fork/run.test.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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') {
Expand All @@ -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') {
Expand All @@ -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') {
Expand All @@ -173,4 +113,4 @@ describe('nodemon fork', function () {
}
});
});
});
});