Skip to content

Commit

Permalink
fix: test case runOnChangeOnly true
Browse files Browse the repository at this point in the history
Fixed the problem in lib/monitor/run and made this test to run.
Script will create a tmp file, which should not happen as  runOnChangeOnly is set to true.
  • Loading branch information
MonarchChakri committed Aug 7, 2020
1 parent 6c471af commit e3717eb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/monitor/run.test.js
Expand Up @@ -140,17 +140,23 @@ describe('when nodemon runs (2)', function () {
});
});

// FIXME this test was never working properly
it.skip('should not run command on startup if runOnChangeOnly is true',
// Fixed! FIXME this test was previously not working properly
// corrected the test case
// script should not be run i.e,
// file should not be created
it('should not run command on startup if runOnChangeOnly is true',
function (done) {
fs.writeFileSync(tmp, 'console.log("testing 1 2 3")');
var script = "var touch = require('touch');\n"
+ "touch.sync(" + tmp2 + ");\n"
fs.writeFileSync(tmp, script);

nodemon({
script: tmp,
runOnChangeOnly: true,
stdout: false,
}).on('start', function () {
assert(false, 'script should not start');
// file exists check
assert(!fs.existsSync(tmp2), 'script should not start');
}).once('exit', function () {
done();
});
Expand Down

0 comments on commit e3717eb

Please sign in to comment.