Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9202465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:15:54+00:00 2026-06-17T23:15:54+00:00

For example I define my own task named jasmine . It is based on

  • 0

For example I define my own task named jasmine. It is based on the task server.

If I call grunt server jasmine – it’s ok. But I want to declare that dependency inside my task.

grunt.task.run – add task to the queue (after my task).
grunt.task.requires – only check dependency, not run it…

Does any way exist to run server task before my jasmine task?

P.S. I don’t want to create jasmine_orig task and then .registerTask('jasmine', 'server jasmine_orig'). It looks like silly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:15:55+00:00Added an answer on June 17, 2026 at 11:15 pm

    The way the server task is currently written, no this isn’t possible. However, you may be able to do what you want by using the grunt-connect plugin, or rolling your own grunt server task. The source for the built-in one is here:

    https://github.com/gruntjs/grunt/blob/0.3-stable/tasks/server.js

    As you can see, there isn’t much to it, other than reading a config, starting a connect server, and possibly logging when --debug is passed. You could, in fact, copy all of that code into a helper (woefully underdocumented, I’m afraid), and call it from your jasmine task.

    It’s probably a good idea to start a separate server for your tests (for test independence), but if you needed to save the resources for some reason, or you find multiple servers distasteful in some other way, you’ll have to write some custom task code to check if the server is there, and then start the server if it’s not.

    Probably the best solution is the following:

    1. install the grunt-contrib-connect npm package:

      npm install grunt-contrib-connect --save-dev
      
    2. Make configurations for your dev and test environments:

      connect: {
        dev: {
          base: 'path/to/serve',
          port: 8000
        },
        test: {
          base: 'path/to/serve',
          port: 8001
        }
      }
      
    3. Register a test task that runs grunt server:test jasmine for you.

      grunt.registerTask('test', 'server:test jasmine')
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to define my own infix operator using Haskell that concats two strings
Is it possible to define your own ambient classes? For example, the TransactionScope class
I was wondering if you can define your own attributes in HTML. For example
For example, the WPF namespace is: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" If I define my own namespace, should
I'm using AutoHotKey which is a program that lets me define my own hot
I want to define one application level UncaughtExceptionHandler in my Java application that is
How do I create my own primitive? For example an integer that has a
Using sub prototypes, we can define our own subs that look like map or
If I have the following: /* * example.h */ #ifndef EXAMPLE #define EXAMPLE #include
How do I use macros in Perl, like I do in C? Example: #define

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.