From 06358e32c7a8d34696906f3cf9eb076a880049dc Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@keylocation.sg>
Date: Tue, 15 Aug 2017 09:13:25 +0200
Subject: [PATCH] fix: print schedule text along with error message (#679)

* fix: print schedule text along with error message

* update test
---
 lib/workers/branch/schedule.js                    | 4 ++--
 test/config/__snapshots__/validation.spec.js.snap | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/workers/branch/schedule.js b/lib/workers/branch/schedule.js
index bfa591b932..8ca82a8252 100644
--- a/lib/workers/branch/schedule.js
+++ b/lib/workers/branch/schedule.js
@@ -29,11 +29,11 @@ function hasValidSchedule(schedule) {
       return true;
     }
     if (parsedSchedule.schedules.some(s => s.m)) {
-      message = 'Schedules should not specify minutes';
+      message = `Schedule "${scheduleText}" should not specify minutes`;
       return true;
     }
     if (!parsedSchedule.schedules.some(s => s.d || s.t_a || s.t_b)) {
-      message = 'Schedule has no days of week or time of day';
+      message = `Schedule "${scheduleText}" has no days of week or time of day`;
       return true;
     }
     // It must be OK
diff --git a/test/config/__snapshots__/validation.spec.js.snap b/test/config/__snapshots__/validation.spec.js.snap
index 0221af410d..944e828935 100644
--- a/test/config/__snapshots__/validation.spec.js.snap
+++ b/test/config/__snapshots__/validation.spec.js.snap
@@ -8,7 +8,7 @@ Array [
   },
   Object {
     "depName": "Configuration Error",
-    "message": "Invalid schedule: \`Schedules should not specify minutes\`",
+    "message": "Invalid schedule: \`Schedule \\"every 15 mins every weekday\\" should not specify minutes\`",
   },
   Object {
     "depName": "Configuration Error",
-- 
GitLab