Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

const path = require('path');

const { globSync } = require('glob');
const karmaPluginLwc = require('../../karma-plugins/lwc');
const karmaPluginEnv = require('../../karma-plugins/env');
const karmaPluginTransformFramework = require('../../karma-plugins/transform-framework.js');
Expand Down Expand Up @@ -53,11 +54,20 @@ function getFiles() {
frameworkFiles.push(createPattern(WIRE_SERVICE));
frameworkFiles.push(createPattern(TEST_SETUP));

return [
...frameworkFiles,
createPattern(TEST_UTILS),
createPattern('**/*.spec.js', { watched: false }),
];
// check if a .only file exists
const onlyFile = globSync('**/*/.only', { cwd: BASE_DIR, absolute: true });

const specFiles = [];
if (onlyFile.length > 0) {
for (const file of onlyFile) {
const dir = path.dirname(file);
specFiles.push(createPattern(`${dir}/**/*.spec.js`, { watched: false }));
}
} else {
specFiles.push(createPattern('**/*.spec.js', { watched: false }));
}

return [...frameworkFiles, createPattern(TEST_UTILS), ...specFiles];
}

/**
Expand Down