segment-boneyard/nightmare

Migrating to 3.0.0

matthewmueller opened this issue · 0 comments

We've worked hard to limit the breaking changes for the 3.0.0 release. Here's the scenarios that broke along with their upgrade path:

"I'm using a custom preload script"

Before you could just reference window.__nightmare.ipc and nightmare would handle the rest. Now you'll need to copy and paste the whole preloader script in from lib/preload.js

"I'm using custom events inside a custom action"

These are no longer allowed since they've opened up security vulnerabilities in nightmare. There's probably a way to refactor your custom action that would avoid custom events. Please leave a note here if you've hit this and we'll try to accommodate you.

"I'm depending on the type of value that comes back from catch"

If you have something like this:

nightmare.goto('https://google.com').catch(function (e) {
   if (typeof e === 'string') {
      console.log('do something important')
   }
})

you'll need to change your code a bit. In nightmare 3.x all returned errors are actual Error values.