Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: GlobalOptions is not defined #182

Closed
YX-XiaoBai opened this issue Mar 26, 2021 · 3 comments
Closed

ReferenceError: GlobalOptions is not defined #182

YX-XiaoBai opened this issue Mar 26, 2021 · 3 comments

Comments

@YX-XiaoBai
Copy link

i get some troubles when try to run script...

node test.js
/Users/lidean/github_project/viewDiffTools/test.js:2
const differencify = new Differencify(GlobalOptions);
                                      ^

ReferenceError: GlobalOptions is not defined
    at Object.<anonymous> (/Users/lidean/github_project/viewDiffTools/test.js:2:39)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

And, here is my code

const Differencify = require('differencify');
const differencify = new Differencify(GlobalOptions);

(async () => {
    await differencify.launchBrowser();
    await differencify
      .init()
      .newPage()
      .setViewport({ width: 1600, height: 1200 })
      .goto('https://github.com/NimaSoroush/differencify')
      .waitFor(1000)
      .screenshot()
      .toMatchSnapshot()
      .result((result) => {
        console.log(result) // True or False
      })
      .close()
      .end();
    await differencify.cleanup();
  })();

And, alreadly install dependencies

  "dependencies": {
    "differencify": "^1.5.5",
    "puppeteer": "^8.0.0"
  }
@NimaSoroush
Copy link
Owner

GlobalOptions is an object that you have to define and pass it to Differencify class

For example

const differencify = new Differencify({ debug: true });

List of global options
https://github.com/NimaSoroush/differencify#globaloptions

@YX-XiaoBai
Copy link
Author

GlobalOptions is an object that you have to define and pass it to Differencify class

For example

const differencify = new Differencify({ debug: true });

List of global options
https://github.com/NimaSoroush/differencify#globaloptions

Thanks~u answer is so fast, and it's works!

@NimaSoroush
Copy link
Owner

You are welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants