Socket
Socket
Sign inDemoInstall

cron

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cron - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

8

lib/cron.js

@@ -267,3 +267,2 @@ var timeModuleFound = false;

_callback: function() {
for (var i = (this._callbacks.length - 1); i >= 0; i--) {

@@ -283,2 +282,3 @@

var timeout = this.cronTime.getTimeout();
if (this.cronTime.realDate) this.runOnce = true;

@@ -291,3 +291,3 @@ if (timeout >= 0) {

//start before calling back so the callbacks have the ability to stop the cron job
self.start();
if (!(self.runOnce)) self.start();

@@ -297,3 +297,3 @@ self._callback();

} else {
this.running = false;
this.stop();
}

@@ -309,3 +309,3 @@ },

this.running = false;
//if (this.onComplete) this.onComplete();
if (this.onComplete) this.onComplete();
}

@@ -312,0 +312,0 @@ };

{
"name": "cron",
"description": "CronJob's for your node",
"version": "0.3.0",
"version": "0.3.1",
"author": "Nick Campbell <nicholas.j.campbell@gmail.com> (http://github.com/ncb000gt)",

@@ -6,0 +6,0 @@ "bugs" : {

@@ -16,11 +16,11 @@ var testCase = require('nodeunit').testCase,

'test second with oncomplete (* * * * * *)': function(assert) {
assert.expect(1);
assert.expect(2);
var c = new cron.CronJob('* * * * * *', function(done) {
done();
assert.ok(true);
}, function () {
assert.ok(true);
assert.done();
}, true);
setTimeout(function() {
c.stop();
assert.done();
}, 1250);

@@ -39,11 +39,11 @@ },

'test every second for 5 seconds with oncomplete (* * * * * *)': function(assert) {
assert.expect(5);
assert.expect(6);
var c = new cron.CronJob('* * * * * *', function(done) {
done();
assert.ok(true);
}, function() {
assert.ok(true);
assert.done();
}, true);
setTimeout(function() {
c.stop();
assert.done();
}, 5250);

@@ -62,11 +62,11 @@ },

'test every 1 second for 5 seconds with oncomplete (*/1 * * * * *)': function(assert) {
assert.expect(5);
assert.expect(6);
var c = new cron.CronJob('*/1 * * * * *', function(done) {
done();
assert.ok(true);
}, function() {
assert.ok(true);
assert.done();
}, true);
setTimeout(function() {
c.stop();
assert.done();
}, 5250);

@@ -97,3 +97,3 @@ },

'test every second for a range with oncomplete ([start]-[end] * * * * *)': function(assert) {
assert.expect(5);
assert.expect(6);
var prepDate = new Date();

@@ -114,6 +114,6 @@ if ((54 - prepDate.getSeconds()) <= 0) {

assert.ok(true);
assert.done();
}, true);
setTimeout(function() {
c.stop();
assert.done();
}, 6250);

@@ -137,10 +137,11 @@ }

'test second with oncomplete (* * * * * *) object constructor': function(assert) {
assert.expect(1);
assert.expect(2);
var c = new cron.CronJob({
cronTime: '* * * * * *',
onTick: function(done) {
done();
assert.ok(true);
},
onComplete: function () {
assert.ok(true);
assert.done();
},

@@ -151,3 +152,2 @@ start: true

c.stop();
assert.done();
}, 1250);

@@ -191,3 +191,3 @@ },

'test specifying a specific date with oncomplete': function(assert) {
assert.expect(1);
assert.expect(2);
var prepDate = new Date();

@@ -208,6 +208,6 @@ if ((58 - prepDate.getSeconds()) <= 0) {

assert.ok(true);
assert.done();
}, true);
setTimeout(function() {
c.stop();
assert.done();
}, 2250);

@@ -286,3 +286,17 @@ }

}
},
'test dates fire only once': function(assert) {
assert.expect(1);
var count = 0;
var d = new Date().getTime() + 1000;
var job = cron.job(new Date(d), function() {
count++;
});
job.start();
setTimeout(function() {
job.stop();
assert.equal(count, 1);
assert.done();
}, 5250);
}
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc