ember-codemod-pod-to-octane
Version:
Codemod to un-pod Ember apps, addons, and engines
20 lines (19 loc) • 746 B
JavaScript
import { findFiles } from '@codemod-utils/files';
import { normalizedJoin, renamePodPath, } from '../../../../../utils/files/index.js';
export function mapServices(options) {
const { podPath, projectRoot } = options;
const podDir = normalizedJoin('tests/unit', podPath);
const filePaths = findFiles(`${podDir}/**/service-test.{js,ts}`, {
ignoreList: [normalizedJoin('tests/unit', podPath, 'services/**')],
projectRoot,
});
return filePaths.map((oldFilePath) => {
const newFilePath = renamePodPath(oldFilePath, {
podDir,
replace: (dir) => {
return `tests/unit/services/${dir}-test`;
},
});
return [oldFilePath, newFilePath];
});
}