Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const _ = require('lodash')
const babelConfig = JSON.parse(
require('fs').readFileSync(`${__dirname}/../.babelrc`)
)
/**
* Headless Chrome setup
*/
const ChromiumRevision = require('puppeteer/package.json').puppeteer
.chromium_revision
const Downloader = require('puppeteer/utils/ChromiumDownloader')
const revisionInfo = Downloader.revisionInfo(
Downloader.currentPlatform(),
ChromiumRevision
)
process.env.CHROMIUM_BIN = revisionInfo.executablePath
/**
* Karma config
*/
module.exports = function(config) {
config.set({
// browsers: ['ChromiumHeadless'],
browsers: ['Chrome'],
platform,
arch
] = archArg.split('-');
if (platform === 'win32' && arch === 'x64') {
platform = 'win64'
}
if (platform === 'darwin') {
platform = 'mac'
}
const outputPath = "dist/" + (process.argv[3] || `plugin-${archArg}`);
const browserFetcher = Puppeteer.createBrowserFetcher({ platform });
const revision = puppeteerPackageJson.puppeteer.chromium_revision;
browserFetcher
.download(revision, null)
.then(() => {
console.log("Chromium downloaded");
const parts = browserFetcher.revisionInfo(revision).executablePath.split(path.sep);
// based on where puppeteer puts the binaries see BrowserFetcher.revisionInfo()
while (!parts[parts.length - 1].startsWith('chrome-')) {
parts.pop()
}
let execPath = parts.join(path.sep);
child_process.execSync(`cp -RP ${execPath} ${outputPath}`);
console.error(stderr);
return process.exit(1);
}
return stdout.trim();
};
// This is used in docker to symlink the puppeteer's
// chrome to a place where most other libraries expect it
// (IE: WebDriver) without having to specify it
if (!IS_DOCKER) {
return;
}
const browserFetcher = puppeteer.createBrowserFetcher();
const { executablePath } = browserFetcher.revisionInfo(packageJson.puppeteer.chromium_revision);
(async () => fs.existsSync(CHROME_BINARY_LOCATION) ?
Promise.resolve() :
exec(`ln -s ${executablePath} ${CHROME_BINARY_LOCATION}`)
)();
import puppeteerPkg from 'puppeteer/package.json'
import Downloader from 'puppeteer/utils/ChromiumDownloader'
import config from './config'
import webpackConfig from './webpack.config.babel'
const revision = puppeteerPkg.puppeteer.chromium_revision
const revisionInfo = Downloader.revisionInfo(Downloader.currentPlatform(), revision)
process.env.CHROME_BIN = revisionInfo.executablePath
const formatError = (msg) => {
// filter out empty lines and node_modules
if (!msg.trim() || /~/.test(msg)) return ''
// indent the error beneath the it() message
let newLine = ` ${msg}`
if (newLine.includes('webpack:///')) {
// remove webpack:///
newLine = newLine.replace('webpack:///', '')
// remove bundle location, showing only the source location
export const CHROME_BINARY_LOCATION: string = process.env.CHROME_BINARY_LOCATION || (() => {
// If it's installed already (docker) use it
if (IS_DOCKER) {
return CHROME_BINARY_DEFAULT_LOCATION;
} else {
// Use puppeteer's copy otherwise
const browserFetcher = puppeteer.createBrowserFetcher();
return browserFetcher.revisionInfo(packageJson.puppeteer.chromium_revision).executablePath;
}
})();
const path = require("path");
const fs = require("fs");
const lighthouse = require("lighthouse");
const chromeLauncher = require("chrome-launcher");
const BrowserFetcher = require("puppeteer/lib/BrowserFetcher");
/* IMPORTANT ensure the correct node modules path here */
const browserFetcher = new BrowserFetcher(
path.join(__dirname, "node_modules/puppeteer/")
);
const packageJson = require("puppeteer/package.json");
const revision = packageJson.puppeteer.chromium_revision;
const revisionInfo = browserFetcher.revisionInfo(revision);
let opts = {
lighthouseFlags: {
output: "json",
disableDeviceEmulation: false,
port: "",
output: "json",
saveAssets: false
},
chromeFlags: ["--headless", "--no-sandbox", "--disable-gpu"]
};
const writeCheckFile = (path = "", content = "") => {
fs.writeFile(`${path}report.json`, content, function(err) {
if (err) {
'use strict';
const TestServer = require('karma').Server;
const _ = require('underscore');
const path = require('path');
const Promise = require('bluebird');
const fs = require('fs');
const colors = require('colors');
const readDir = Promise.promisify(fs.readdir);
const writeFile = Promise.promisify(fs.writeFile);
const ChromiumRevision = require('puppeteer/package.json').puppeteer.chromium_revision;
const Downloader = require('puppeteer/utils/ChromiumDownloader');
const revisionInfo = Downloader.revisionInfo(Downloader.currentPlatform(), ChromiumRevision);
process.env.CHROME_BIN = revisionInfo.executablePath;
const filesToSkip = [
'CoveoJsSearch.Lazy.js',
'CoveoJsSearch.Dependencies.js',
'CoveoJsSearch.js',
'Checkbox.js',
'DatePicker.js',
'Dropdown.js',
'FormGroup.js',
'MultiSelect.js',
'NumericSpinner.js',
'RadioButton.js',
const ChromiumRevision = require('puppeteer/package.json').puppeteer.chromium_revision;
const Downloader = require('puppeteer/utils/ChromiumDownloader');
const revisionInfo = Downloader.revisionInfo(Downloader.currentPlatform(), ChromiumRevision);
process.env.CHROME_BIN = revisionInfo.executablePath;
var configuration = {
singleRun: true,
browsers: ['ChromeHeadless'],
frameworks: ['jasmine'],
browserNoActivityTimeout: 90000,
browserDisconnectTolerance: 10,
files: [
{
pattern: './node_modules/es6-promise/dist/es6-promise.auto.js',
watched: false
},