From 134717e2e242b8bb78a6f73b55a4ed3db6f2227f Mon Sep 17 00:00:00 2001 From: Komei Shimamura Date: Wed, 27 May 2015 13:11:28 -0700 Subject: [PATCH] Add Javascript test environment - 'tox -e jasmine' invokes JasmineJS test runnner Related-Issue: #17 #4 --- .../static/app/cognitive.controller.spec.js | 6 ++ .../plugin/formula/formula.controller.spec.js | 6 ++ requirements.txt | 3 + spec/javascripts/support/jasmine.yml | 77 +++++++++++++++++++ tox.ini | 5 +- 5 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 cognitive/app/static/app/cognitive.controller.spec.js create mode 100644 cognitive/app/static/app/whiteboard/experiment/plugin/formula/formula.controller.spec.js create mode 100644 spec/javascripts/support/jasmine.yml diff --git a/cognitive/app/static/app/cognitive.controller.spec.js b/cognitive/app/static/app/cognitive.controller.spec.js new file mode 100644 index 0000000..fd8d32c --- /dev/null +++ b/cognitive/app/static/app/cognitive.controller.spec.js @@ -0,0 +1,6 @@ +// this is just a sample code. +describe("A suite", function() { + it("contains spec with an expectation", function() { + expect(true).toBe(true); + }); +}); \ No newline at end of file diff --git a/cognitive/app/static/app/whiteboard/experiment/plugin/formula/formula.controller.spec.js b/cognitive/app/static/app/whiteboard/experiment/plugin/formula/formula.controller.spec.js new file mode 100644 index 0000000..d6a9cdb --- /dev/null +++ b/cognitive/app/static/app/whiteboard/experiment/plugin/formula/formula.controller.spec.js @@ -0,0 +1,6 @@ +// this is just a sample code. +describe("B suite", function() { + it("contains spec with an expectation", function() { + expect(true).toBe(true); + }); +}); diff --git a/requirements.txt b/requirements.txt index 91e2cc8..e5e706c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,10 +7,13 @@ django-mptt==0.6.1 django-treebeard==2.0 djangorestframework==2.4.4 hamlpy==0.82.2 +jasmine==2.3.0 +jasmine-core==2.3.4 numpy==1.9.1 pandas==0.15.1 python-dateutil==2.2 pytz==2014.10 +PyYAML==3.10 redis==2.10.3 repoze.lru==0.6 scikit-learn==0.15.2 diff --git a/spec/javascripts/support/jasmine.yml b/spec/javascripts/support/jasmine.yml new file mode 100644 index 0000000..63f93f0 --- /dev/null +++ b/spec/javascripts/support/jasmine.yml @@ -0,0 +1,77 @@ + +# src_files +# +# Return an array of filepaths relative to src_dir to include before jasmine specs. +# Default: [] +# +# EXAMPLE: +# +# src_files: +# - lib/source1.js +# - lib/source2.js +# - dist/**/*.js +# +src_files: + - "cognitive/app/static/app/**/*.[controller|module|service|router].js" + +# stylesheets +# +# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs. +# Default: [] +# +# EXAMPLE: +# +# stylesheets: +# - css/style.css +# - stylesheets/*.css +# +stylesheets: + - "cognitive/app/static/css/**/*.css" + +# helpers +# +# Return an array of filepaths relative to spec_dir to include before jasmine specs. +# Default: ["helpers/**/*.js"] +# +# EXAMPLE: +# +# helpers: +# - helpers/**/*.js +# +helpers: + - "helpers/**/*.js" + +# spec_files +# +# Return an array of filepaths relative to spec_dir to include. +# Default: ["**/*[sS]pec.js"] +# +# EXAMPLE: +# +# spec_files: +# - **/*[sS]pec.js +# +spec_files: + - "cognitive/app/static/app/**/*[Ss]pec.js" + +# src_dir +# +# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank. +# Default: project root +# +# EXAMPLE: +# +# src_dir: public +# +src_dir: + +# spec_dir +# +# Spec directory path. Your spec_files must be returned relative to this path. +# Default: spec/javascripts +# +# EXAMPLE: +# +# spec_dir: spec/javascripts +# +spec_dir: ./ diff --git a/tox.ini b/tox.ini index e6a0f65..3c0887a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=py27, py34, pep8 +envlist=py27, py34, pep8, jasmine skipsdist = True [testenv] @@ -12,6 +12,9 @@ commands = python manage.py test [testenv:pep8] commands = flake8 +[testenv:jasmine] +commands = jasmine-ci + [flake8] # this rule is for maxlength of line charactors