简体   繁体   English

grunt测试-致命错误:尚未实施单元测试

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

I already setup the project environment, and install grunt succeed. 我已经设置了项目环境,并成功安装grunt。 In terminal I tried run grunt that showing this for me: 在终端中,我尝试运行grunt ,为我显示以下内容:

在此处输入图片说明

Then I follow the step. 然后我按照步骤进行。

  1. grunt build --env uat (this step running succeed) grunt build --env uat(此步骤运行成功)
  2. grunt watch --env uat (this step got problem and I post here ) grunt watch --env uat(这一步出了问题,我在这里发布)
  3. grunt test (this step showing error for me: Fatal error: Unit testing is not implemented yet ) grunt测试(此步骤向我显示错误: 致命错误:尚未执行单元测试

在此处输入图片说明

This project include: angularJS, jade, coffeescript, I already setup all environment, but still don't know how to run this project. 这个项目包括:angularJS,jade,coffeescript,我已经设置了所有环境,但是仍然不知道如何运行这个项目。

###
    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"
    ]

It is raising an error because that is how this task is defined in your gruntfile.coffee : 这引发了一个错误,因为这是在gruntfile.coffee定义此任务的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. 询问维护该项目的人员,以获取更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM