Skip to content

Commit e5ee342

Browse files
committed
tasks: add get time last modified util
- use in image test container tasks to display to the last build/plotly.js bundle time.
1 parent 8a4f5ee commit e5ee342

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

tasks/baseline.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
var constants = require('./util/constants');
12
var common = require('./util/common');
23
var containerCommands = require('./util/container_commands');
34

5+
var msg = [
6+
'Generating baseline image(s) using build/plotly.js from',
7+
common.getTimeLastModified(constants.pathToPlotlyBuild),
8+
'\n'
9+
].join(' ');
10+
411
var cmd = containerCommands.getRunCmd(
512
process.env.CIRCLECI,
613
'node test/image/make_baseline.js ' + process.argv.slice(2).join(' ')
714
);
815

16+
console.log(msg);
917
common.execCmd(cmd);

tasks/test_export.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
var constants = require('./util/constants');
12
var common = require('./util/common');
23
var containerCommands = require('./util/container_commands');
34

5+
var msg = [
6+
'Running image export tests using build/plotly.js from',
7+
common.getTimeLastModified(constants.pathToPlotlyBuild),
8+
'\n'
9+
].join(' ');
10+
411
var cmd = containerCommands.getRunCmd(
512
process.env.CIRCLECI,
613
'node test/image/export_test.js ' + process.argv.slice(2).join(' ')
714
);
815

16+
console.log(msg);
917
common.execCmd(cmd);

tasks/test_image.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
var constants = require('./util/constants');
12
var common = require('./util/common');
23
var containerCommands = require('./util/container_commands');
34

5+
var msg = [
6+
'Running image comparison tests using build/plotly.js from',
7+
common.getTimeLastModified(constants.pathToPlotlyBuild),
8+
'\n'
9+
].join(' ');
10+
411
var cmd = containerCommands.getRunCmd(
512
process.env.CIRCLECI,
613
'node test/image/compare_pixels_test.js ' + process.argv.slice(2).join(' ')
714
);
815

16+
console.log(msg);
917
common.execCmd(cmd);

tasks/util/common.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ exports.formatTime = function(date) {
4646
].join(' ');
4747
};
4848

49+
exports.getTimeLastModified = function(filePath) {
50+
if(!exports.doesFileExist(filePath)) {
51+
throw new Error(filePath + ' does not exist');
52+
}
53+
54+
var stats = fs.statSync(filePath),
55+
formattedTime = exports.formatTime(stats.mtime);
56+
57+
return formattedTime;
58+
};
59+
4960
exports.touch = function(filePath) {
5061
fs.closeSync(fs.openSync(filePath, 'w'));
5162
};

0 commit comments

Comments
 (0)