views:

105

answers:

1

Lets say I have a few utility functions in file tests/utils/functions.js. I would like to use these functions from several unit test files.

However, I'm not able to use them as the Sproutcore build system does not include any external files into the html page used to run the unit tests. Only application code and the code from the unit tests to be run are included.

So is it possible to somehow include Javascript files to be used in unit test files in Sproutcore?

I could add the functions.js file into some other directory inside my application to be able to use them. However, this is not what I want to do as the utility functions are useless in final production build and would only make my application larger.

A: 

I solved this by creating frameworks/testing/functions.js under my Sproutcore project. Then I changed the following line in Buildfile

config :all, :required => :sproutcore

to:

config :all, :required => :sproutcore, :test_required => ['testing']

Now the utility functions get correctly included when unit tests are being done but they don't end up to the production build.

Lauri