question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I tried running the example in the docs but with an obvious error at the top:

// example.js
FOOBAR

describe('Google searching', function() {
  before(function() {
    casper.start('http://www.google.fr/')
  })

  it('should retrieve 10 or more results', function() {
    casper.then(function() {
      'Google'.should.matchTitle
      'form[action="/search"]'.should.be.inDOM.and.be.visible
      this.fill('form[action="/search"]', {
        q: 'casperjs'
      }, true)
    })

    casper.waitForUrl(/q=casperjs/, function() {
      (/casperjs/).should.matchTitle
    })
  })
})

and I ran it with:

$ mocha-casperjs example.js

  0 passing (1ms)

I would have expected an error to be raised like mocha does:

mocha example.js                                                                                                           

example.js:1
(function (exports, require, module, __filename, __dirname) { FOOBAR
                                                              ^

ReferenceError: FOOBAR is not defined
    at Object.<anonymous> (/Users/Choxi/Code/Bloc/mocha-casperjs/example.js:1:63)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at /usr/local/lib/node_modules/mocha/lib/mocha.js:220:27
    at Array.forEach (native)
    at Mocha.loadFiles (/usr/local/lib/node_modules/mocha/lib/mocha.js:217:14)
    at Mocha.run (/usr/local/lib/node_modules/mocha/lib/mocha.js:469:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:404:18)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:146:18)
    at node.js:404:3

Am I doing something wrong?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:2
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
brettjonesdevcommented, Jul 8, 2016

OK cool, I thought your previous comment meant it was unfixable, phew! 😃 Btw awesome work on this project, we’ve been using casper’s built-in tester module for our integration test suite, but it’s so janky compared to mocha/chai. This is exactly what we were looking for, and I’m excited to start migrating our tests over!

0reactions
nathanboktaecommented, Apr 12, 2017

in my case, require() inside cli.js is always returning {}, even if the require was successful.

That is casperjs’ patchedRequire stuff that also caused me a lot of pain when creating this project. Not sure the shape of it now that n1k0 no longer runs casperjs.

while I miss some of the convenience and features that phantom/casper offered, webdriverio + chromedriver ended up being a much better experience overall.

Totally understood. while phantomjs / casperjs is great when it’s going (I was seeing tests run 5x faster than selenium + chrome in 2013 and very derministically) it’s a pain to debug. Maybe phantomjs2 has this story a bit better with better dev tools? Also now Chrome can go headless on linux via xvbf.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dealing with silent failures - Michael Greenhill
So how can I manage silent failures? Explicit failures; Implicit failures. What about the silent part? Request Body; Request Headers; Generating a JIRA...
Read more >
No more silent failures! - Medium
No more silent failures! Have you ever released something and immediately after ... If something unexpected happens, it will fail silently.
Read more >
How To Detect Silent Failure in Machine Learning Models
To protect yourself and your business from these problems, it's important to start and continue monitoring your Machine Learning models.
Read more >
The Silent Semantic Failures That Break Distributed Systems
Most failures in distributed systems are obvious: crash, timeout, error code, exception. Those can be remedied. But there is another group of ...
Read more >
The Prevention Continuum: Preventing Silent Failure
To prevent silent detection failure that plagues all legacy security solutions, CrowdStrike Falcon® incorporates Endpoint Activity Monitoring ( ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found