Browse Source

Fix ReferenceError in check-coverage.js

Takahiro 4 năm trước cách đây
mục cha
commit
a3e1703aeb
1 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 6 4
      test/e2e/check-coverage.js

+ 6 - 4
test/e2e/check-coverage.js

@@ -13,11 +13,13 @@ const S = fs.readdirSync( './examples/screenshots' )
 
 
 // files.js
 // files.js
 const F = [];
 const F = [];
-eval( fs.readFileSync( './examples/files.js' ).toString() );
-for ( var key in files ) {
+// To expose files variable to out of eval scope, we need var statement, not const.
+eval( fs.readFileSync( './examples/files.js' )
+	.toString().replace( 'const files', 'var files' ) );
+for ( const key in files ) {
 
 
-	var section = files[ key ];
-	for ( var i = 0, len = section.length; i < len; i ++ ) {
+	const section = files[ key ];
+	for ( let i = 0, len = section.length; i < len; i ++ ) {
 
 
 		F.push( section[ i ] );
 		F.push( section[ i ] );