From c9e0d95fd95a1409db804ec7d63fc8e14e286724 Mon Sep 17 00:00:00 2001 From: Max Nikolenko Date: Thu, 9 May 2019 20:04:18 +0300 Subject: [PATCH] Capability to test only a specific country code via TEST_COUNTRY=xx enviroment variable --- .gitignore | 3 ++- test/index.js | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a4e41da435..950a3102ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ -error.log \ No newline at end of file +error.log +*~ diff --git a/test/index.js b/test/index.js index 85a09b5ff3..7f6e861276 100644 --- a/test/index.js +++ b/test/index.js @@ -22,6 +22,14 @@ function writeToLog(test, country, msg, url) { console.log(line) } +function skipPlaylist(filename) { + let test_country = process.env.TEST_COUNTRY + if (test_country && filename !== 'channels/' + test_country + '.m3u') { + return true; + } + return false; +} + function loadPlaylist(filename) { return M3U.parse(fs.readFileSync(path.resolve(__dirname) + "/../" + filename, { encoding: "utf8" })) } @@ -35,6 +43,10 @@ async function testAllLinksIsWorking() { for(let country of countries) { + if (skipPlaylist(country.file)) { + continue; + } + const playlist = loadPlaylist(country.file) for(let channel of playlist) {