Coder Social home page Coder Social logo

grunt-mocha-cli's People

Contributors

daniellockyer avatar dependabot[bot] avatar mortonfox avatar rowno avatar rubenv avatar shinnn avatar wtrocki 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

grunt-mocha-cli's Issues

What is the use of `globals` and how to use it properly?

globals (array) - allow the given comma-delimited global names.

I searched in google for some time and looked at the documentation but I couldn't understand what exactly the about statement mean. Can you please update the documentation with an example?

Unable to repeat the same test file multiple times

I am trying to run programmatically a test case scenario. I realized that each file is only running once. Here is my example

module.exports = function(grunt) {
  require('load-grunt-tasks')(grunt);

  grunt.initConfig({
    mochacli: {
      options: {
        bail: false,
        colors: true,
        // timeout: 900000
      },
      files: [
        'test/adminLogin.spec.js',
        
        'test/createUser.spec.js',
        'test/deleteUser.spec.js',
        
        'test/createUser.spec.js',
        'test/updateUserUser.spec.js',
        'test/deleteUser.spec.js',

        'test/createUser.spec.js',
      ]
    }
  });
  grunt.registerTask('default', ['mochacli']);
};

I have this scenario where I want to test different files and some of them multiple time. but when I run grunt, each file is only executed once.

wish: briefly document comparison with 'grunt-mocha-cli'

Hello,

Thanks for this module. I tried this morning and it worked well.

I also see there is a similar 'grunt-mocha-test' project, and I'm trying to evaluate which would be best to use. It would be helpful if there was a short "See Also" section in the documentation which mentioned this module and briefly summarized the differences.

I think by explaining the benefits of this a bit more, you may gain more users.

Requiring should doesn't work

When I pass require: ['should'] as an option, it doesn't work:

TypeError: Cannot call method 'equal' of undefined

Test:

[1,2,3].indexOf(4).should.equal(-1);

Error on Win32

I'm getting the following error message:

CreateProcessW: %1 is not a valid Win32 application.

Windows 7

Missing support for mocha '--reporter-options' parameter

Mocha already shipped a xunit reporter which can write a xml string into a output file.
In order to tell mocha which output file it is, we need to pass on the '--reporter-options' parameter which is missing in current grunt-mocha-cli.

The parameter is a string base on mocha command help:

  option('-O, --reporter-options <k=v,k2=v2,...>', 'reporter-specific options')

Could you please add support for that string parameter?

Execute only one test - the changed test

Specified this:

module.exports = (grunt)->
  grunt.initConfig
    watch:
      coffee:
        files: ['test/**/*.coffee', 'common/**/*.coffee'] # TODO Other SubApps too...
        tasks: ['mochacli'] #'clear', 

    mochacli:
      options:
        reporter: 'list'
        compilers: ['coffee:coffee-script/register']
        require: ['should']
        ui: 'bdd'
        env:
          NODE_ENV: 'test'
      all: ['test/**/*.coffee']

Here primary problem!

  grunt.event.on 'watch', (action, filePath)->
    if grunt.file.isMatch grunt.config('watch.coffee.files'), filePath
      console.log 'Action: '+action
      console.log 'FilePath: '+filePath
      if grunt.file.isMatch grunt.config('mochacli.all'), filePath
        console.log 'MochaCLI Config: '
        console.log grunt.config 'mochacli'
        grunt.config 'mochacli.all', [filePath]
        console.log 'MochaCLI Config: '
        console.log grunt.config 'mochacli'
    else
      console.log 'Wrong FilePath: ' + filePath
  grunt.loadNpmTasks 'grunt-contrib-watch'
  grunt.loadNpmTasks 'grunt-mocha-cli'
  grunt.loadNpmTasks 'grunt-clear'

  grunt.registerTask 'default'
  grunt.registerTask 'test', ['mochacli']
  grunt.registerTask 'test-watcher', ['watch:coffee']
  • Event is called
  • Config is changed

