testing wip: using requirejs
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 18 Jun 2013 14:28:13 +0000 (16:28 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 18 Jun 2013 14:28:13 +0000 (16:28 +0200)
karma.conf.js
modules/documentCanvas/tests/tests_transform.js [deleted file]
modules/documentCanvas/tests/transform.test.js [new file with mode: 0644]
tests/conf.js [deleted file]
tests/main.js [new file with mode: 0644]

index 78ad3b8..b6085cc 100644 (file)
@@ -3,15 +3,18 @@ basePath = '';
 files = [\r
   MOCHA,\r
   MOCHA_ADAPTER,\r
-  /*REQUIRE,\r
-  REQUIRE_ADAPTER*/\r
-  \r
-  'libs/chai.js',\r
-  'libs/jquery-1.9.1.min.js',\r
-  \r
-  'tests/conf.js',\r
-  'modules/documentCanvas/tests/tests_transform.js'\r
+  REQUIRE,\r
+  REQUIRE_ADAPTER,\r
   \r
+  {pattern: 'libs/*.js', included: false},\r
+  {pattern: 'fnpjs/**/*.js', included: false},\r
+  {pattern: 'modules/**/*.js', included: false},\r
+  {pattern: 'views/**/*.js', included: false},\r
+  {pattern: 'fnpjs/**/*.html', included: false},\r
+  {pattern: 'modules/**/*.html', included: false},\r
+  {pattern: 'views/**/*.html', included: false},\r
+\r
+  'tests/main.js',\r
 ];\r
 \r
 reporters = ['progress'];\r
diff --git a/modules/documentCanvas/tests/tests_transform.js b/modules/documentCanvas/tests/tests_transform.js
deleted file mode 100644 (file)
index b693e12..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-suite('Transform', function() {\r
-\r
-    test('test1', function() {\r
-        assert.ok(true);\r
-    });\r
-\r
-});
\ No newline at end of file
diff --git a/modules/documentCanvas/tests/transform.test.js b/modules/documentCanvas/tests/transform.test.js
new file mode 100644 (file)
index 0000000..66140e5
--- /dev/null
@@ -0,0 +1,13 @@
+define(['libs/chai', 'modules/documentCanvas/transformations'], function(chai, transformations) {\r
+\r
+    var assert = chai.assert;\r
+\r
+    suite('Transform', function() {\r
+\r
+        test('test1', function() {\r
+            assert.ok(true);\r
+        });\r
+\r
+    });\r
+\r
+});
\ No newline at end of file
diff --git a/tests/conf.js b/tests/conf.js
deleted file mode 100644 (file)
index 431acb7..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-mocha.setup('tdd');\r
-\r
-var assert = chai.assert;
\ No newline at end of file
diff --git a/tests/main.js b/tests/main.js
new file mode 100644 (file)
index 0000000..8a093d9
--- /dev/null
@@ -0,0 +1,15 @@
+(function() {\r
+\r
+    mocha.setup('tdd');\r
+\r
+    var tests = Object.keys(window.__karma__.files).filter(function (file) {\r
+      return /\.test\.js$/.test(file);\r
+    });\r
+\r
+    require({\r
+      baseUrl: '/base/',\r
+      deps: tests,\r
+      callback: window.__karma__.start\r
+    });\r
+\r
+})();
\ No newline at end of file