★ wanayoo — archive 1999 https://github.com/firefox-devtools/debugger/issues/8159Nouvelle recherche | Portail wanayoo
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

Add test case for `yarn start ` #8159

Open
ruturajv opened this issue Mar 25, 2019 · 6 comments
Open

Add test case for `yarn start ` #8159

ruturajv opened this issue Mar 25, 2019 · 6 comments
Labels

Comments

@ruturajv
Copy link
Contributor

@ruturajv ruturajv commented Mar 25, 2019

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 ?

@claim claim bot added the not-available label Mar 25, 2019
@jasonLaster
Copy link
Contributor

@jasonLaster jasonLaster commented Mar 25, 2019

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...

@ruturajv
Copy link
Contributor Author

@ruturajv ruturajv commented Mar 25, 2019

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

@ruturajv
Copy link
Contributor Author

@ruturajv ruturajv commented Mar 25, 2019

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();
@lchipres
Copy link

@lchipres lchipres commented Sep 15, 2019

/claim

@claim claim bot added the in progress label Sep 15, 2019
@claim
Copy link

@claim claim bot commented Sep 15, 2019

Thanks for claiming the issue! 👋

!!! 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.

🦊 Debugger team!

@lchipres
Copy link

@lchipres lchipres commented Sep 15, 2019

/unclaim

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

Successfully merging a pull request may close this issue.

None yet
4 participants