Commit 1d151ab9 1d151ab9c06b167e0bcec3f2d8a94e23b4ab11c3 by Nicolas Perriault

let's have decent error reporting when new module tests fail

as it's the case atm :)
1 parent 2a362c51
1 exports.ok = true 1 try
2 exports.ok = true
3 catch e
4 casper.test.fail('error in coffeescript module code: ' + e)
5 casper.test.done()
......
1 exports.ok = true 1 /*global casper*/
2 try {
3 exports.ok = true;
4 } catch (e) {
5 casper.test.fail('error in js module code' + e);
6 casper.test.done()
7 }
......
...@@ -2,10 +2,22 @@ ...@@ -2,10 +2,22 @@
2 /*jshint strict:false*/ 2 /*jshint strict:false*/
3 var fs = require('fs'); 3 var fs = require('fs');
4 var modroot = fs.pathJoin(phantom.casperPath, 'tests', 'suites', 'modules'); 4 var modroot = fs.pathJoin(phantom.casperPath, 'tests', 'suites', 'modules');
5 var jsmod = require(fs.pathJoin(modroot, 'jsmodule')); 5 var jsmod, csmod;
6 var csmod = require(fs.pathJoin(modroot, 'csmodule'));
7 6
8 casper.test.assertTrue(jsmod.ok, 'require() patched version can load a js module'); 7 casper.test.comment('Javascript module loading')
9 casper.test.assertTrue(csmod.ok, 'require() patched version can load a coffeescript module'); 8 try {
9 jsmod = require(fs.pathJoin(modroot, 'jsmodule'));
10 casper.test.assertTrue(jsmod.ok, 'require() patched version can load a js module');
11 } catch (e) {
12 casper.test.fail('require() patched version can load a js module');
13 }
14
15 casper.test.comment('CoffeeScript module loading')
16 try {
17 csmod = require(fs.pathJoin(modroot, 'csmodule'));
18 casper.test.assertTrue(csmod.ok, 'require() patched version can load a coffeescript module');
19 } catch (e) {
20 casper.test.fail('require() patched version can load a coffeescript module');
21 }
10 22
11 casper.test.done(); 23 casper.test.done();
......