Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
testOpts.drivers.forEach(function (driver) {
if (driver == 'sqlite3') {
try { fs.unlinkSync(sqliteFilename) } catch (e) {}
}
t.test(driver, function (t) {
callback(databaseUrls[driver], t)
})
})
})
}, function (error) {
should.not.exist(error);
var filename = path.resolve('test/new/out.json'),
dir = path.dirname(filename);
var jsonOutput = JSON.parse(fs.readFileSync(filename));
fs.unlinkSync(filename);
fs.rmdirSync(dir);
jsonOutput.coverage.should.equals(100);
done();
});
});
iife_files.forEach(function(file) {
fs.unlinkSync(file);
});
tmpFiles.forEach((file) => fs.unlinkSync(file))
}
job.zipResultFiles['timed_events.json'] = JSON.stringify(ipcMsg.userTimingMarks);
if (ipcMsg.pageData)
job.zipResultFiles['page_data.json'] = JSON.stringify(ipcMsg.pageData);
if (ipcMsg.netlogFile)
job.zipResultFiles['netlog.txt'] = fs.readFileSync(ipcMsg.netlogFile, "utf8");
if (ipcMsg.histogramFile) {
try {
var buffer = fs.readFileSync(ipcMsg.histogramFile);
if (buffer) {
job.resultFiles.push(new wpt_client.ResultFile(
wpt_client.ResultFile.ResultType.IMAGE,
'histograms.json.gz',
'text/plain',
buffer));
}
fs.unlinkSync(ipcMsg.histogramFile);
} catch(e) {}
}
if (ipcMsg.traceFile) {
try {
var buffer = fs.readFileSync(ipcMsg.traceFile);
if (buffer) {
job.resultFiles.push(new wpt_client.ResultFile(
wpt_client.ResultFile.ResultType.GZIP,
'trace.json.gz', 'application/x-gzip', buffer));
}
fs.unlinkSync(ipcMsg.traceFile);
} catch(e) {}
}
if (ipcMsg.lighthouseFile) {
try {
var buffer = fs.readFileSync(ipcMsg.lighthouseFile);
function removeFile(filePath) {
try {
fs.unlinkSync(filePath);
console.log(`removed '${filePath}'`);
} catch (e) {
console.warn(e);
}
}
fs.readdirSync(tempDirName).map(function(elem, index){
fs.unlinkSync(path.resolve(tempDirName, elem));
});
})
this.resolve(appUrl, null, function(dependencies) {
this.info("Found " + dependencies.length + " dependencies. Concatenating all into '" + appJs + "'");
files = dependencies.map(function(dependency) {
return path.join(src, dependency.path);
});
files.push(appJs);
fs.concat(files, appJs + '.' + temp, "\n");
nodeFs.unlinkSync(appJs);
nodeFs.renameSync(appJs + '.' + temp, appJs);
processedAssetsCount = 0;
assetsCount = assets.length;
assets.forEach(function(asset) {
file = asset.path;
destinationFile = path.join(destination, file);
if (asset.type == 'js') {
fs.write(destinationFile, preprocessor.process(destinationFile));
this.info("Processed " + file);
}
if (environment == 'testing') {
return;
}
page.children[i].parentPage = parentPage;
page.children[i].parentPageId = parentPage.id;
parentPage.children.push(page.children[i]);
} else {
page.children[i].parentPage = null;
page.children[i].parentPageId = null;
}
}
}
//Delete page from List pages
var i = this.doc.pages.indexOf(page);
this.doc.pages.splice(i, 1);
fs.unlinkSync(page.tempFilePath);
if (page.thumbPath && fs.existsSync(page.thumbPath)) fs.unlinkSync(page.thumbPath);
var refPages = [];
for (var i in this.doc.pages) {
if (this.doc.pages[i].backgroundPageId == page.id) {
refPages.push(this.doc.pages[i]);
}
}
if (refPages.length > 0) {
var thiz = this;
function updateBackgroundPage(pages, backgroundPage) {
pages.forEach(function (page) {
if (backgroundPage) {
page.backgroundPage = backgroundPage;
page.backgroundPageId = backgroundPage.id;
} else {
.then(function(status) {
if (status.action === 'overwrite') {
fs.writeFileSync(files.originalPath, fs.readFileSync(files.tmpPath));
}
fs.unlinkSync(files.tmpPath);
return status;
});
};