From e13a2c7791a42d084265d97a6d5fe9f1e64c5447 Mon Sep 17 00:00:00 2001 From: Manuel Schmid Date: Mon, 9 Nov 2020 19:30:28 +0100 Subject: [PATCH] Move tests into subdir, QA --- .github/workflows/pull_request.yml | 2 +- .gitignore | 1 + package.json | 2 +- exclude_in_test.json => tests/exclude_in_test.json | 0 pull_request.js => tests/pull_request.js | 9 ++------- 5 files changed, 5 insertions(+), 9 deletions(-) rename exclude_in_test.json => tests/exclude_in_test.json (100%) rename pull_request.js => tests/pull_request.js (96%) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 145a333..d486eca 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -25,6 +25,6 @@ jobs: - name: Install Dependencies # if: steps.cache.outputs.cache-hit != 'true' run: npm ci --ignore-scripts --no-audit --no-progress --prefer-offline - - run: npm run test + - run: npm run test-pr env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 86f4843..13ca927 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ dist website/index.html website/table.html +.idea **/.DS_Store diff --git a/package.json b/package.json index 579a782..d9b02dd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "build.js", "scripts": { "build": "rimraf ./dist/ && node build.js", - "test": "node pull_request.js" + "test-pr": "node tests/pull_request.js" }, "repository": { "type": "git", diff --git a/exclude_in_test.json b/tests/exclude_in_test.json similarity index 100% rename from exclude_in_test.json rename to tests/exclude_in_test.json diff --git a/pull_request.js b/tests/pull_request.js similarity index 96% rename from pull_request.js rename to tests/pull_request.js index c133be1..d3daf38 100644 --- a/pull_request.js +++ b/tests/pull_request.js @@ -17,7 +17,6 @@ const LINKS_OPTIONS = { }, }; - const LOG = { error: (...args) => console.error('❌ ERROR', args), error_string: (...args) => @@ -86,12 +85,6 @@ async function batch_fetch({ arr, get, post_filter_func, BATCH_SIZE = 8 }) { return result; } -const extract_repos = (arr) => - arr - .map((e) => e.substr('https://github.com/'.length).split('/')) - .filter((r) => r.length === 2 && r[1] !== ''); - - const exclude_length = exclude.length; const exclude_from_list = (link) => { let is_excluded = false; @@ -144,6 +137,8 @@ async function main() { console.log(`checking ${github_links.length} GitHub repositories...`); + console.log(`skipping GitHub repository check. Run "npm run test" to execute them manually.`); + console.log({ TEST_PASSED: !has_error.show, EXTERNAL_LINKS: external_links.length,