<commit_before>/* eslint-disable no-undef, no-process-exit */
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const puppeteer = require('puppeteer');
const webpack = require('webpack');
const config = require('../../webpack.config');
const middleware = require('webpack-dev-middleware');
const express = require('express');
const devRoutes = require('../../server/bin/test');
const app = express();

const wpm = middleware(webpack(config(null, { mode: 'development' })), {
  logLevel: 'silent'
});
app.use(wpm);
devRoutes(app, { middleware: wpm });

function onConsole(msg) {
  // excluding 'log' because mocha uses it to write the json output
  if (msg.type() !== 'log') {
    console.error(msg.text());
  }
}

const server = app.listen(async function() {
  let exitCode = -1;
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    page.on('console', onConsole);<commit_msg>reduce log noise in puppeteer test<commit_after>/* eslint-disable no-undef, no-process-exit */
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const puppeteer = require('puppeteer');
const webpack = require('webpack');
const config = require('../../webpack.config');
const middleware = require('webpack-dev-middleware');
const express = require('express');
const devRoutes = require('../../server/bin/test');
const app = express();

const wpm = middleware(webpack(config(null, { mode: 'development' })), {
  logLevel: 'silent'
});
app.use(wpm);
devRoutes(app, { middleware: wpm });

// eslint-disable-next-line no-unused-vars
function onConsole(msg) {
  // uncomment to debug
  // console.error(msg.text());
}

const server = app.listen(async function() {
  let exitCode = -1;
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    page.on('console', onConsole);
{'fraction_non_alphanumeric': 0.17776612480335605, 'fraction_numerical': 0.001048767697954903, 'mean_word_length': 4.578947368421052, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7213761', 'n_tokens_mistral': 599, 'n_tokens_neox': 592, 'n_words': 155}