Επεξεργασία

Κοινή χρήση μέσω


Grunt@0 - Grunt v0 task

Use this task to run the Grunt JavaScript task runner.

Syntax

# Grunt v0
# Run the Grunt JavaScript task runner.
- task: Grunt@0
  inputs:
    gruntFile: 'gruntfile.js' # string. Required. Grunt File Path. Default: gruntfile.js.
    #targets: # string. Grunt Task(s). 
    #arguments: # string. Arguments. 
  # Advanced
    #workingDirectory: # string. Alias: cwd. Working Directory. 
    gruntCli: 'node_modules/grunt-cli/bin/grunt' # string. Required. grunt-cli location. Default: node_modules/grunt-cli/bin/grunt.
  # JUnit Test Results
    #publishJUnitResults: false # boolean. Publish to Azure Pipelines. Default: false.
    #testResultsFiles: '**/TEST-*.xml' # string. Required when publishJUnitResults = true. Test Results Files. Default: **/TEST-*.xml.
    #testRunTitle: # string. Optional. Use when publishJUnitResults = true. Test Run Title. 
  # Code Coverage
    #enableCodeCoverage: false # boolean. Enable Code Coverage. Default: false.
    #testFramework: 'Mocha' # 'Mocha' | 'Jasmine'. Optional. Use when enableCodeCoverage = true. Test Framework. Default: Mocha.
    #srcFiles: # string. Optional. Use when enableCodeCoverage = true. Source Files. 
    #testFiles: 'test/*.js' # string. Required when enableCodeCoverage = true. Test Script Files. Default: test/*.js.
# Grunt v0
# The JavaScript Task Runner.
- task: Grunt@0
  inputs:
    gruntFile: 'gruntfile.js' # string. Required. Grunt File Path. Default: gruntfile.js.
    #targets: # string. Grunt Task(s). 
    #arguments: # string. Arguments. 
  # Advanced
    #workingDirectory: # string. Alias: cwd. Working Directory. 
    gruntCli: 'node_modules/grunt-cli/bin/grunt' # string. Required. grunt-cli location. Default: node_modules/grunt-cli/bin/grunt.
  # JUnit Test Results
    #publishJUnitResults: false # boolean. Publish to Azure Pipelines/TFS. Default: false.
    #testResultsFiles: '**/TEST-*.xml' # string. Required when publishJUnitResults = true. Test Results Files. Default: **/TEST-*.xml.
    #testRunTitle: # string. Optional. Use when publishJUnitResults = true. Test Run Title. 
  # Code Coverage
    #enableCodeCoverage: false # boolean. Enable Code Coverage. Default: false.
    #testFramework: 'Mocha' # 'Mocha' | 'Jasmine'. Optional. Use when enableCodeCoverage = true. Test Framework. Default: Mocha.
    #srcFiles: # string. Optional. Use when enableCodeCoverage = true. Source Files. 
    #testFiles: 'test/*.js' # string. Required when enableCodeCoverage = true. Test Script Files. Default: test/*.js.

Inputs

gruntFile - Grunt File Path
string. Required. Default value: gruntfile.js.

Specifies the relative path from the repo root to the Grunt script.


targets - Grunt Task(s)
string.

Optional. Specifies the space-delimited list of tasks to run. If not specified, the default task will run.


arguments - Arguments
string.

Specifies the additional arguments passed to Grunt. See Using the CLI for more information.

Note: --gruntfile is not needed because it was already added via the gruntFile input above.


workingDirectory - Working Directory
Input alias: cwd. string.

Optional. Specifies the current working directory when the script is run. If not specified, the working directory defaults to the folder where the script is located.


gruntCli - grunt-cli location
string. Required. Default value: node_modules/grunt-cli/bin/grunt.

Specifies the grunt-cli to run when the agent can't find the globally installed grunt-cli. Defaults to the grunt-cli under the node_modules folder of the working directory.


publishJUnitResults - Publish to Azure Pipelines
boolean. Default value: false.

Select this option to publish the JUnit test results produced by the Grunt build to Azure Pipelines/TFS.


publishJUnitResults - Publish to Azure Pipelines/TFS
boolean. Default value: false.

Select this option to publish the JUnit test results produced by the Grunt build to Azure Pipelines/TFS.


testResultsFiles - Test Results Files
string. Required when publishJUnitResults = true. Default value: **/TEST-*.xml.

Specifies the test results files path. Wildcards can be used.

For example, **/TEST-*.xml for all XML file names that start with TEST-.


testRunTitle - Test Run Title
string. Optional. Use when publishJUnitResults = true.

Specifies a name for the test run.


enableCodeCoverage - Enable Code Coverage
boolean. Default value: false.

Select this option to enable code coverage using Istanbul.


testFramework - Test Framework
string. Optional. Use when enableCodeCoverage = true. Allowed values: Mocha, Jasmine. Default value: Mocha.

Specifies your test framework.


srcFiles - Source Files
string. Optional. Use when enableCodeCoverage = true.

Specifies the path to your source files which you want to hookRequire().


testFiles - Test Script Files
string. Required when enableCodeCoverage = true. Default value: test/*.js.

Specifies the path to your test script files.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

Use this task to run Grunt tasks using the JavaScript Task Runner.

Examples

See a Sample Gruntfile.

Requirements

Requirement Description
Pipeline types YAML, Classic build
Runs on Agent, DeploymentGroup
Demands Self-hosted agents must have capabilities that match the following demands to run jobs that use this task: node.js
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.91.0 or greater
Task category Build