polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [07/50] [abbrv] polygene-java git commit: Add a basic automated test for the yeoman generator
Date Mon, 13 Mar 2017 10:34:59 GMT
Add a basic automated test for the yeoman generator

npm based only
follows yeoman doc: http://yeoman.io/authoring/testing.html

to run the test:
cd tools/generator
npm install
npm test

The test generates an application and run ./gradlew build in it
It currently fails with a compilation error


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/a2736a6d
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/a2736a6d
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/a2736a6d

Branch: refs/heads/serialization-3.0
Commit: a2736a6dffd1b67ba940b22ec4cc531e2119a707
Parents: 0c7ee19
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Sat Mar 11 11:42:37 2017 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Sat Mar 11 11:42:37 2017 +0100

----------------------------------------------------------------------
 .../templates/DomainLayer/DomainModule/module.js |  2 +-
 tools/generator-polygene/package.json            | 10 ++++++++++
 tools/generator-polygene/test/generator_test.js  | 19 +++++++++++++++++++
 3 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a2736a6d/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
index 3aea91c..0c6f1eb 100644
--- a/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
+++ b/tools/generator-polygene/app/templates/DomainLayer/DomainModule/module.js
@@ -1,7 +1,7 @@
 module.exports = {
 
     write: function (p) {
-
+        if(!p.modules) return;
         Object.keys(p.modules).forEach(function (moduleName, index) {
             copyPolygeneDomainModule(p, moduleName, p.modules[moduleName])
         });

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a2736a6d/tools/generator-polygene/package.json
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/package.json b/tools/generator-polygene/package.json
index 25e2d02..d410b9e 100644
--- a/tools/generator-polygene/package.json
+++ b/tools/generator-polygene/package.json
@@ -2,6 +2,9 @@
   "name": "generator-polygene",
   "version": "0.1.0",
   "description": "",
+  "scripts": {
+    "test": "./node_modules/mocha/bin/mocha test/**/*_test.js"
+  },
   "files": [
     "app"
   ],
@@ -10,5 +13,12 @@
   ],
   "dependencies": {
     "yeoman-generator": "^0.24.1"
+  },
+  "devDependencies": {
+    "mocha": "3.2.0",
+    "path": "0.12.7",
+    "shelljs": "0.7.7",
+    "yeoman-assert": "3.0.0",
+    "yeoman-test": "1.6.0"
   }
 }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a2736a6d/tools/generator-polygene/test/generator_test.js
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/test/generator_test.js b/tools/generator-polygene/test/generator_test.js
new file mode 100644
index 0000000..0e8ef8b
--- /dev/null
+++ b/tools/generator-polygene/test/generator_test.js
@@ -0,0 +1,19 @@
+var path = require('path');
+var helpers = require('yeoman-test');
+var assert = require('yeoman-assert');
+var shell = require('shelljs');
+
+// See http://yeoman.io/authoring/testing.html
+describe('polygene-generator', function () {
+  it('generates a buildable gradle project', function () {
+      return helpers.run(path.join(__dirname, '../app'))
+        .withPrompts({
+            name: 'test-project',
+            packageName: 'org.apache.polygene.generator.test'
+        })
+        .then(function(dir) {
+            assert.file(['gradlew', 'settings.gradle', 'build.gradle']);
+            assert(shell.exec(path.join(dir, 'gradlew') + ' build').code == 0);
+        });
+  });
+});


Mime
View raw message