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.

Couldn't start backstop as a child process

See original GitHub issue

I’m trying to use backstopjs into a express application. I’m creating dynamically configuration file using original file just overwriting the scenario (I wanna run just to one scenario in this case). So here the problem happens.

const createReference = (newSpec) => {
  const originalConfigFile = require('../tests/config.json');

  const tmpFile = '/tmp/new-config.json';
  const referencesPath = '/tmp/references';

  const newConfig = {
    ...omit(originalConfigFile, ['onBeforeScript', 'onReadyScript', 'scenarios', 'paths.bitmaps_reference']),
    scenarios: [newSpec],
    paths: {
      bitmaps_reference: "/tmp/references",
      bitmaps_test: "/tmp/bitmaps_test",
      casper_scripts: "/tmp/casper_scripts",
      html_report: "/tmp/html_report",
      ci_report: "/tmp/ci_report",
    }
  };

  fs.writeFile(tmpFile, JSON.stringify(newConfig, null, 2), (err) => {
    exec(`backstop reference --configPath=${tmpFile}`, (err, stdout, stderr) => {
      if (err) {
        console.log(stdout);
        return;
      }
      // do something else
    });
  });
}

When I run this same code (backstop reference --configPath=/tmp/new-config.json) separately from my express application, it’s sounds good, but in child process it returns:

BackstopJS loading config:  /tmp/new-spec.json

COMMAND | Executing core for `reference`
  clean | /tmp/references was cleaned.

Running CasperJS with:  [ '/Users/marciovicente/git/test-project/node_modules/backstopjs/capture/genBitmaps.js',
  '--engine=slimerjs',
  '--captureConfigFileName=/var/folders/m_/ydbqsgh94vlf0dwk_n1cfhv40000gn/T/capture/75b3b173ef6003982053521774d69d83008ea8e6.json' ]
CasperJS:  Debug is enabled!
CasperJS:  CREATING NEW REFERENCE FILES

Testing script failed with code: 1

An unexpected error occured. You may want to try setting the debug option to `true` in your config file.
COMMAND | Command `reference` ended with an error
COMMAND | Error: An unexpected error occured. You may want to try setting the debug option to `true` in your config file.
              at ChildProcess.<anonymous> (/Users/marciovicente/git/test-project/node_modules/backstopjs/core/util/createBitmaps.js:70:18)
              at emitTwo (events.js:106:13)
              at ChildProcess.emit (events.js:194:7)
              at maybeClose (internal/child_process.js:899:16)
              at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

I’ve already tried to use the backstop package instead of run binary from child process but the error still happens.

Here is my config output (from /tmp/new-config.json)

{  
   "id":"prod_test",
   "viewports":[  
      {  
         "name":"default",
         "width":1024,
         "height":768
      }
   ],
   "readyEvent":null,
   "delay":500,
   "misMatchThreshold":0.1,
   "paths":{  
      "bitmaps_reference":"/tmp/references",
      "bitmaps_test":"/tmp/bitmaps_test",
      "casper_scripts":"/tmp/casper_scripts",
      "html_report":"/tmp/html_report",
      "ci_report":"/tmp/ci_report"
   },
   "casperFlags":[  

   ],
   "engine":"slimerjs",
   "report":[  
      "CI"
   ],
   "debug":true,
   "scenarios":[  
      {  
         "label":"Google",
         "url":"http://google.com"
      }
   ]
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
klausbayrhammercommented, Apr 5, 2017

Probably it’s the child process’ changed cwd? Or any ENVs changed?

0reactions
marciovicentecommented, Apr 6, 2017

Ok guys, I figured out what’s happening… I don’t know the reason, but the problem is when I’m running with slimerjs. I chose slimer to support all new frameworks (React client side render, for example). So, I’ll close this issue, and thank you for your attention @klausbayrhammer @garris 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

backstop reference fails to launch browser on windows #1157
On my windows 10 machine the backstop reference command fails with the following error: COMMAND | Command "reference" ended with an error ...
Read more >
Click function in backstopjs not working while trying to log in ...
For some reason I cannot perform click function as backstopjs doesn't detect my click command. Following is the backstop.json snippet for ...
Read more >
Back Stop: Definition, How It Works in Offering, and Example
A back stop provides last-resort support or security in a securities offering for the unsubscribed portion of shares.
Read more >
AppDomain.UnhandledException Event - Microsoft Learn
Starting with the .NET Framework version 2.0, this backstop for unhandled exceptions in child threads was removed, because the cumulative effect of such ......
Read more >
Microsoft Defender Attack Surface Reduction recommendations
The update mechanism of the Adobe application attempts to launch a child process to do the work. This is a problem for the...
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