<commit_before>// @types/puppeteer causing a lot of conflicts with @types/node. Removing for now.
//import puppeteer, { Browser, Page } from 'puppeteer';
const puppeteer = require( 'puppeteer' );

describe( 'Autolinker.js UMD file in browser', function() {
	let browser: any;  // :Browser
	let page: any;     // :Page
  
	beforeAll( async () => {
		browser = await puppeteer.launch( { headless: true } );
		page = await browser.newPage();

		// Print errors from the page
		page.on( 'pageerror', ( err: Error ) => console.error( err ) );

		await page.goto( `file://${__dirname}/test-browser-umd.html`, { 
			waitUntil: 'load' 
		} );
	} );
  
	afterAll( async () => {
		await browser.close();
	} );
  

	it( 'should have the `window.Autolinker` global, and Autolinker should work', async () => {
		const innerHTML = await page.evaluate( () => {
			return ( document as any ).querySelector( '#result' ).innerHTML.trim();
		} );

		expect( innerHTML ).toBe( 'Go to <a href="http://google.com">google.com</a>' );
	} );

} );<commit_msg>Add test for Autolinker.matcher.Matcher in browser<commit_after>// @types/puppeteer causing a lot of conflicts with @types/node. Removing for now.
//import puppeteer, { Browser, Page } from 'puppeteer';
const puppeteer = require( 'puppeteer' );

describe( 'Autolinker.js UMD file in browser', function() {
	let browser: any;  // :Browser
	let page: any;     // :Page
  
	beforeAll( async () => {
		browser = await puppeteer.launch( { headless: true } );
		page = await browser.newPage();

		// Print errors from the page
		page.on( 'pageerror', ( err: Error ) => console.error( err ) );

		await page.goto( `file://${__dirname}/test-browser-umd.html`, { 
			waitUntil: 'load' 
		} );
	} );
  
	afterAll( async () => {
		await browser.close();
	} );
  

	it( 'should have the `window.Autolinker` global, and Autolinker should work', async () => {
		const innerHTML = await page.evaluate( () => {
			return ( document as any ).querySelector( '#result' ).innerHTML.trim();
		} );

		expect( innerHTML ).toBe( 'Go to <a href="http://google.com">google.com</a>' );
	} );
  

	it( 'should expose `Autolinker.matcher.Matcher` so that it can be extended', async () => {
		const typeofMatcher = await page.evaluate( () => {
			return typeof ( window as any ).Autolinker.matcher.Matcher;
		} );

		expect( typeofMatcher ).toBe( 'function' );  // constructor function
	} );

} );
{'fraction_non_alphanumeric': 0.17027477102414654, 'fraction_numerical': 0.0, 'mean_word_length': 3.4091743119266056, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, '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': '813279', 'n_tokens_mistral': 849, 'n_tokens_neox': 791, 'n_words': 224}