Search code examples
angularjsnode.jscoffeescriptgruntjsgrunt-contrib-jade

grunt test - Fatal error: Unit testing is not implemented yet


I already setup the project environment, and install grunt succeed. In terminal I tried run grunt that showing this for me:

enter image description here

Then I follow the step.

  1. grunt build --env uat (this step running succeed)
  2. grunt watch --env uat (this step got problem and I post here)
  3. grunt test (this step showing error for me: Fatal error: Unit testing is not implemented yet)

enter image description here

This project include: angularJS, jade, coffeescript, I already setup all environment, but still don't know how to run this project.

###
    Build script for ** project.

    USAGE INSTRUCTIONS:
    Run `grunt` on the command line, from the same directory as this file
    or any subfolder to see usage instructions.

    TODO:
    - Fix totally broken `--debug` mode.
    - Unit testing support.
###

module.exports = (grunt) ->

    ## Config ------------------------------------------------------------------

    Instructions = """
        Usage:
        1) Build all files once.
            grunt build --env Environment [--debug]
        2) Builds files and automatically re-build when any file changes are detected.
            grunt watch --env Environment [--debug]
        3) Builds and runs Unit Tests.
            grunt test

        Where:
        - debug: to compile for development (leave out to compile for production)
        - Environment can be the filenam (minus extension) of any environment
          file in the Environments/ directory.
    """


    ## Command Line options ----------------------------------------------------

    Debug = grunt.option("debug")?
    Env = grunt.option("env")

    if grunt.cli.tasks.length and grunt.cli.tasks[0] isnt "test"
        unless Env? and grunt.file.exists "Environments/#{Env}.litcoffee"
            grunt.fail.fatal "Please specify a valid environment!"
            return


    ## Helpers -----------------------------------------------------------------

    usage = ->
        grunt.log.writeln Instructions


    ## Grunt config ------------------------------------------------------------

    grunt.initConfig

        autoprefixer:
            options:
                browsers: ["last 3 versions"]
                map:
                    inline: false
            all:
                expand: true
                cwd: "Build"
                src: ["*.css"]
                dest: "Build"

        browserify:
            all:
                expand: true
                cwd: "Build/Temp/CoffeeTemp"
                src: ["*.js"]
                dest: "Build"
                ext: ".js"

        clean:
            all:
                src: ["Build"]
            temp:
                src: ["Build/Temp"]
            production: [
                "Build/**/*.js.map"
                "Build/**/*.css.map"
            ]
            stylesheets:
                src: ["Build/*.css"]
            scripts:
                src: ["Build/*.js"]
            jade:
                src: [
                    "Build/*.html"
                    "Build/templates/**/*.html"
                ]

        coffee:
            options:
                bare: true
                # sourceMap: Debug
            env:
                src: ["Environments/#{Env}.litcoffee"]
                dest: "Build/Temp/CoffeeTemp/services/env.js"
            all:
                expand: true
                cwd: "Source Code"
                src: ["**/*.litcoffee"]
                dest: "Build/Temp/CoffeeTemp"
                ext: ".js"

        copy:
            static:
                expand: true
                cwd: "Source Code"
                src: [ "static/**/*" ]
                dest: "Build"

        cssmin:
            options:
                sourceMap: true
            build:
                expand: true
                cwd: "Build"
                src: ["*.css"]
                dest: "Build"

        htmlmin:
            all:
                options:
                    removeComments: true
                    collapseWhitespace: true
                    conservativeCollapse: true
                files: [
                    {
                        expand: true
                        cwd: "Build"
                        src: [
                            "*.html",
                            "templates/**/*.html"
                        ]
                        dest: "Build"
                        ext: ".html"
                        filter: "isFile"
                    }
                ]

        jade:
            options:
                doctype: "html" # keeps attributes with no value as-is (i.e.
                    # prevents div(md-raised) from becoming
                    # <div md-raised="md-raised">...)
                data: {}
                pretty: false
            all:
                files: [
                    expand: true
                    cwd: "Source Code"
                    src: [
                        "*.jade"
                        "admin/*.jade"
                        "activate/*.jade"
                        "activation/*.jade"
                        "cargoTrackingMobile/*.jade"
                        "templates/**/*.jade"
                    ]
                    dest: "Build"
                    ext: ".html"
                ]

        stylus:
            all:
                options:
                    linenos: true
                    compress: !Debug
                    sourcemap:
                        comment: true
                        inline: false
                        sourceRoot: "."
                        basePath: "."
                files: [
                    expand: true
                    cwd: "Source Code/styles"
                    src: [
                        "**/*.styl"
                        "!**/_*.styl"
                    ]
                    dest: "Build"
                    ext: ".css"
                ]

        uglify:
            options:
                mangle: {}
                sourceMap: Debug
            all:
                expand: true
                cwd: "Build"
                src: ["*.js"]
                dest: "Build"

        watch_default:
            scripts:
                files: [
                    "Source Code/*.litcoffee"
                    "Source Code/**/*.litcoffee"
                    "!Source Code/static/**/*.litcoffee"
                ]
                tasks: ["scripts"]
            stylesheets:
                files: ["Source Code/styles/**/*"]
                tasks: ["stylesheets"]
            html:
                files: [
                    "Source Code/*.jade"
                    "Source Code/admin/*.jade"
                    "Source Code/activate/*.jade"
                    "Source Code/activation/*.jade"
                    "Source Code/cargoTrackingMobile/*.jade"
                    "Source Code/templates/**/*.jade"
                ]
                tasks: ["jade:all"]
            static:
                files: ["Source Code/static/**/*"]
                tasks: ["copy:static"]

    grunt.loadNpmTasks "grunt-autoprefixer"
    grunt.loadNpmTasks "grunt-browserify"
    grunt.loadNpmTasks "grunt-contrib-clean"
    grunt.loadNpmTasks "grunt-contrib-coffee"
    grunt.loadNpmTasks "grunt-contrib-copy"
    grunt.loadNpmTasks "grunt-contrib-cssmin"
    grunt.loadNpmTasks "grunt-contrib-htmlmin"
    grunt.loadNpmTasks "grunt-contrib-jade"
    grunt.loadNpmTasks "grunt-contrib-stylus"
    grunt.loadNpmTasks "grunt-contrib-uglify"
    grunt.loadNpmTasks "grunt-contrib-watch"


    ## Custom tasks ------------------------------------------------------------

    grunt.task.renameTask "watch", "watch_default"

    grunt.registerTask "default", "Usage", usage

    grunt.registerTask "scripts", "Compiles the JavaScript files.", [
        "clean:scripts"
        "coffee:all"
        "coffee:env"
        "browserify:all"
        "clean:temp"
    ].concat unless Debug then ["uglify:all"] else []

    grunt.registerTask "stylesheets", "Compiles the stylesheets.", [
        "clean:stylesheets"
        "stylus:all"
        "autoprefixer:all"
    ].concat unless Debug then ["cssmin"] else []

    grunt.registerTask "test", "Run unit testing.", ->
        grunt.fail.fatal "Unit testing is not implemented yet" # TODO

    grunt.registerTask "build", "Compiles all of the assets and copies the files to the Build directory.", [
        "clean:all"
        "copy:static"
        "jade:all"
        "htmlmin:all"
        "stylesheets"
        "scripts"
    ].concat unless Debug then ["clean:production"] else []

    grunt.registerTask "watch", "Builds and watches the project for changes.", [
        "build"
        "watch_default"
    ]

Solution

  • It is raising an error because that is how this task is defined in your gruntfile.coffee:

    grunt.registerTask "test", "Run unit testing.", ->
        grunt.fail.fatal "Unit testing is not implemented yet" # TODO
    

    Ask whomever maintains this project for more details.