angular-fullstack / generator-angular-fullstack

Yeoman generator for an Angular app with an Express server
https://awk34.gitbook.io/generator-angular-fullstack
6.13k stars 1.24k forks source link

chore(app): update several components #2756

Closed zeripath closed 6 years ago

zeripath commented 6 years ago

Part of #2691

zeripath commented 6 years ago

Hmm... it looks like this one is crashing the continuous integration. Not sure quite why...

Awk34 commented 6 years ago

I would assume this is why: https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#default-behavior

zeripath commented 6 years ago

Agh the mocha changes mean this is going to be slightly less simple. I guess I'll take another look tomorrow

Awk34 commented 6 years ago

Yeah, just need to make sure the servers shut down after all the tests are complete.

I really appreciate all of the contributions!

zeripath commented 6 years ago

No thank you for the generator. I'm yak shaving before I actually use the generator properly.

Awk34 commented 6 years ago

Haha 'yak shaving', that's a new one

On Tue, Jul 24, 2018, 14:11 zeripath notifications@github.com wrote:

No thank you for the generator. I'm yak shaving before I actually use the generator properly.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular-fullstack/generator-angular-fullstack/pull/2756#issuecomment-407553574, or mute the thread https://github.com/notifications/unsubscribe-auth/AFSeAnZF27F4R-Dl7uomsETLyCPjoEAYks5uJ42EgaJpZM4VdPN5 .

zeripath commented 6 years ago

@Awk34 So I'm still having difficulty figuring out what's causing this problem. Looking at templates/app/mocha.global.js the tests should close down express after every set but it seems that somehow they're not.

I've tried sticking in delays etc. I can't even see which test is causing a restart of the express server...

This is quite frustrating...

Awk34 commented 6 years ago

@zeripath my assumption about what's breaking this could be wrong. Perhaps we should test with Mocha 3.5.3 to make sure it still passes, then with 4.0.0 to make sure it starts failing.

Awk34 commented 6 years ago

If it is breaking because of what I think, then the proper investigation path would be to attach some debugger to be able to see what's keeping the process alive after the tests are done

zeripath commented 6 years ago

Ah I think I've found it.

In src/test/main.test.js:151: (amongst others)

before(function() {
      return runGen(null, {
        copyConfigFile: true,
        options: {
          skipInstall: true,
          skipConfig: true
        }
      }).then(_dir => {
        dir = _dir;
        lintResult = runCmd('npm run lint');
        clientTestResult = runCmd('npm run test:client');
        serverTestResult = runCmd('npm run test:server');
      });
    });

This causes a race somewhere in creating the express server. If these are moved out into their respective it(...) then the race stops happening and the crash goes away.

I haven't yet checked whether doing this changes the results of the serverTestResult... (i.e. is it still run in the correct directory.)

Awk34 commented 6 years ago

Hmm okay, I can see that causing issues. I did this to start the test commands so that they'd run in parallel and hopefully save time. Hopefully separating the server test command won't add too much time to the test runs.

zeripath commented 6 years ago

Cool. It looks like I've done it!

(The package-lock.json change that creeped in by accident has been removed too. )

zeripath commented 6 years ago

I think this patch might also fix issue #2746