@o3r/schematics
Version:
Schematics module of the Otter framework
34 lines • 973 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTestFramework = getTestFramework;
const index_1 = require("../../utility/index");
const testPackageMaps = {
jest: ['jest'],
jasmine: ['jasmine-core'],
vitest: ['vitest']
};
/**
* Get the test framework
* @param workspaceOptions the workspace options
* @param context
*/
function getTestFramework(workspaceOptions, context) {
if (workspaceOptions) {
const testFramework = (0, index_1.getSchematicOptions)(workspaceOptions, context)?.testFramework;
if (testFramework) {
return testFramework;
}
}
return Object.entries(testPackageMaps)
.find(([_, deps]) => {
return deps.some((dep) => {
try {
return !!require.resolve(`${dep}/package.json`);
}
catch {
return false;
}
});
})?.[0];
}
//# sourceMappingURL=index.js.map