Skip to content

Commit

Permalink
Add test runner
Browse files Browse the repository at this point in the history
This is not quite the test runner talked about in issue #26 but is the first step towards that. This should integrate with the new integration system which should mean we start running tests with every check-in
  • Loading branch information
LoveAndCoding committed May 28, 2015
1 parent 0b6c2d6 commit bb2d8f5
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
"mkdirp": "0.3.5",
"marked": "~0.3.1"
},
"scripts": {
"test": "vows ./test/run.js --spec"
},
"devDependencies": {
"fs-extra": "~0.18.x",
"vows": "~0.8.x"
},
"license": "MIT",
"engines": {
"node": ">=0.8"
Expand Down
58 changes: 58 additions & 0 deletions test/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
var execFile = require('child_process').execFile,
assert = require('assert'),
vows = require('vows'),
fs = require('fs-extra'),
path = require('path'),

FruitJSFile = path.resolve(__dirname, '../bin/cli'),
OutputFolder = path.resolve(__dirname, 'test-output'),

testManifestFiles = [
"Generation/Headers/uniqueid.manifest.json"
, "Links/crosspage.multipage.manifest.json"
, "Links/crosspage.singlepage.manifest.json"
, "Menu/post.array.manifest.json"
, "Menu/pre.array.manifest.json"
, "Menu/post.object.manifest.json"
, "Menu/pre.object.manifest.json"
, "Menu/post.object.sub.manifest.json"
, "Menu/pre.object.sub.manifest.json"
, "Resources/automated.gathering.manifest.json"
// , "Resources/folder.gathering.manifest.json" -- Failing; see issue #30
];

var execSuite = vows.describe('FruitJS Clean Execution');

function addTestFile(testFile, output) {
var testObj = {};

testObj['Running FruitJS against '+testFile] = {
topic: function () {
if(fs.existsSync(output))
fs.removeSync(output);
execFile('node', [FruitJSFile, testFile, '-o', output], {cwd: __dirname, timeout: 5000}, this.callback);
},
'we should report success' : function (err, stdout) {
assert.include(stdout.toString(), 'success');
},
'we should have the proper output folder': function () {
assert(fs.existsSync(output));
},
'we should have nothing in stderr': function (err, stdout, stderr) {
assert.isEmpty(stderr.toString());
},
teardown: function () {
fs.removeSync(output);
}
};

execSuite.addBatch(testObj);
}

// For now we are simply going to run each and make sure we compile it properly without error.
// We are not doing any output checking at the moment
for(var t = 0, l = testManifestFiles.length; t < l; t++) {
addTestFile(testManifestFiles[t], OutputFolder + '-' + t);
}

execSuite.export(module);

0 comments on commit bb2d8f5

Please sign in to comment.