From 8de4ac857dacd5281f1134864962806e7970c716 Mon Sep 17 00:00:00 2001 From: Kev Date: Mon, 7 Feb 2022 15:12:45 +0000 Subject: [PATCH] Require an access token in tests --- .mocharc.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.mocharc.js b/.mocharc.js index 3852c63..87f4a41 100644 --- a/.mocharc.js +++ b/.mocharc.js @@ -1,3 +1,24 @@ +if (!process.env.ACCESS_TOKEN) { + console.error(); + + console.error(' ✋ \x1b[33;1mAccess token required\x1b[0m'); + console.error(); + console.error(' A GitLab.com personal access token as an \x1b[92mACCESS_TOKEN\x1b[0m'); + console.error(' environment variable with the \x1b[92mread_api\x1b[0m scope is required'); + console.error(' to run the GitDock tests.'); + console.error(); + + if (process.env.CI) { + console.error(' In project forks, an \x1b[92mACCESS_TOKEN\x1b[0m CI/CD variable must be'); + console.error(' set for tests to be able to run for your merge requests.'); + console.error(); + } + + console.error(' See \x1b[92mCONTRIBUTING.md\x1b[0m for details and help.'); + console.error(); + process.exit(1); +} + module.exports = { extension: ['.spec.js'], };