This is a Mimosa module that integrates testem + mocha into your RequireJS-enabled Mimosa application.
For more information regarding Mimosa, see http://mimosa.io
Note: To use mimosa-testem-require with mimosa
v1.0.0-rc.3, you need mimosa-testem-require
Check out the MimosaTestem demo app to see this module in action.
npm install -g phantomjs(If you are on Windows, this will not install phantomjs properly. You will need to download phantomjs from the site and add the executable to your
'testem-require'to your list of modules. Mimosa will install the module for you when you start up.
testem-requireconsiders any file compiled/copied to
watch.compiledDirthat ends with
_test.jsa test. Code your specs in
watch.sourceDirand you can code it in CoffeeScript, LiveScript, whatever. Mimosa will treat it like any other piece of CoffeeScript.
testem-require will create a series of assets it needs for testing in
.mimosa/testemRequire at the root of your project. That includes
sinon-chai.js, and a copy of
require.js. It also includes a file for kicking off tests, and a file declaring your test files and requirejs config that is dynamically generated based on your code.
testem-require also generates a
testem.json config file for configuring the test running. By default that testem is configured to run all your mocha tests in a PhantomJS headless browser.
When mimosa starts up,
testscript command will drop a platform appropriate script in the root of your project that you can use to execute your testem tests directly. If you are writing tests or doing heavy test debugging, you will want to interact with testem directly and the script lets you do that. You will want to run this in conjunction with mimosa running, so that you tests get compiled/copied to the correct location and the configuration gets updated. Another Mimosa user found that you can run the script and Mimosa with one command, so you might want to try that out. You can also run quick
mimosa builds if you don't want to run Mimosa in unison with the test script.
The script will be named test.[bat/sh]. The script takes a single option of ci. When ci is passed in, testem will run in ci mode.
testemRequire:executeDuringBuild: trueexecuteDuringWatch: truesafeAssets:specConvention: /[_-]\.js$/assetFolder:".mimosa/testemRequire"testemConfig:"launch_in_dev": "Firefox" "Chrome""launch_in_ci": "PhantomJS"mochaSetup:ui: 'bdd'requireConfig: nulltestemSimple:configFile: testemRequireassetFolder + "testem.json"port: nullwatch:exclude:
executeDuringBuild: Determines whether mimosa will automatically execute the tests during build.
executeDuringWatch: Determines whether mimosa will automatically execute the tests during watch as files are changed.
safeAssets: You may choose to alter the assets that Mimosa writes, for instance to use your own version of mocha. Mimosa by default will overwrite the files in this folder. If you don't want your file overwritten, add the name of the file to this array. Just the name, no paths necessary.
specConvention: This is the regex
testem-requireuses to identify your tests. It'll run this regex against every compiled file to determine if it is indeed a test and if it is,
testem-requirewill include it in the list of tests to be run.
assetFolder: This is the folder
testem-requireplaces its assets.
testemConfig: This is testem's configuration.
testem-requireuses this default, which just defines the browsers to run the tests in, and then amplifies it with a few other computed properties
mochaSetup: This is a pass-through to the
requireConfigThis is the configuration used by require.js in your tests. By default
testem-requirederives this from your project. To see what it derives, look at
testemSimple: this module wraps the mimosa-testem-simple module. It overrides the
testemSimple.configFileproperty to point at
testem.json. The other testem-simple config can be updated/modified directly. See the config for testem-simple to see how you can use it via testem-require.