UNPKG

@o3r/testing

Version:

The module provides testing (e2e, unit test) utilities to help you build your own E2E pipeline integrating visual testing.

25 lines 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.updateThrowOnUndefinedCalls = updateThrowOnUndefinedCalls; const schematics_1 = require("@angular-devkit/schematics"); const schematics_2 = require("@o3r/schematics"); const update = (tree) => { const fixtureFiles = (0, schematics_2.getFilesInFolderFromWorkspaceProjectsInTree)(tree, '/', 'fixture.ts'); fixtureFiles .forEach((fixtureFile) => { const content = tree.readText(fixtureFile); tree.overwrite(fixtureFile, content.replace(/\b(?<!await )this\.throwOnUndefined\b/g, 'await this.throwOnUndefinedElement')); }); return tree; }; const notice = (_, ctx) => { ctx.logger.warn('Please notice that the "throwOnUndefined" update has change the `sync` function to `async` one.'); ctx.logger.warn('It may require to update manually some synchronous fixtures to asynchronous functions'); }; /** * Replace the call of {@link O3rComponentFixture.ThrowOnUndefined} to {@link O3rComponentFixture.ThrowOnUndefinedElement} */ function updateThrowOnUndefinedCalls() { return (0, schematics_1.chain)([update, notice]); } //# sourceMappingURL=throw-on-undefined.js.map