File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- process . env . CHROME_BIN = require ( 'puppeteer' ) . executablePath ( ) ;
1+ const childProcess = require ( 'child_process' ) ;
2+
3+ function _resolvePuppeteerExecutablePathSync ( ) {
4+ return childProcess . execFileSync ( process . execPath , [
5+ "-e" ,
6+ "require('puppeteer').executablePath().then((path) => process.stdout.write(path || ''))"
7+ ] , {
8+ encoding : "utf8"
9+ } ) . trim ( ) ;
10+ }
211
312module . exports = function ( config ) {
13+ // Puppeteer v25+ resolves executablePath asynchronously, so resolve it in a subprocess
14+ // to keep this Karma config synchronous.
15+ try {
16+ const chromePath = _resolvePuppeteerExecutablePathSync ( ) ;
17+ if ( chromePath ) {
18+ process . env . CHROME_BIN = chromePath ;
19+ process . env . CHROMIUM_BIN = chromePath ;
20+ }
21+ } catch ( error ) {
22+ console . warn ( "Puppeteer executable path could not be resolved. Chrome/Chromium tests may be skipped." ) ;
23+ process . exit ( 0 ) ;
24+ }
25+
426 config . set ( {
527 browsers : [ "Chromium_without_security" ] ,
628 listenAddress : 'localhost' ,
@@ -57,4 +79,4 @@ module.exports = function (config) {
5779
5880 logLevel : config . LOG_INFO
5981 } )
60- } ;
82+ } ;
Original file line number Diff line number Diff line change 1- process . env . CHROME_BIN = require ( 'puppeteer' ) . executablePath ( ) ;
1+ const childProcess = require ( 'child_process' ) ;
2+
3+ function _resolvePuppeteerExecutablePathSync ( ) {
4+ return childProcess . execFileSync ( process . execPath , [
5+ "-e" ,
6+ "require('puppeteer').executablePath().then((path) => process.stdout.write(path || ''))"
7+ ] , {
8+ encoding : "utf8"
9+ } ) . trim ( ) ;
10+ }
211
312module . exports = function ( config ) {
13+ // Puppeteer v25+ resolves executablePath asynchronously, so resolve it in a subprocess
14+ // to keep this Karma config synchronous.
15+ try {
16+ const chromePath = _resolvePuppeteerExecutablePathSync ( ) ;
17+ if ( chromePath ) {
18+ process . env . CHROME_BIN = chromePath ;
19+ process . env . CHROMIUM_BIN = chromePath ;
20+ }
21+ } catch ( error ) {
22+ console . warn ( "Puppeteer executable path could not be resolved. Chrome/Chromium tests may be skipped." ) ;
23+ process . exit ( 0 ) ;
24+ }
25+
426 config . set ( {
527 browsers : [ "Chromium_without_security" ] ,
628 listenAddress : 'localhost' ,
Original file line number Diff line number Diff line change 9292 "karma-mocha" : " ^2.0.1" ,
9393 "karma-spec-reporter" : " ^0.0.36" ,
9494 "karma-typescript" : " ^5.5.3" ,
95- "puppeteer" : " ^24.4 .0" ,
95+ "puppeteer" : " ^25.1 .0" ,
9696 "rollup" : " ^4.54.0" ,
9797 "rollup-plugin-minify-es" : " ^1.1.1" ,
9898 "rollup-plugin-istanbul" : " ^5.0.0" ,
105105 "copyfiles" : " ^2.4.1"
106106 }
107107}
108+
Original file line number Diff line number Diff line change 8787 "grunt" : " ^1.6.2" ,
8888 "grunt-cli" : " ^1.4.3" ,
8989 "nyc" : " ^18.0.0" ,
90- "puppeteer" : " ^24.4 .0" ,
90+ "puppeteer" : " ^25.1 .0" ,
9191 "typedoc" : " ^0.28.2" ,
9292 "typedoc-github-theme" : " ^0.4.0" ,
9393 "typescript" : " ~5.2.2" ,
Original file line number Diff line number Diff line change 1- process . env . CHROME_BIN = require ( 'puppeteer' ) . executablePath ( ) ;
1+ const childProcess = require ( 'child_process' ) ;
2+
3+ function _resolvePuppeteerExecutablePathSync ( ) {
4+ return childProcess . execFileSync ( process . execPath , [
5+ "-e" ,
6+ "require('puppeteer').executablePath().then((path) => process.stdout.write(path || ''))"
7+ ] , {
8+ encoding : "utf8"
9+ } ) . trim ( ) ;
10+ }
211
312module . exports = function ( config ) {
13+ // Puppeteer v25+ resolves executablePath asynchronously, so resolve it in a subprocess
14+ // to keep this Karma config synchronous.
15+ try {
16+ const chromePath = _resolvePuppeteerExecutablePathSync ( ) ;
17+ if ( chromePath ) {
18+ process . env . CHROME_BIN = chromePath ;
19+ process . env . CHROMIUM_BIN = chromePath ;
20+ }
21+ } catch ( error ) {
22+ console . warn ( "Puppeteer executable path could not be resolved. Chrome/Chromium tests may be skipped." ) ;
23+ process . exit ( 0 ) ;
24+ }
25+
426 config . set ( {
527 browsers : [ "Chromium_without_security" ] ,
628 listenAddress : 'localhost' ,
@@ -57,4 +79,4 @@ module.exports = function (config) {
5779
5880 logLevel : config . LOG_INFO
5981 } )
60- } ;
82+ } ;
Original file line number Diff line number Diff line change 1- process . env . CHROME_BIN = require ( 'puppeteer' ) . executablePath ( ) ;
1+ const childProcess = require ( 'child_process' ) ;
2+
3+ function _resolvePuppeteerExecutablePathSync ( ) {
4+ return childProcess . execFileSync ( process . execPath , [
5+ "-e" ,
6+ "require('puppeteer').executablePath().then((path) => process.stdout.write(path || ''))"
7+ ] , {
8+ encoding : "utf8"
9+ } ) . trim ( ) ;
10+ }
211
312module . exports = function ( config ) {
13+ // Puppeteer v25+ resolves executablePath asynchronously, so resolve it in a subprocess
14+ // to keep this Karma config synchronous.
15+ try {
16+ const chromePath = _resolvePuppeteerExecutablePathSync ( ) ;
17+ if ( chromePath ) {
18+ process . env . CHROME_BIN = chromePath ;
19+ process . env . CHROMIUM_BIN = chromePath ;
20+ }
21+ } catch ( error ) {
22+ console . warn ( "Puppeteer executable path could not be resolved. Chrome/Chromium tests may be skipped." ) ;
23+ process . exit ( 0 ) ;
24+ }
25+
426 config . set ( {
527 browsers : [ "Chromium_without_security" ] ,
628 listenAddress : 'localhost' ,
@@ -67,4 +89,4 @@ module.exports = function (config) {
6789 captureTimeout : 60000 ,
6890 browserNoActivityTimeout : 60000
6991 } ) ;
70- } ;
92+ } ;
Original file line number Diff line number Diff line change 9393 "karma-mocha" : " ^2.0.1" ,
9494 "karma-spec-reporter" : " ^0.0.36" ,
9595 "karma-typescript" : " ^5.5.3" ,
96- "puppeteer" : " ^24.4 .0" ,
96+ "puppeteer" : " ^25.1 .0" ,
9797 "rollup" : " ^4.54.0" ,
9898 "rollup-plugin-minify-es" : " ^1.1.1" ,
9999 "rollup-plugin-istanbul" : " ^5.0.0" ,
106106 "copyfiles" : " ^2.4.1"
107107 }
108108}
109+
You can’t perform that action at this time.
0 commit comments