= But i executes all tests...why? :(

if mochacli.all is empty - nothing will be executed
tried with files and filesraw - didnt work

How to generate html report and wirte to folder

How can we output html report to a file for reference?

This is how my config looks, is there a way to output the result?

{
        src: ['test/unit/**/*.js'],
        options: {
            timeout: 6000,
            'check-leaks': true,
            ui: 'bdd',
            reporter: 'doc'

        }
    }

Update mocha to v4

Hey!

Is it possible that you update mocha from v3 to v4?

If your tests are running with mocha v4, then you can run into this issue.

Thank you!
Kate

Falling behind on mocha versions

In a previous issue you listed the fact that grunt-mocha-cli has mocha as a dependency instead of a devDependency means that you don't have to include it yourself. To the contrary this means that if mocha has released a new version and you haven't updated your dependencies, I can't update it independenty.

6 releases of mocha have been made since you last updated the package.json file.

timeout error

when I move from version 1.9.0 to 1.10.0

I am getting

Error: timeout of 2000ms exceeded

Allow to pass path with wildcards directly to mocha without expanding it in grunt

Currently if src parameter will be something like ./test/**/*-spec.js it will result in expanding of the parameter and Mocha will run concatenated list of files. Also mocha will ignore recursive parameter, because the runner is executing files, but not a directory with wildcards.

If there will be thousands of test files, potentially some issues might occur while passing them as arguments. In grunt-mocha-istanbul, for example, it is solved by using parameter mask, see https://github.com/pocesar/grunt-mocha-istanbul/blob/master/tasks/index.js line ~160. In this case Mocha will expand it internally.

If mask parameter is set to **/*-spec.js and src='./path/to/tests' the following command will be executed:

mocha ./path/to/tests/**/*-spec.js

There is a way to specify: exclude_dir?

Hi,
There is a way to specify: exclude_dir?
just because I have a features/ directory inside test/ directory
I have mock object or some another resources that is being used on tests,
I wan't a way to specify to mocha exclude that directory,because it is considering as test,.
and errors was thrown.

Best Regards.

Running with ndebug, harmony stops working

When running with the following configuration ..

options: {
    reporter: 'nyan',
    //ndebug: true,
    harmony: true,
    bail: true
}

.. things are pretty good. But when enabling ndebug for some reason I get an Unexpected Token error on arrow functions.

options: {
    reporter: 'nyan',
    ndebug: true,
    harmony: true,
    bail: true
}

I can see the args being passed look correct:

[ 'debug', '--bail', '--harmony', '--reporter', 'nyan', 'test/schema-test.js' ]

Is this a bug, or is there maybe something wrong with my configuration ?

Thanks!

Error when running with mocha installed manaully

If mocha is a dependency in package.json, this errors out with:

execvp(): No such file or directory
Fatal error: spawn ENOENT

This has to do with mocha being installed in a different path than grunt-mocha-cli expects. The .bin is hardcoded to the node_modules of grunt-mocha-cli.

Incorrect path

In mocha.js:

    var spawnOptions = {
        cmd: __dirname + '/../node_modules/.bin/mocha'
    };

...should be...

    var spawnOptions = {
        cmd: __dirname + '/../../../node_modules/.bin/mocha'
    };

CLI Arguments Not Interpreted

Hey, I'll preface this by saying I'm not all that familiar with Grunt, so if there's something I need to do differently on my side just let me know.

I'm trying to pass through command line arguments to the mochacli task like so:

grunt mochacli:all --grep=seed

I've verified that this is accessible through grunt.option('seed') both within my gruntfile and within a patched version of grunt-mocha-cli. I see though that we're not looking at grunt.option, and are instead are accepting an options object via the function that we're exporting.

I think it should be possible to loop through the existing option lists you have and check for CLI options and override the config. Does this sound like the right approach, or is there a more standard way to do this within grunt?

I'm happy to send a pull request your way if the approach sounds good.

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.