Created
March 15, 2017 09:51
-
-
Save entrptaher/57752da677dda4af90b8565b1969aa37 to your computer and use it in GitHub Desktop.
Maybe some not so professional way of debugging nightmare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Nightmare = require('nightmare'), | |
path = require('path'), // ADD THIS | |
nightmare = Nightmare({ | |
show: true, | |
alwaysOnTop: false, | |
webPreferences: { | |
preload: path.resolve('preload.js') // USE PATH.RESOLVE FUNCTION | |
} | |
}); | |
nightmare | |
.goto('http://www.example.com') | |
.then(() => { | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "home", | |
"version": "1.0.0", | |
"main": "index.js", | |
"license": "MIT", | |
"dependencies": { | |
"express": "^4.15.2", | |
"nightmare": "^2.10.0", | |
"watchr": "^3.0.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.__nightmare = {}; | |
__nightmare.ipc = require('electron').ipcRenderer; | |
// Import the watching library | |
var watchr = require('watchr') | |
var fs = require('fs'); | |
// Define our watching parameters | |
var path = process.cwd() | |
function listener (changeType, fullPath, currentStat, previousStat) { | |
eval(fs.readFileSync(fullPath, 'utf8')); | |
} | |
function next (err) { | |
if ( err ) return console.log('watch failed on', path, 'with error', err) | |
console.log('watch successful on', path) | |
} | |
// Watch the path with the change listener and completion callback | |
var stalker = watchr.open("runMe.js", listener, next) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let bar = "foo" | |
console.log(bar) | |
debugger; | |
console.log(bar) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment