Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
code => {
const tests = code.tests
.reduce((tests, test) => {
return (tests += test.code)
}, 'const utils = require("./utils.js");const tests = {};')
.concat('module.exports = tests;')
writeJSFile(path.join(projectPath, 'commons'), tests, '.js')
writeJSFile(path.join(projectPath, 'utils'), getUtilsFile(), '.js')
code.suites.forEach(suite => {
if (!suite.tests) {
// not parallel
const cleanup = suite.persistSession
? ''
: 'beforeEach(() => {vars = {};});afterEach(async () => (cleanup()));'
writeJSFile(
path.join(projectPath, sanitizeFileName(suite.name)),
`// This file was generated using Selenium IDE\nconst tests = require("./commons.js");${
code.globalConfig
}${suite.code}${cleanup}`
)
} else if (suite.tests.length) {
fs.mkdirSync(path.join(projectPath, sanitizeFileName(suite.name)))
// parallel suite
suite.tests.forEach(test => {