UNPKG

nx-mesh

Version:
38 lines (37 loc) 1.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addCypress = void 0; const tslib_1 = require("tslib"); const cypress_1 = require("@nrwl/cypress"); const linter_1 = require("@nrwl/linter"); function addCypress(host, options) { return tslib_1.__awaiter(this, void 0, void 0, function* () { const task = yield (0, cypress_1.cypressProjectGenerator)(host, Object.assign(Object.assign({}, options), { directory: options.projectParentDirectory, linter: linter_1.Linter.EsLint, name: `${options.name}-e2e`, project: options.projectName })); const specFile = `${options.projectE2eDirectory}/src/integration/app.spec.${options.js ? 'js' : 'ts'}`; const content = ` describe('${options.name}', () => { it('should start a mesh server', () => { cy.request('/graphql/health').then((resp) => { expect(resp.status).to.eq(200); expect(resp.body).to.have.property('message', 'alive'); }); }); it('should still be running after 15 seconds', () => { cy.wait(1000 * 15) .request('/graphql/health') .then((resp) => { expect(resp.status).to.eq(200); expect(resp.body).to.have.property('message', 'alive'); }); }); }); `; if (content) { host.write(specFile, content); } return task; }); } exports.addCypress = addCypress; exports.default = addCypress; //# sourceMappingURL=add-cypress.js.map