Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
spec: '',
expectedResults: {},
})
const expectedResults = _.defaults({}, parsedExpectedResults, opts.expectedResults, {
totalFailed: 0,
})
console.log(chalk.cyanBright(`starting test run: ${opts.spec}`))
const stdio = captureStdio(process.stdout)
stdio.passThrough((v) => chalk.magenta(stripAnsi(v.toString())))
// const stdio2 = captureStdio(process.stdout)
return cypress.run({
spec: opts.spec,
}).then((res) => {
expect(res).includes(expectedResults)
})
.finally(() => {
stdio.restore()
// console.log(chalk.magenta(stdio.toString()))
})
.then(() => {
console.log(`${chalk.bold('run matched these results:')} ${JSON.stringify(expectedResults, null, 2)}`)
})
}
bs.init(setup, function(err, bs) {
return cypress.run({
spec: specs,
})
.then((results) => {
// stop your server when it's complete
bs.cleanup();
if (results.failures > 0) {
return process.exit(1);
}
process.exit(0);
})
});
}
console.log('\nRunning %d spec:', k, spec)
k += 1
const opts = {
// headed: true,
spec,
}
process.env.DEBUG = process.env.DEBUG || 'cypress:*'
if (process.env.CI) {
opts.record = false
opts.key = process.env.CYPRESS_DASHBOARD_KEY
}
return cypress.run(opts).then(results => {
if (results.failures) {
numFailed += results.failures
return results
}
return runSpec(spec)
})
}
const server = require("./server");
const cypress = require("cypress");
// start your server
cypress
.run({
browser: "chrome"
})
.then(() => {
// stop your server when it's complete
console.log(`cypress test completed!`);
process.exit(0);
});
const run = (num, spec, retryGroup) => {
num += 1;
let config = _.cloneDeep(DEFAULT_CONFIG);
config = { ...config, env: { ...config.env, numRuns: num } };
if (spec) config.spec = spec;
if (retryGroup) config.group = retryGroup;
console.log(config);
return cypress
.run(config)
.then(results => {
if (results.totalFailed) {
totalFailuresIncludingRetries += results.totalFailed;
// rerun again with only the failed tests
const specs = _(results.runs)
.filter('stats.failures')
.map('spec.relative')
.value();
console.log(`Run #${num} failed.`);
console.log(
_(results.runs)
.filter('stats.failures')
.map('tests')
const testApp = app => {
console.log(
figlet.textSync(app, {
font: 'Varsity'
})
)
const colorFailures = n => (n ? chalk.red(n) : chalk.green(n))
const addColors = R.over(R.lensProp('failures'), colorFailures)
return cypress
.run({
browser: args.browser,
record: true,
key: '6f32e649-6348-4d6e-8ec0-4b57774965d1',
env: {
framework: app,
times: args.times
}
})
.then(R.omit(['screenshots', 'video', 'version']))
.then(R.set(R.lensProp('app'), app))
.then(addColors)
}
const cypress = require("cypress")
const httpServer = require("http-server")
const server = httpServer.createServer({
root: "dist/"
})
server.listen(8000)
cypress
.run()
.then(res => {
server.close()
mqtt.server.close()
process.exit(res.totalFailed)
})
.catch(err => {
console.error(err)
process.exit(1)
})
compiler => cypress.run().then(() => resolve()).catch(() => reject())
)