UNPKG

cucumber-html-report-generator

Version:

Generate beautiful cucumberjs html reports for multiple instances (browsers / devices)

76 lines 4.62 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const chai = __importStar(require("chai")); const dependencyModifycationFunctions = __importStar(require("../../src/scripts/dependency-modification-functions")); const path = __importStar(require("path")); const index_1 = require("index"); const chai_as_promised_1 = __importDefault(require("chai-as-promised")); const simple_git_1 = require("simple-git"); chai.use(chai_as_promised_1.default); const { expect } = chai; describe('update-report-resources-spec', () => { describe('Happy flows', () => { it('should return the properties of a resource', async () => { // Given const resourcesDataFile = path.resolve(process.cwd(), './test/unit/data/update-report-resources/resources-data.json'); const configurationData = await index_1.CommonFunctions.readJsonFile(resourcesDataFile); const tempConfigurationData = await index_1.CommonFunctions.readJsonFile(resourcesDataFile); const resourcesFolder = path.resolve(process.cwd(), './test/unit/data/update-report-resources/resources'); const featureIndex = path.resolve(process.cwd(), './test/unit/data/update-report-resources/templates/feature-overview-index.tmpl'); const featureIsndex = path.resolve(process.cwd(), './test/unit/data/update-report-resources/templates/features-overview-index.tmpl'); // When await dependencyModifycationFunctions.updateResources(resourcesDataFile, resourcesFolder, [featureIsndex, featureIndex]); // Then const updatedConfigurationData = await index_1.CommonFunctions.readJsonFile(resourcesDataFile); expect(updatedConfigurationData).to.be.not.equal(configurationData); if (updatedConfigurationData) { updatedConfigurationData.forEach(elementConf => { elementConf.files.forEach(file => expect(index_1.CommonFunctions.exists(`${resourcesFolder}/${file.path.replace('resources/', '')}`)).to.be.true); }); } if (tempConfigurationData) { tempConfigurationData.forEach(elementConf => { elementConf.files.forEach(file => expect(index_1.CommonFunctions.exists(`${resourcesFolder}/${file.path.replace('resources/', '')}`)).to.be.false); }); } await dependencyModifycationFunctions.deleteOldDependencies(updatedConfigurationData?.[0], resourcesFolder); await dependencyModifycationFunctions.deleteOldDependencies(updatedConfigurationData?.[1], resourcesFolder); const updatedFiles = [ 'test/unit/data/update-report-resources/resources/Chart.js-3.7.1/chart.min.js', 'test/unit/data/update-report-resources/resources/twitter-bootstrap-5.1.2/css/bootstrap.min.css', 'test/unit/data/update-report-resources/resources/twitter-bootstrap-5.1.2/js/bootstrap.min.js', 'test/unit/data/update-report-resources/templates/feature-overview-index.tmpl', 'test/unit/data/update-report-resources/templates/features-overview-index.tmpl', 'test/unit/data/update-report-resources/resources-data.json' ]; updatedFiles.forEach(file => (0, simple_git_1.simpleGit)().checkout(file)); }); }); }); //# sourceMappingURL=update-report-resources-spec.js.map