<<<<<<< HEAD
Simple example of jasmine. I ran jasmine examples
and fixed the paths so the tests work. I also added src/Add.js
and spec/my_examples/AddSpec.js
.
npm install
to install the jasmine cli runner./node_modules/jasmine/bin/jasmine
to run tests
- get jasmine via
npm install -g jasmine
or just with the local project withnpm install --save-dev jasmine
. In that case jasmine will be in./node_modules/jasmine/bin/jasmine.js
- If you don't have a
package.json
you might want tonpm init
before installing locally so the jasmine requirement gets saved to your manifest - If installing locally you should probably add
node_modules
to.gitignore
- Are you testing only commonjs modules?
jasmine init
to set up a spec folder and basic config for commonjs testing- create a
WhateverSpec.js
in thespec
folder. You can also organize specs into any depth of folders underspec
. Fill the test with a jasmine test suite. - the test should use the
require()
function to assign a commonjs module to a variable. jasmine
from project root to run tests
- Or are you testing some other non-commonjs javascript?
- I think you'll need a
SpecRunner.html
to include your dependencies in script tags in order. It needs a bunch of other boilerplate too. - Download the standalone version
and unzip it into a
jasmine
folder. Or just copy/paste this:mkdir jasmine && wget -O ./jasmine/jasmine.zip https://github.com/jasmine/jasmine/releases/download/v2.1.3/jasmine-standalone-2.1.3.zip && cd jasmine && unzip jasmine.zip && rm -f jasmine.zip && cd ..
- create a
WhateverSpec.js
in thejasmine/spec
folder. You can also organize specs into any depth of folders underspec
. Fill the test with a jasmine test suite. - open the
SpecRunner.html
in your browser - you can also use jasmine-html-runner to run it on the command line =======
getPrimes
function that takes an integer value n as argument and generates prime numbers from 0 to n with asymptotic analysis.
3c7dab073039e7c515482ed7c21757f694881699