Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganized config scripts, fleshed out comments and instructions
- Loading branch information
1 parent
c2f71c3
commit 19b2fdd
Showing
9 changed files
with
149 additions
and
143 deletions.
There are no files selected for viewing
File renamed without changes.
This file was deleted.
Oops, something went wrong.
18 changes: 12 additions & 6 deletions
18
client/karma.config.base.js → client/karma/karma.config.base.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
* Qunit Tests | ||
* | ||
* These legacy QUnit tests are interdependent and only execute as a single | ||
* package. A flaw in the previous node environment parameter-checking in the | ||
* old karma configs gave the illusion that they ran individually, but they do | ||
* not and probably never have. Keeping them around for now, but we should get | ||
* rid of them by rewriting the tests or preferrably by removing the code to | ||
* which they apply. | ||
* | ||
* TODO: Fix jquery bundle to deliver same plugins to all frames | ||
* qunit/tests/page_tests | ||
* This test does not work with ChromeHeadless, but does with PhantomJS The | ||
* error is related to the jQuery bundling issue. Currently it can't find the | ||
* select2 plugin because the frame pages are loading a different jquery load-out | ||
* than the main UI. | ||
*/ | ||
|
||
const baseKarmaConfig = require("./karma.config.base"); | ||
|
||
// Webpack config requires massaging because the QUnit tests require CSS because | ||
// they are not truly unit tests. Normally webpack css and assets would be | ||
// stripped out of a test bundle. Apparently these tests were written prior to | ||
// selenium being implemented. | ||
const webpackConfig = require("./webpack.config.qunit"); | ||
|
||
const testFiles = [ | ||
"qunit/test.js" | ||
]; | ||
|
||
const assets = [ | ||
"qunit/assets/*.css" | ||
]; | ||
|
||
module.exports = function (config) { | ||
|
||
let preprocessors = testFiles.reduce((result, path) => { | ||
result[path] = ["webpack"]; | ||
return result; | ||
}, {}); | ||
|
||
let settings = Object.assign({}, baseKarmaConfig, { | ||
files: testFiles.concat(assets), | ||
preprocessors: preprocessors, | ||
frameworks: ["polyfill", "qunit"], | ||
webpack: webpackConfig | ||
}); | ||
|
||
config.set(settings); | ||
}; | ||
|
||
|
||
/* | ||
var QUNIT_TESTS_SEPARATE_PACKS = [ | ||
{ pattern: "galaxy/scripts/qunit/tests/galaxy_app_base_tests.js", watched: false }, | ||
// Something is funky with form_tests.js - needs to come before all other tests. | ||
{ pattern: "galaxy/scripts/qunit/tests/form_tests.js", watched: false }, | ||
{ pattern: "galaxy/scripts/qunit/tests/upload_dialog_tests.js", watched: false }, | ||
// Something is funky with masthead_tests - needs to come before one of the other | ||
// tests - not sure which though... | ||
{ pattern: "galaxy/scripts/qunit/tests/masthead_tests.js", watched: false }, | ||
//{pattern: 'galaxy/scripts/qunit/tests/list_of_pairs_collection_creator_tests.js', watched: false}, | ||
{ pattern: "galaxy/scripts/qunit/tests/graph_tests.js", watched: false }, | ||
{ pattern: "galaxy/scripts/qunit/tests/hda_base_tests.js", watched: false }, | ||
{ pattern: "galaxy/scripts/qunit/tests/history_contents_model_tests.js", watched: false }, | ||
{ pattern: "galaxy/scripts/qunit/tests/job_dag_tests.js", watched: false }, | ||
{ pattern: "galaxy/scripts/qunit/tests/metrics_logger_tests.js", watched: false }, | ||
{ pattern: "galaxy/scripts/qunit/tests/popover_tests.js", watched: false }, | ||
{ pattern: "galaxy/scripts/qunit/tests/utils_tests.js", watched: false }, | ||
{ pattern: "galaxy/scripts/qunit/tests/page_tests.js", watched: false }, | ||
{ pattern: "galaxy/scripts/qunit/tests/workflow_editor_tests.js", watched: false }, | ||
{ pattern: "galaxy/scripts/qunit/tests/modal_tests.js", watched: false } | ||
// The following tests don't work for state reasons: | ||
// Error: Following test works on its own or with rest but not with | ||
// list_of_pairs_collection_creator in the same suite. Not as much isolation | ||
// as seperate page setup of previous runner. | ||
// {pattern: 'galaxy/scripts/qunit/tests/ui_tests.js', watched: false}, | ||
]; | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* So the legacy QUnit tests have to perform some gymastics that should not be | ||
* required because thse tests apparently care about assets like the CSS and images. | ||
* TODO: Replace these tests with like... actual unit tests. | ||
*/ | ||
|
||
let wpConfig = require("../webpack.config"); | ||
wpConfig.mode = "production"; | ||
wpConfig.entry = () => ({}); | ||
|
||
const switchPlugin = (reMatcher, replacement) => { | ||
|
||
let scrubLoader = (obj) => | ||
(typeof obj == "string" && obj.match(reMatcher)) | ||
? Object.assign({}, replacement) | ||
: obj | ||
|
||
return (rule) => { | ||
if (rule.use && rule.use.length) { | ||
rule.use = rule.use.map(scrubLoader); | ||
} | ||
return rule; | ||
} | ||
} | ||
|
||
// Remove MiniCssExtractPlugin loader references | ||
// replace mini-css-extract plugin with basic style loader | ||
// Honestly I'm not clear on why we process css at all for unit tests | ||
const scrubLoaderRules = (module) => { | ||
let rePluginMatch = /mini-css-extract-plugin/; | ||
let styleLoader = { loader: "style-loader" }; | ||
let processor = switchPlugin(rePluginMatch, styleLoader); | ||
module.rules = module.rules.map(processor); | ||
} | ||
|
||
// Remove mini-css-extract loader references | ||
scrubLoaderRules(wpConfig.module); | ||
|
||
// remove MiniCSSExtract Plugin | ||
wpConfig.plugins = wpConfig.plugins.filter(p => { | ||
return p.constructor.name != "MiniCssExtractPlugin"; | ||
}); | ||
|
||
module.exports = wpConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.