Commit d4e2d545 d4e2d545104248df5860e9104064af62921848f2 by Nicolas Perriault

migrated require tests to new testing format

1 parent 60c27d7c
...@@ -2,30 +2,36 @@ ...@@ -2,30 +2,36 @@
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', 'sample_modules'); 4 var modroot = fs.pathJoin(phantom.casperPath, 'tests', 'sample_modules');
5 var jsmod, csmod, config;
6 5
7 casper.test.comment('Javascript module loading') 6 casper.test.begin('Javascript module loading', 1, function(test) {
8 try { 7 var jsmod;
8 try {
9 jsmod = require(fs.pathJoin(modroot, 'jsmodule')); 9 jsmod = require(fs.pathJoin(modroot, 'jsmodule'));
10 casper.test.assertTrue(jsmod.ok, 'require() patched version can load a js module'); 10 test.assertTrue(jsmod.ok, 'require() patched version can load a js module');
11 } catch (e) { 11 } catch (e) {
12 casper.test.fail('require() patched version can load a js module'); 12 test.fail('require() patched version can load a js module');
13 } 13 }
14 test.done();
15 });
14 16
15 casper.test.comment('CoffeeScript module loading') 17 casper.test.begin('CoffeeScript module loading', 1, function(test) {
16 try { 18 var csmod;
19 try {
17 csmod = require(fs.pathJoin(modroot, 'csmodule')); 20 csmod = require(fs.pathJoin(modroot, 'csmodule'));
18 casper.test.assertTrue(csmod.ok, 'require() patched version can load a coffeescript module'); 21 test.assertTrue(csmod.ok, 'require() patched version can load a coffeescript module');
19 } catch (e) { 22 } catch (e) {
20 casper.test.fail('require() patched version can load a coffeescript module'); 23 test.fail('require() patched version can load a coffeescript module');
21 } 24 }
25 test.done();
26 });
22 27
23 casper.test.comment('JSON module loading') 28 casper.test.begin('JSON module loading', 1, function(test) {
24 try { 29 var config;
30 try {
25 config = require(fs.pathJoin(modroot, 'config.json')); 31 config = require(fs.pathJoin(modroot, 'config.json'));
26 casper.test.assertTrue(config.ok, 'require() patched version can load a json module'); 32 test.assertTrue(config.ok, 'require() patched version can load a json module');
27 } catch (e) { 33 } catch (e) {
28 casper.test.fail('require() patched version can load a json module'); 34 test.fail('require() patched version can load a json module');
29 } 35 }
30 36 test.done();
31 casper.test.done(3); 37 });
......