Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
///
// @ts-check
const { createMarkdown } = require('safe-marked')
const markdown = createMarkdown()
Cypress.Commands.add('runExample', options => {
const { name, description, html, test } = options
const testTitle = name || cy.state('runnable').title
if (typeof test !== 'string' || !test) {
expect(test, 'must have test source').to.be.a('string')
}
// really dummy way to see if the test code contains "cy.visit(...)"
// because in that case we should not use "cy.within" or mount html
const isTestingExternalSite = test.includes('cy.visit(')
if (!isTestingExternalSite) {
const htmlSection = html
? `<h2>HTML</h2>
<div id="html"></div>