UNPKG

declapract

Version:

A tool to declaratively define best practices, maintainable evolve them, and scalably enforce them.

31 lines 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const removeDirectoryAsync_1 = require("../../utils/fileio/removeDirectoryAsync"); const listFilesInDirectory_1 = require("../../utils/filepaths/listFilesInDirectory"); const logger_1 = require("../../utils/logger"); const dirPath_1 = require("../__test_assets__/dirPath"); const compile_1 = require("./compile"); const logSpy = jest.spyOn(console, 'log').mockImplementation(() => logger_1.log.debug); // swap to log debug so its not displaying during tests by default describe('compile', () => { it("should be able to correctly compile declarations, with '*' substitution", async () => { const srcDir = `${dirPath_1.testAssetsDirectoryPath}/example-best-practices-compile-for-package-repo/src`; const distDir = `${dirPath_1.testAssetsDirectoryPath}/example-best-practices-compile-for-package-repo/dist`; // clean up the test env await (0, removeDirectoryAsync_1.removeDirectoryAsync)({ directory: distDir, }); // compile await (0, compile_1.compile)({ sourceDirectory: srcDir, distributionDirectory: distDir, }); // and check that the files are correctly defined const filesInDistDir = await (0, listFilesInDirectory_1.listFilesInDirectory)({ directory: distDir }); expect(filesInDistDir).toContain('practices/directory-structure-src/best-practice/src/logic/<star><star>/<star>.ts.declapract.ts'); expect(filesInDistDir).not.toContain('practices/prettier/best-practice/package.json.declapract.test.ts'); expect(filesInDistDir.sort()).toMatchSnapshot(); // and check display output expect(logSpy.mock.calls).toMatchSnapshot(); }); }); //# sourceMappingURL=compile.integration.test.js.map