debugger icon indicating copy to clipboard operation
debugger copied to clipboard

Add test case for `yarn start `

Open ruturajv opened this issue 7 years ago • 7 comments

At times it happens some code gets checked in and build processes or bootstrap processes fail. One of the most frustrating ones could be yarn start. If a new developer isn't able to do a clean yarn start, then he/she could lose interest and focus quickly. Long time back netmonitor used to run with yarn start now I've got to painfully wait for mozilla-central builds.

Recently there was some issue with yarn start, a patch was suggested by @fvsch and it worked. Something like comment out require("postcss-bidirection") in postcss.config.js

I was lucky to find fvsch's reply quickly. Instead can we have a test case that runs and then waits for say 10s and figures out that the process of yarn start is still running or hasn't ended with non 0 status code.

I'm not sure if its correct to file this bug, but would greatly appreciate if something like this is in place.

Thoughts @fvsch @jasonLaster ?

ruturajv avatar Mar 25 '19 14:03 ruturajv

Thanks @ruturajv, i agree that this would be nice. I think we could write a small node script that executes yarn start and checks to see if it started correctly. Perhaps if you can curl http://localhost:8000/assets/build/debugger.js...

jasonLaster avatar Mar 25 '19 14:03 jasonLaster

Great, I'll try if I can create something on those lines..

ruturajv avatar Mar 25 '19 14:03 ruturajv

I have a very rudimentary script doing stuff (just console.logging instead of asserting). However it has 1 problem, the yarn start process invokes another node bin/dev-server process. This child process doesn't get killed. There are some ways of fixing that but they might be very OS specific or I'ven't read the docs properly :)

Here is the script anyways. Your views @jasonLaster ?

const { spawn } = require('child_process');
const http = require('http');

let yarnProc;
function yarnStart(){
  yarnProc = spawn('yarn', ['start']);

  yarnProc.stdout.on('data', (data) => {
    console.log(`stdout: ${data}`);
    if(data.indexOf("8000") > 0){
      callDebuggerJs();
    }
  });
  yarnProc.on('close', (code) => {
    console.log(`child process exited with code ${code}`);
  });
}

function callDebuggerJs() {
  let req = http.get('http://localhost:8000/assets/build/debugger.js', (resp) => {
    let data = '';
    // A chunk of data has been recieved.
    resp.on('data', (chunk) => {
      data += chunk;
    });
    // The whole response has been received. Print out the result.
    resp.on('end', () => {
      console.log(`${data.length} bytes downloaded`);

      // assert status code is 200
      console.log(resp.statusCode);

      // kill the process
      console.log(yarnProc.kill());
      process.exit();
    });
  }).on("error", (err) => {
    console.log("Error: " + err.message);
  });
//  req.end(e => console.log(e));

}
yarnStart();

ruturajv avatar Mar 25 '19 17:03 ruturajv

/claim

lchipres avatar Sep 15 '19 17:09 lchipres

Thanks for claiming the issue! :wave:

!!! Please check your email and confirm the invitation

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Sep 15 '19 17:09 claim

/unclaim

lchipres avatar Sep 15 '19 20:09 lchipres

Support for the Launchpad has been deprecated, closing.

Also, Firefox Developer Tools (including Debugger tool) development is entirely happening in Bugzilla and new issues should be reported here: https://bugzilla.mozilla.org/enter_bug.cgi?product=DevTools&component=Debugger

Honza

janodvarko avatar Feb 25 '21 09:02 janodvarko