From 86e537938ac5d4f1f65a67e789d2587d769d4017 Mon Sep 17 00:00:00 2001 From: ddrechse Date: Wed, 11 Oct 2023 09:28:41 -0400 Subject: [PATCH 1/6] Add testExclusionList support so tests can be excluded using a uuid --- spec/helper.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/helper.js b/spec/helper.js index 128a0401c5..2b6bc7be7c 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -428,6 +428,18 @@ global.it_exclude_dbs = excluded => { } }; +// Fetch test exclusion list +const testExclusionList = require('./testExclusionList.json'); + +// Bypass test if Test UUID found in testExclusionList +global.it_id = id => { + if (testExclusionList.includes(id)) { + return xit; + } else { + return it; + } +}; + global.it_only_db = db => { if ( process.env.PARSE_SERVER_TEST_DB === db || From 4d6766ca48c9135c3eb64cdc6dc696957bf113eb Mon Sep 17 00:00:00 2001 From: ddrechse Date: Wed, 11 Oct 2023 15:37:24 -0400 Subject: [PATCH 2/6] Error Handling for not found --- spec/helper.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/helper.js b/spec/helper.js index 2b6bc7be7c..afb1a7888f 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -428,8 +428,16 @@ global.it_exclude_dbs = excluded => { } }; -// Fetch test exclusion list -const testExclusionList = require('./testExclusionList.json'); +var testExclusionList = []; +try { + // Fetch test exclusion list + testExclusionList = require('./testExclusionList.json'); + console.log("testExclusionList.json Found") +} catch(error) { + if(error.code === "MODULE_NOT_FOUND") { + // Even though it says require, it's not. Don't fail + } +} // Bypass test if Test UUID found in testExclusionList global.it_id = id => { From 9fd02ef89903b13cdb7bb3f8b5921ba4deaebc16 Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Thu, 12 Oct 2023 15:27:33 +0200 Subject: [PATCH 3/6] refactor Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com> --- spec/helper.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/helper.js b/spec/helper.js index afb1a7888f..bd17bb9fbd 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -432,10 +432,10 @@ var testExclusionList = []; try { // Fetch test exclusion list testExclusionList = require('./testExclusionList.json'); - console.log("testExclusionList.json Found") + console.log(`Using test exclusion list with ${testExclusionList.length} entries`); } catch(error) { - if(error.code === "MODULE_NOT_FOUND") { - // Even though it says require, it's not. Don't fail + if(error.code !== 'MODULE_NOT_FOUND') { + throw error; } } From 953aecfadbddd6834d9494e6d309742a075adbab Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Thu, 12 Oct 2023 15:29:19 +0200 Subject: [PATCH 4/6] refactor Signed-off-by: Manuel <5673677+mtrezza@users.noreply.github.com> --- spec/helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/helper.js b/spec/helper.js index bd17bb9fbd..ab7b45f843 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -428,7 +428,7 @@ global.it_exclude_dbs = excluded => { } }; -var testExclusionList = []; +let testExclusionList = []; try { // Fetch test exclusion list testExclusionList = require('./testExclusionList.json'); @@ -439,7 +439,7 @@ try { } } -// Bypass test if Test UUID found in testExclusionList +// Disable test if its UUID is found in testExclusionList global.it_id = id => { if (testExclusionList.includes(id)) { return xit; From d91d6b7cd3affc71443b37cc8fc9e5d5bb3fa337 Mon Sep 17 00:00:00 2001 From: ddrechse Date: Fri, 13 Oct 2023 09:52:56 -0400 Subject: [PATCH 5/6] a bit of refactoring --- spec/helper.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/helper.js b/spec/helper.js index afb1a7888f..faf1412d02 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -428,14 +428,14 @@ global.it_exclude_dbs = excluded => { } }; -var testExclusionList = []; +let testExclusionList = []; try { // Fetch test exclusion list testExclusionList = require('./testExclusionList.json'); - console.log("testExclusionList.json Found") + console.log(`Using test exclusion list with ${testExclusionList.length} entries`); } catch(error) { - if(error.code === "MODULE_NOT_FOUND") { - // Even though it says require, it's not. Don't fail + if(error.code !== 'MODULE_NOT_FOUND') { + throw error; } } From 5b053d262ab7dce81947efe15040066bcae15c57 Mon Sep 17 00:00:00 2001 From: ddrechse Date: Tue, 17 Oct 2023 12:47:12 -0400 Subject: [PATCH 6/6] Add function parameter to it_id --- spec/.eslintrc.json | 1 + spec/helper.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/.eslintrc.json b/spec/.eslintrc.json index 8f8bcfeddc..ff45304cd5 100644 --- a/spec/.eslintrc.json +++ b/spec/.eslintrc.json @@ -15,6 +15,7 @@ "equal": true, "expectAsync": true, "notEqual": true, + "it_id": true, "it_only_db": true, "it_only_mongodb_version": true, "it_only_postgres_version": true, diff --git a/spec/helper.js b/spec/helper.js index ab7b45f843..d393ef1d17 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -440,11 +440,14 @@ try { } // Disable test if its UUID is found in testExclusionList -global.it_id = id => { +global.it_id = (id, func) => { if (testExclusionList.includes(id)) { return xit; } else { - return it; + if(func === undefined) + return it; + else + return func; } };