test('npm-test: setup', async () => { packageManagers = await packageManager.getPackageManagers(); await mkdir(sandbox, { recursive: true }); await Promise.all([ copy(passFixtures, passTemp), copy(failFixtures, failTemp), copy(badFixtures, badTemp), copy(noTestScriptFixtures, noTestScriptTemp), copy(scriptsFixtures, scriptsTemp), copy(writeTmpdirFixtures, writeTmpdirTemp) ]); });
/** * Re-create the .tmp directories before each test */ beforeEach("clean the .tmp directory", async () => { // Delete the .tmp directory, if it exists await fs.rmdir(paths.tmp, { recursive: true }); // Create the home and workspace directories await fs.mkdir(paths.home, { recursive: true }); await fs.mkdir(paths.workspace, { recursive: true }); });
async index() { const { ctx } = this ctx.set('Content-Type', 'text/html') ctx.body = await fs.readFile(path.resolve('app/public/build/index.html')) }
async function storeToken(token) { try { fs.mkdirSync(TOKEN_DIR); } catch (err) { if (err.code !== 'EEXIST') { throw err; } } await fs.promises.writeFile(TOKEN_PATH, JSON.stringify(token)); }
const recorrerDirectorio = async (rutaDir) => { const rutas = await fs.readdir(rutaDir) for (let index = 0; index < rutas.length; index++) { const rutaAbsoluta = path.join(rutaDir, rutas[index]) try { await procesarRuta(rutaAbsoluta) } catch (_) {} } }
async function inspectMetadataFile(result, metadataFile) { try { const metadata = await fs.readFile(metadataFile); return dump(result, 'Amazon ECS container metadata file content', metadata.toString()); } catch (e) { if (e.code === 'ENOENT') { result.push('Error: The Amazon ECS container metadata file does not exist, although the env var is set.'); } else { throw e; } } }
let copy_r = async function (src, dest) { let exists = fs.existsSync(src); let stats = exists && await fsp.stat(src); let isDirectory = exists && stats.isDirectory(); if (exists && isDirectory) { await fsp.mkdir(dest); for (const i of (await fsp.readdir(src)).values()) { await copy_r(path.join(src, i), path.join(dest, i)) } } else await fsp.copyFile(src, dest); }
const sampleEpisode = async (epPath, steps) => { const compressed = await fsp.readFile(epPath); const episode = await new Promise((resolve) => { zlib.unzip(compressed, (_, buffer) => { const json = JSON.parse(buffer.toString()); resolve(json); }); }); const episodeSteps =sample(episode, steps); return episodeSteps; }
async function getUnmarkedDeprecations() { const deprecationFilePath = path.resolve('doc', 'api', 'deprecations.md'); const deprecationFile = await fs.readFile(deprecationFilePath, 'utf8'); const unmarkedDeprecations = [ ...deprecationFile.matchAll(newDeprecationPattern) ].map(m => m[1]); return unmarkedDeprecations; }
test('yarn-install: setup', async () => { packageManagers = await packageManager.getPackageManagers(); await mkdir(sandbox, { recursive: true }); await Promise.all([ copy(moduleFixtures, moduleTemp), copy(extraParamFixtures, extraParamTemp), copy(badFixtures, badTemp) ]); });
test('yarn-test: setup', async () => { packageManagers = await packageManager.getPackageManagers(); await mkdir(sandbox, { recursive: true }); await Promise.all([ copy(passFixtures, passTemp), copy(failFixtures, failTemp), copy(badFixtures, badTemp), copy(noTestScriptFixtures, noTestScriptTemp), copy(scriptsFixtures, scriptsTemp), copy(writeTmpdirFixtures, writeTmpdirTemp) ]); });
test('npm-install: setup', async () => { packageManagers = await packageManager.getPackageManagers(); await mkdir(sandbox, { recursive: true }); await Promise.all([ copy(moduleFixtures, moduleTemp), copy(extraParamFixtures, extraParamTemp), copy(badFixtures, badTemp) ]); });