/** * * @param {Number[]} input * @param {Number[]} output * @returns {*} */ formatDataOut(input, output) { if (this.dataFormatter) { return this.dataFormatter.toCharacters(output).join(''); } return output; }
beforeAll(async function(state) { const DEVTOOLS_DIR = path.dirname( require.resolve('chrome-devtools-frontend/front_end/shell.json')); const frontendFolder = await fsMkdtemp(path.join(os.tmpdir(), 'ndb-test-frontend-')); await new ReleaseBuilder([ path.join(__dirname, '..', 'front_end'), DEVTOOLS_DIR, path.join(__dirname, '..'), path.join(__dirname, '..', '..', '..') ], frontendFolder).buildApp('integration_test_runner'); state.frontendFolder = frontendFolder; });
_onTerminated(message, error) { this._printTestResults(); console.log(`${RED_COLOR}## TERMINATED ##${RESET_COLOR}`); console.log('Message:'); console.log(` ${RED_COLOR}${message}${RESET_COLOR}`); if (error && error.stack) { console.log('Stack:'); console.log(error.stack.split('\n').map(line => ' ' + line).join('\n')); } process.exit(2); }
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)
loadDatabase() { if (this.isDBReady) return; const db = new Datastore({ autoload: true, filename: path.join(config.dbPath, this.user._id, 'settings', 'feeds.db'), }); this.isDBReady = true; return db; }
applyStyles() { const {globalStyles, styleElement} = this; const nextStyleString = globalStyles.join(''); while (styleElement.firstChild) { styleElement.removeChild(styleElement.firstChild); } if (styleElement.styleSheet) { styleElement.styleSheet.cssText = nextStyleString; } else { styleElement.appendChild(global.document.createTextNode(nextStyleString)); } }
pkg() { // TODO(ak239spb): implement it as decorations over package.json file. try { return require(path.join(fileURLToPath(this._info.cwd), 'package.json')); } catch (e) { return null; } }
function addLineNumbers ( string ) { var chunks = string.split( "\n" ); for ( var i = 0, il = chunks.length; i < il; i ++ ) { // Chrome reports shader errors on lines // starting counting from 1 chunks[ i ] = ( i + 1 ) + ": " + chunks[ i ]; } return chunks.join( "\n" ); }
export default function buildUrl(...paths) { const url = new URL( paths .map(p => p && (p + '').trim()) // Trim each string .filter(Boolean) // Remove empty strings or other falsy paths .join('/') ); // Replace 2+ consecutive slashes with 1. (e.g. `///` --> `/`) url.set('pathname', url.pathname.replace(/\/{2,}/g, '/')); return url.href; }
export default function guidForRecording(recording) { return (recording || '') .split('/') .map(guidFor) .join('/'); }
// Defines function generateDefines ( defines ) { var value, chunk, chunks = []; for ( var d in defines ) { value = defines[ d ]; if ( value === false ) continue; chunk = "#define " + d + " " + value; chunks.push( chunk ); } return chunks.join( "\n" ); }
_trimDataString(str, ...filters) { return str.trim().split(" ").filter(word => { if (typeof filters !== "object") return true; return !filters.includes(word); }).slice(0, 2).join(" "); }
loadDatabase() { if (this.ready) return; const db = new Datastore({ autoload: true, filename: path.join(config.dbPath, this.user._id, 'notifications.db'), }); this.ready = true; return db; }
function addLineNumbers ( string ) { var chunks = string.split( "\n" ); for ( var i = 0, il = chunks.length; i < il; i ++ ) { // Chrome reports shader errors on lines // starting counting from 1 chunks[ i ] = ( i + 1 ) + ": " + chunks[ i ]; } return chunks.join( "\n" ); }
export default function guidForRecording(recording) { return (recording || '') .split('/') .map(guidFor) .join('/'); }