diff --git a/package-lock.json b/package-lock.json index 1b0259f..ba27ae1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "eslint-plugin-prettier": "5.2.1", "eslint-plugin-simple-import-sort": "12.1.1", "eslint-plugin-unused-imports": "4.1.4", + "fast-glob": "3.3.2", "highlight.js": "11.10.0", "jest": "29.7.0", "jest-junit": "16.0.0", diff --git a/package.json b/package.json index 8dcf5cb..aeed1a1 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "eslint-plugin-prettier": "5.2.1", "eslint-plugin-simple-import-sort": "12.1.1", "eslint-plugin-unused-imports": "4.1.4", + "fast-glob": "3.3.2", "highlight.js": "11.10.0", "jest": "29.7.0", "jest-junit": "16.0.0", diff --git a/src/index.spec.ts b/src/index.spec.ts new file mode 100644 index 0000000..199f819 --- /dev/null +++ b/src/index.spec.ts @@ -0,0 +1,15 @@ +import { readFile } from 'node:fs/promises'; + +import glob from 'fast-glob'; + +const exports = await glob.async('src/{transformers,utils}/!(*.spec).ts', { onlyFiles: true }); +const barrel = await readFile('./src/index.ts', 'utf-8'); + +describe('barrel', () => { + // lazy boy does not want to check all exports every time + // and neither does he want to generate the barrel file + it.each(exports)('exports %s', async file => { + const js = file.replace(/^src/, '.').replace(/\.ts$/, '.js'); + expect(barrel).toEqual(expect.stringContaining(`export * from '${js}';`)); + }); +});