From 9f8e2e77b9c91a6835370099b171f6066b0225e7 Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Thu, 3 Oct 2024 13:26:10 +0100 Subject: [PATCH 1/6] Fix: Tightening glob pattern for FW-level tests --- test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.js b/test.js index 9c37d2e8f..e14c63cb7 100644 --- a/test.js +++ b/test.js @@ -96,7 +96,7 @@ function populateTestFiles(testFormat) { }); // Add the framework level test files - testFiles.push(`**/test/${globSuffix}`); + testFiles.push(`/test/${globSuffix}`); return testFiles.join(','); } From 5a319acd0706b3180c75e40ef285780b6800a41d Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Thu, 3 Oct 2024 13:42:11 +0100 Subject: [PATCH 2/6] Amended demo course config to include build.includes data --- src/course/config.json | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/course/config.json b/src/course/config.json index f5005299b..b2be5fb1a 100644 --- a/src/course/config.json +++ b/src/course/config.json @@ -77,6 +77,35 @@ "_limitToSelector": "" }, "build": { - "strictMode": true + "strictMode": true, + "includes": [ + "adapt-contrib-according", + "adapt-contrib-assessment", + "adapt-contrib-assessmentResults", + "adapt-contrib-blank", + "adapt-contrib-bookmarking", + "adapt-contrib-boxMenu", + "adapt-contrib-branching", + "adapt-contrib-confidenceSlider", + "adapt-contrib-gmcq", + "adapt-contrib-glossary", + "adapt-contrib-graphic", + "adapt-contrib-hotgraphic", + "adapt-contrib-languagePicker", + "adapt-contrib-matching", + "adapt-contrib-media", + "adapt-contrib-mcq", + "adapt-contrib-narrative", + "adapt-contrib-pageLevelProgress", + "adapt-contrib-resources", + "adapt-contrib-slider", + "adapt-contrib-spoor", + "adapt-contrib-textInput", + "adapt-contrib-text", + "adapt-contrib-trickle", + "adapt-contrib-tutor", + "adapt-contrib-xapi", + "adapt-contrib-vanilla" + ] } } From aff561a06e32c28f80122f3af2edb732a1ebedfe Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Thu, 3 Oct 2024 13:45:31 +0100 Subject: [PATCH 3/6] typo --- src/course/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/course/config.json b/src/course/config.json index b2be5fb1a..e9ee81919 100644 --- a/src/course/config.json +++ b/src/course/config.json @@ -79,7 +79,7 @@ "build": { "strictMode": true, "includes": [ - "adapt-contrib-according", + "adapt-contrib-accordion", "adapt-contrib-assessment", "adapt-contrib-assessmentResults", "adapt-contrib-blank", From 6e1f42e716b65840e825973ef37b254b1e49efc6 Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Thu, 3 Oct 2024 15:28:05 +0100 Subject: [PATCH 4/6] Splitting of glob to handle cypress or jest --- src/course/config.json | 31 +------------------------------ test.js | 6 +++++- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/src/course/config.json b/src/course/config.json index e9ee81919..f5005299b 100644 --- a/src/course/config.json +++ b/src/course/config.json @@ -77,35 +77,6 @@ "_limitToSelector": "" }, "build": { - "strictMode": true, - "includes": [ - "adapt-contrib-accordion", - "adapt-contrib-assessment", - "adapt-contrib-assessmentResults", - "adapt-contrib-blank", - "adapt-contrib-bookmarking", - "adapt-contrib-boxMenu", - "adapt-contrib-branching", - "adapt-contrib-confidenceSlider", - "adapt-contrib-gmcq", - "adapt-contrib-glossary", - "adapt-contrib-graphic", - "adapt-contrib-hotgraphic", - "adapt-contrib-languagePicker", - "adapt-contrib-matching", - "adapt-contrib-media", - "adapt-contrib-mcq", - "adapt-contrib-narrative", - "adapt-contrib-pageLevelProgress", - "adapt-contrib-resources", - "adapt-contrib-slider", - "adapt-contrib-spoor", - "adapt-contrib-textInput", - "adapt-contrib-text", - "adapt-contrib-trickle", - "adapt-contrib-tutor", - "adapt-contrib-xapi", - "adapt-contrib-vanilla" - ] + "strictMode": true } } diff --git a/test.js b/test.js index e14c63cb7..139eee3f5 100644 --- a/test.js +++ b/test.js @@ -96,7 +96,11 @@ function populateTestFiles(testFormat) { }); // Add the framework level test files - testFiles.push(`/test/${globSuffix}`); + if (testFormat === 'e2e') { + testFiles.push(`./test/${globSuffix}`); + } else { + testFiles.push('/test/unit/*.js'); + } return testFiles.join(','); } From 524d470dfa676d074e68faf594364ec1c6b82bc2 Mon Sep 17 00:00:00 2001 From: cahirodoherty-learningpool Date: Thu, 3 Oct 2024 16:12:20 +0100 Subject: [PATCH 5/6] Wider glob if no build includes or empty build.includes --- test.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test.js b/test.js index 139eee3f5..dffd5da54 100644 --- a/test.js +++ b/test.js @@ -87,13 +87,17 @@ function populateTestFiles(testFormat) { // otherwise, only include test files for plugins present in the course config const config = JSON.parse(fs.readFileSync(path.join(argumentValues.outputdir, 'course', 'config.json'))); - const plugins = config?.build?.includes || []; - + const plugins = config?.build?.includes; const globSuffix = testFormat === 'e2e' ? 'e2e/*.cy.js' : 'unit/*.js'; - const testFiles = plugins.map(plugin => { - return `**/${plugin}/test/${globSuffix}`; - }); + // Set a wider glob as default and limit to included plugins if that is set + let testFiles = [`**/*/test/${globSuffix}`]; + + if (plugins) { + testFiles = plugins.map(plugin => { + return `**/${plugin}/test/${globSuffix}`; + }); + } // Add the framework level test files if (testFormat === 'e2e') { From 1728b88fa5a7b69dc7d95c9c68d956518d9a9a2c Mon Sep 17 00:00:00 2001 From: Cahir O'Doherty <41006337+cahirodoherty-learningpool@users.noreply.github.com> Date: Fri, 4 Oct 2024 14:42:36 +0100 Subject: [PATCH 6/6] Update test.js Co-authored-by: Oliver Foster --- test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test.js b/test.js index dffd5da54..2b7a59bca 100644 --- a/test.js +++ b/test.js @@ -93,7 +93,8 @@ function populateTestFiles(testFormat) { // Set a wider glob as default and limit to included plugins if that is set let testFiles = [`**/*/test/${globSuffix}`]; - if (plugins) { + const hasDefinedIncludes = Boolean(plugins?.length); + if (hasDefinedIncludes) { testFiles = plugins.map(plugin => { return `**/${plugin}/test/${globSuffix}`; });