Browse Source

CI: Simpler generateUUID's Math.random() replacement.

Mr.doob 5 years ago
parent
commit
0a3a110bcb
2 changed files with 3 additions and 1 deletions
  1. 2 0
      test/e2e/deterministic-injection.js
  2. 1 1
      test/e2e/puppeteer.js

+ 2 - 0
test/e2e/deterministic-injection.js

@@ -6,6 +6,8 @@
 
 
 	/* Deterministic random */
 	/* Deterministic random */
 
 
+	window.Math._random = window.Math.random;
+
 	let seed = Math.PI / 4;
 	let seed = Math.PI / 4;
 	window.Math.random = function () {
 	window.Math.random = function () {
 
 

+ 1 - 1
test/e2e/puppeteer.js

@@ -91,7 +91,7 @@ const pup = puppeteer.launch( {
 	await page.evaluateOnNewDocument( injection );
 	await page.evaluateOnNewDocument( injection );
 
 
 	const threeJsBuild = fs.readFileSync( 'build/three.module.js', 'utf8' )
 	const threeJsBuild = fs.readFileSync( 'build/three.module.js', 'utf8' )
-		.replace( /Math\.random\(\) \* 0xffffffff/g, 'crypto.getRandomValues(new Uint32Array(1))[0]' );
+		.replace( /Math\.random\(\) \* 0xffffffff/g, 'Math._random() * 0xffffffff' );
 	await page.setRequestInterception( true );
 	await page.setRequestInterception( true );
 
 
 	page.on( 'console', msg => ( msg.text().slice( 0, 8 ) === 'Warning.' ) ? console.null( msg.text() ) : {} );
 	page.on( 'console', msg => ( msg.text().slice( 0, 8 ) === 'Warning.' ) ? console.null( msg.text() ) : {} );