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 6332725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:19:10+00:00 2026-05-24T18:19:10+00:00

I have a web app where the client side stuff is written with coffeescript

  • 0

I have a web app where the client side stuff is written with coffeescript and loaded with require.js.

I would like to be able to isolate and test this stuff using a node based test runner such as expresso (although other suggestions are welcome) so that I can integrate the client side testing with our CI server – which is currently Team City.

Here’s my directory set up:

.
├── coffee
│   ├── models
│   ├── node_modules
│   │   └── expresso
│   ├── spec
│   ├── tests
│   └── views
├── static
│   └── js
│       ├── lib
│       ├── models
│       ├── tests
│       └── views

These are hooked up using require.js like so:

deps = [
   "lib/backbone", "models/websocket_collection", "/static/js/lib/date.js"
]

define(deps, (Backbone, ws) ->
    # module code and exports here

And loaded into the browser like so:

<script type="text/javascript" charset="utf-8" async="" data-requirecontext="_" data-requiremodule="my_mod" src="/static/js/my_mod.js"></script>

In an idea world now I’d like to be able to have a test module that looks like:

{Model1, Model2} = require "models/some_module"

exports.test_a = ->
    assert.equal # etc etc

I have several problems (having not really used node server side except when I played with zombie.js)

  1. How do I tell node where all of my plain javascript dependencies are (in static/js/lib) some of these are as downloaded, but backbone.js has been marked up with require.js define stuff like so

    define(function(require, exports, module) {
        (function(){
    
  2. How do I actually run the tests? I’ve tried r.js (which as I understand it is supposed to be a bridge between browser side require and node’s require)

the problem I’m getting is:

ReferenceError: define is not defined

I’ve also tried to require(“allplugins-require”) which is the script I load browser side to collect all of my client code, but that seems to break node’s require.

  • Is anybody doing this?
  • If you’re not doing this how are you testing your code (bonus points for integration with CI)?
  • Any alternatives to require.js for managing client side dependencies that might play a bit better on the server side?

I’d be very happy to hear alternative approaches that people are using.

Thanks,
Ben

  • 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-05-24T18:19:11+00:00Added an answer on May 24, 2026 at 6:19 pm

    I spent a long time trying to get this to work and eventually gave up. I did get it working, by referencing all of my require.js dependencies in a global variable and using that for the node.js tests, but the design was so ugly that I felt that I had defeated the point.

    My current approach is:

    • write my JavaScript modules as CommonJS modules
    • Use the Jasmine BDD node integration to test my modules server-side
    • Use stitch to make the CommonJS modules work client-side

    This is working well for me, with the following caveats:

    • Client-side debugging is difficult because stitch concatenates all my scripts. I found that leaving out libraries like jQuery from the stitch configuration helped with this.
    • I don’t have any way to debug server-side. There is a node.js debugger but it has not worked with the last few versions of node.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web app that lets a client define a daily rate for
Using SubSonic v2.3 in a web app. Each client (200+) will have their own
I have a Linux/c client app that connects to a WCF web service over
So I have an app that uses the Zend amazon web services client. I
I have a web app for commercial property management that needs spreadsheet-like functionality for
I have a web app that is heavily loaded in javascript and css. First
I'm about to make a web app which will have a pretty heavy client
I'm working on a web app which is heavy on the client side, which
I have to build a multibrowser web app which should be able to be
I would like to create a web app similar to Stack Overflow in that

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.