mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
27 lines
761 B
TypeScript
27 lines
761 B
TypeScript
import util from 'util';
|
|
|
|
const glob = util.promisify(require('glob'));
|
|
|
|
const ignoredExtensions = ['js', 'ts', 'md', 'pyc', 'DS_Store', 'map', 'snap'];
|
|
|
|
function filterFiles(files: string[]): string[] {
|
|
return files.filter(file =>
|
|
ignoredExtensions.every(extension => !file.endsWith(`.${extension}`))
|
|
);
|
|
}
|
|
|
|
async function getFiles(dir: string): Promise<string[]> {
|
|
return filterFiles(
|
|
await glob(`${dir}/**/*`, {
|
|
dot: true,
|
|
nodir: true,
|
|
ignore: ['**/__fixtures__/**/*', '**/__mocks__/**/*'],
|
|
})
|
|
).map((file: string) => file.replace(`${dir}/`, ''));
|
|
}
|
|
|
|
describe('static-files', () => {
|
|
it('has same static files in lib and dist', async () => {
|
|
expect(await getFiles('lib')).toEqual(await getFiles('dist'));
|
|
});
|
|
});
|