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

jest.runCli returns a promise now, the callback in tasks/jest.js never gets executed #896

Closed
1hella opened this issue Jun 26, 2018 · 0 comments · Fixed by #897
Closed

jest.runCli returns a promise now, the callback in tasks/jest.js never gets executed #896

1hella opened this issue Jun 26, 2018 · 0 comments · Fixed by #897

Comments

@1hella
Copy link
Contributor

1hella commented Jun 26, 2018

I'm submitting a bug report

  • Library Version:
    0.33.1

Please tell us about your environment:

  • Operating System:
    OSX 10.13.5

  • Node Version:
    9.11.1

  • NPM Version:
    5.8.0

  • Browser:
    N/A

  • Language:
    all

  • Loader/bundler:
    all

Current behavior:

I wanted to run the jest tests automatically when running au build --env dev so I added the following to tasks/build.js:

import jest from './jest';

...

function test(done) {
  if (!production) {
    jest(done);
  } else {
    done();
  }
}

const build = gulp.series(
  clearDist,
  test,
  configureEnvironment,
  buildWebpack
);

And the build exits every time after the test phase.

Changing

jest.runCLI(options, [path.resolve(__dirname, '../../')], (result) => {
  if (result.numFailedTests || result.numFailedTestSuites) {
    cb(new gutil.PluginError('gulp-jest', { message: 'Tests Failed' }));
  } else {
    cb();
  }
});

to

 
  jest.runCLI(options, [path.resolve(__dirname, '../../')]).then((result) => {
    if (result.numFailedTests || result.numFailedTestSuites) {
      cb(new gutil.PluginError('gulp-jest', { message: 'Tests Failed' }));
    } else {
      cb();
    }
  });

fixes this issue.

1hella added a commit to 1hella/cli that referenced this issue Jun 26, 2018
jest.runCli returns a promise. This change updates the usage of jest.runCli to use the promise rather than pass in a callback which never will get executed.

closes aurelia#896
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant