 Issue 29866577:
  Issue 6887 - add Chrome to "npm test"  (Closed)
    
  
    Issue 29866577:
  Issue 6887 - add Chrome to "npm test"  (Closed) 
  | Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 1 /* | 1 /* | 
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH | 
| 4 * | 4 * | 
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify | 
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as | 
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. | 
| 8 * | 8 * | 
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, | 
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 (error, stdout, stderr) => | 39 (error, stdout, stderr) => | 
| 40 { | 40 { | 
| 41 if (error) | 41 if (error) | 
| 42 { | 42 { | 
| 43 console.error(stderr); | 43 console.error(stderr); | 
| 44 reject(error); | 44 reject(error); | 
| 45 } | 45 } | 
| 46 else resolve(stdout); | 46 else resolve(stdout); | 
| 47 }); | 47 }); | 
| 48 }) | 48 }) | 
| 49 ]).then(data => | 49 ]).then(([browserBinary]) => | 
| 50 { | 50 { | 
| 51 this.driver = module.getDriver( | 51 this.driver = module.getDriver( | 
| 52 data[0], | 52 browserBinary, | 
| 53 path.resolve(`./devenv.${module.platform}`) | 53 path.resolve(`./devenv.${module.platform}`) | 
| 54 ); | 54 ); | 
| 55 return this.driver.wait(() => | 55 return this.driver.wait(() => | 
| 56 this.driver.getAllWindowHandles().then(handles => handles[1]) | 56 this.driver.getAllWindowHandles().then(handles => handles[1]) | 
| 57 ); | 57 ); | 
| 58 }).then(handle => | 58 }).then(handle => | 
| 59 this.driver.switchTo().window(handle) | 59 this.driver.switchTo().window(handle) | 
| 60 ).then(() => | 60 ).then(() => | 
| 61 this.driver.executeScript("return location.origin;") | 61 this.driver.executeScript("return location.origin;") | 
| 62 ).then(origin => | 62 ).then(origin => | 
| 63 { | 63 { | 
| 64 this.origin = origin; | 64 this.origin = origin; | 
| 65 this.platform = module.platform; | |
| 66 }); | 65 }); | 
| 67 }); | 66 }); | 
| 68 | 67 | 
| 69 for (let file of glob.sync("./test/wrappers/*.js")) | 68 for (let file of glob.sync("./test/wrappers/*.js")) | 
| 70 { | 69 { | 
| 71 // Reload the module(s) for every browser | 70 // Reload the module(s) for every browser | 
| 72 delete require.cache[require.resolve(path.resolve(file))]; | 71 let modulePath = path.resolve(file); | 
| 73 require(path.resolve(file)); | 72 delete require.cache[require.resolve(modulePath)]; | 
| 
Sebastian Noack
2018/09/01 12:28:10
You call path.resolve() twice here. Perhaps use a
 
tlucas
2018/09/01 14:46:44
Done.
 | |
| 73 require(modulePath); | |
| 74 } | 74 } | 
| 75 | 75 | 
| 76 after(function() | 76 after(function() | 
| 77 { | 77 { | 
| 78 this.driver.quit(); | 78 this.driver.quit(); | 
| 79 }); | 79 }); | 
| 80 }); | 80 }); | 
| 81 } | 81 } | 
| LEFT | RIGHT |