Commit fd99644f authored by Robert Knight's avatar Robert Knight

Add some clarifying comments

Add comments to clarify a few things about the way the tests are built
and run.
parent 8c92b413
......@@ -276,6 +276,8 @@ gulp.task(
async function buildAndRunTests() {
const { grep, singleRun } = karmaOptions;
// Generate an entry file for the test bundle. This imports all the test
// modules, filtered by the pattern specified by the `--grep` CLI option.
const testFiles = [
'src/sidebar/test/bootstrap.js',
...glob
......@@ -290,14 +292,16 @@ async function buildAndRunTests() {
mkdirSync('build/scripts', { recursive: true });
writeFileSync('build/scripts/test-inputs.js', testSource);
// Build the test bundle.
log(`Building test bundle... (${testFiles.length} files)`);
if (singleRun) {
await buildJS('./rollup-tests.config.js');
} else {
await watchJS('./rollup-tests.config.js');
}
log('Starting Karma...');
// Run the tests.
log('Starting Karma...');
return new Promise(resolve => {
const karma = require('karma');
new karma.Server(
......@@ -322,5 +326,5 @@ async function buildAndRunTests() {
// Unit and integration testing tasks.
//
// Some (eg. a11y) tests rely on CSS bundles. We assume that JS will always take
// londer to build than CSS, so build in parallel.
// longer to build than CSS, so build in parallel.
gulp.task('test', gulp.parallel('build-css', buildAndRunTests));
......@@ -18,7 +18,8 @@ export default {
treeshake: false,
plugins: [
// Replace some problematic dependencies which are imported but not actually
// used with stubs.
// used with stubs. Per @rollup/plugin-virtual's docs, this must be listed
// first.
virtual({
// Enzyme dependency used in its "Static Rendering" mode, which we don't use.
'cheerio/lib/utils': '',
......@@ -70,7 +71,16 @@ export default {
],
],
}),
nodeResolve({ browser: true, preferBuiltins: false }),
nodeResolve({
browser: true,
// Disallow use of browser polyfills for Node builtin modules. We're
// trying to avoid dependencies which rely on these.
//
// There are a couple of references to Node builtins that are stubbed by
// configuration for the `virtual` plugin above.
preferBuiltins: false,
}),
commonjs(),
string({
include: '**/*.{html,svg}',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment