Giter VIP home page Giter VIP logo

gulp-ava's People

Contributors

ffmathy avatar jrolfs avatar kevva avatar leonardehrenfried avatar ntwb avatar opensrcken avatar pine avatar samueleishion avatar sholladay avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-ava's Issues

gulp.watch stops working when all tests pass

I have following gulp tasks

const test = (files) => {
  return gulp.src(files)
    .pipe(ava())
}

gulp.task('test', () => test('./test/**/*.js'))
gulp.task('test:watch', () => gulp.watch(['./test/**/*.js', './app/scripts/**/*.js'], ['test']))

When I start test:watch task, change some file, some tests fail and watch will keep watching. When all tests pass and I change some file, nothing is happening

cmd output

gulp test:watch
[11:48:00] Using gulpfile C:\test\gulpfile.js
[11:48:00] Starting 'test:watch'...
[11:48:00] Finished 'test:watch' after 26 ms

# I change file, test task starts

[11:48:04] Starting 'test'...
[11:48:07] 'test' errored after 2.51 s
[11:48:07] Error in plugin 'gulp-ava'
Message:
  4 passed  1 failed

  1. add cell

  t.same(game.addCell([], 0, 1), [[0, 0]])
              |
              [#Array#]

  AssertionError: [ [ 0, 1 ] ] === [ [ 0, 0 ] ]
    Test.fn (test/world.test.js:27:5)

# I fix failing test, test task starts

[11:48:12] Starting 'test'...
[11:48:15] gulp-ava:
  5 passed

# All tests passed, I change file again and nothing is happening

OS: win10

errors printed many times

Successful run:

[23:59:11] Using gulpfile ~/git/flowcrypt-api/test/gulpfile.js
[23:59:11] Starting 'default'...
[23:59:11] Starting 'buildTest'...
[23:59:14] Finished 'buildTest' after 3.41 s
[23:59:14] Starting 'runTest'...

  ✔ simple test fail
  ✔ simple test pass

  2 tests passed

[23:59:15] Finished 'runTest' after 1.2 s
[23:59:15] Finished 'default' after 4.61 s

Unsuccessful run:

[23:56:23] Using gulpfile ~/git/flowcrypt-api/test/gulpfile.js
[23:56:23] Starting 'default'...
[23:56:23] Starting 'buildTest'...
[23:56:26] Finished 'buildTest' after 2.88 s
[23:56:26] Starting 'runTest'...

  ✖ simple test fail Rejected promise returned by test
  ✔ simple test pass

  1 test failed

  simple test fail

  /home/luke/git/flowcrypt-api/test/build/test.ts:8

  Rejected promise returned by test. Reason:

  AssertionError {
    actual: 1,
    expected: 5,
    message: 'expected 1 to equal 5',
    showDiff: true,
  }

[23:56:27] 'runTest' errored after 866 ms
[23:56:27] Error in plugin 'gulp-ava'
Message:
    Command failed: /usr/local/bin/node /home/luke/git/flowcrypt-api/test/node_modules/gulp-ava/node_modules/ava/cli.js /home/luke/git/flowcrypt-api/test/build/test.js --color --no-silent --verbose

  ✖ simple test fail Rejected promise returned by test
  ✔ simple test pass

  1 test failed

  simple test fail

  /home/luke/git/flowcrypt-api/test/build/test.ts:8

  Rejected promise returned by test. Reason:

  AssertionError {
    actual: 1,
    expected: 5,
    message: 'expected 1 to equal 5',
    showDiff: true,
  }



Details:
    code: 1
    stdout:
    stderr:
  ✖ simple test fail Rejected promise returned by test
  ✔ simple test pass

  1 test failed

  simple test fail

  /home/luke/git/flowcrypt-api/test/build/test.ts:8

  Rejected promise returned by test. Reason:

  AssertionError {
    actual: 1,
    expected: 5,
    message: 'expected 1 to equal 5',
    showDiff: true,
  }


    failed: true
    signal: null
    cmd: /usr/local/bin/node /home/luke/git/flowcrypt-api/test/node_modules/gulp-ava/node_modules/ava/cli.js /home/luke/git/flowcrypt-api/test/build/test.js --color --no-silent --verbose
    timedOut: false
    killed: false
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false
[23:56:27] 'default' errored after 3.76 s

Notice it will print out the error 3 times. Any way to improve this?

Can not generate nyc report after test

After updating to [email protected], I can't generate report after testing.
[email protected] works correctly.

  • node: v6.10.2
  • OS: windows 10
  • ava: v0.19.1
...
  "nyc": {
    "include": [
      "dist/src/**/*.js"
    ],
    "exclude": [
      "dist/src/public/**/*.js",
      "dist/**/*.spec.js"
    ],
    "extensions": [
      ".ts"
    ],
    "cache": true,
    "all": true,
    "check-coverage": false
  }
...
gulp.task("test", ["pretest"], () => {
    return gulp.src("dist/test/**/*.spec.js")
        .pipe(ava({
            verbose: true,
            failFast: false,
            powerAssert: true,
            nyc: true,
        }));
});

Error messages not output

Error messages are not being displayed when running AVA via gulp-ava.

Node: 0.10.44
NPM: 2.15.0
AVA: ^0.15.2
Gulp AVA: ^0.12.0

Gulp task is setup exactly as example in README, but using glob instead.

return gulp.src('./test-node/**/*.js')
      .pipe(ava());

Sample Test

test('initial registration of correct GET methods on server', t => {
  // Assert
  t.deepEqual(['/'], ['/logout', '/', '/harness']);

  // have also tried t.deepEqual(['/'], ['/logout', '/', '/harness'], 'message here');
});

output from gulp task

[11:23:40] Using gulpfile ~/Documents/WorkingEnvironment/ActiveAudiences/gulpfile.js
[11:23:40] Starting 'test'...
[11:23:40] Starting 'tests:node'...

/Users/avernacchia/Documents/WorkingEnvironment/ActiveAudiences/node_modules/gulp-ava/node_modules/gulp-util/lib/PluginError.js:73
  if (!this.message) throw new Error('Missing error message');
                           ^
Error: Missing error message
    at new PluginError (/Users/avernacchia/Documents/WorkingEnvironment/ActiveAudiences/node_modules/gulp-ava/node_modules/gulp-util/lib/PluginError.js:73:28)
    at DestroyableTransform.<anonymous> (/Users/avernacchia/Documents/WorkingEnvironment/ActiveAudiences/node_modules/gulp-ava/index.js:29:24)
    at ChildProcess.exithandler (child_process.js:662:7)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:766:16)
    at Socket.<anonymous> (child_process.js:979:11)
    at Socket.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)

output from node ./node_modules/ava/cli.js

> node ./node_modules/ava/cli.js --watch

   1 failed [11:26:44]

   1. index › initial registration of correct GET methods on server

  t.deepEqual(['/'], ['/logout', '/', '/harness'])

      Test.fn (index.js:24:5)
    handleMessage (child_process.js:322:10)
    Pipe.channel.onread (child_process.js:349:11)

Buffer limit reached

When using execFile to execute test,

That is the error I get when console.logging the stderr.

I suggest to use spawn instead of execFile , because of the bufferLimitation of exec vs spawn.

There is still a bug in spawn buffer, in the case where the output is not captured, which is not our case : nodejs/node#4236

I will probably give you a PR for this fix.

Good job btw :)

{ Error: stderr maxBuffer exceeded
    at Socket.onChildStderr (child_process.js:282:14)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at Pipe.onread (net.js:554:20)

Support `nyc`

Would it be useful to integrate nyc into this?

P.S: If yes, would be interested to do a PR (yet to read the source of gulp-ava though).

Gulp throws error with no message on Windows 8

Windows 8. node v5.3.0. gulp v3.9.0.
If the test file contains no tests or an assertion fails:
Error: Missing error message at new PluginError (x:\Web\solitaire\node_modules\gulp-util\lib\PluginError.js:73:28)

Otherwise:
[21:45:31] gulp-ava:

ENOENT Error on npm3

Hi

ava binary placed on (project root)/node_modules/.bin/ava on npm3.

var BIN = path.join(__dirname, 'node_modules', '.bin', 'ava');

raises ENOENT error. How to fix this?

Thanks

option to set reporter

It's very useful to add option for setting reporters,such as tap-min,tap-spec ...
The original ava output gives to much trivial message.

Update gulp-util dependency

gulp-util has been deprecated and it causes a warning when running npm install:
https://www.npmjs.com/package/gulp-util

$ node -v
v12.6.0

$ npm -v 
6.9.0

In the context of my project:
image
image

In the context of gulp-ava:
image

There is a guide from gulpjs on how to remove this dependency:
https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5

It seems, so far in gulp-ava, that the only method used from gulp-util is PluginError. Could we remove gulp-util as a dependency and replace it with plugin-error (https://www.npmjs.com/package/plugin-error) as indicated by the guide above?

How to signal async completion in gulp 4.0?

While using Gulp 4.0 to write tests like this:

gulp.task('someTests', function () {
    gulp.src(filePath).pipe(ava({verbose: true}));
});

I got the error:

The following tasks did not complete: xxxx
Did you forget to signal async completion?

It turns out in 4.0:

Gulp tasks are asynchronous and Gulp uses async-done to wait for the task's completion. Tasks are called with a callback parameter to call to signal completion. Alternatively, Task can return a stream, a promise, a child process or a RxJS observable to signal the end of the task.

Warning: Sync tasks are not supported and your function will never complete if the one of the above strategies is not used to signal completion. However, thrown errors will be caught by Gulp.

Official doc

And there is a more detailed explanation on SO.

I picked the callback option from that SO answer:

  1. Call the callback function

This is probably the easiest way for your use case: gulp automatically passes a callback function to your task as its first argument. Just call that function when you're done:

gulp.task('message', function(done) {
    console.log("HTTP Server Started");
    done();
});

But when I tried to do this:

gulp.task('someTests', function (done) {
    gulp.src(filePath).pipe(ava({ verbose: true })).on('end', function () {
        done();
    });
});

The done function was never being called. I tried several times under different settings of my test file and was not successful. I also put a console.log before the done call, it was never being called, either. So it seems there is no 'end' emitted by pipe(ava({ verbose: true })). But I did not find a way to put a callback into the gulp-ava call.

Is it just me? Or I was doing it the wrong way?

Thanks in advance,

Liwei

Stream never ends

I get the following error in Gulp 4:

The following tasks did not complete: ava

So I guess it returns a stream that never ends, even when the process dies?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.