migrated require tests to new testing format
Showing
1 changed file
with
30 additions
and
24 deletions
... | @@ -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; |
9 | jsmod = require(fs.pathJoin(modroot, 'jsmodule')); | 8 | try { |
10 | casper.test.assertTrue(jsmod.ok, 'require() patched version can load a js module'); | 9 | jsmod = require(fs.pathJoin(modroot, 'jsmodule')); |
11 | } catch (e) { | 10 | test.assertTrue(jsmod.ok, 'require() patched version can load a js module'); |
12 | casper.test.fail('require() patched version can load a js module'); | 11 | } catch (e) { |
13 | } | 12 | test.fail('require() patched version can load a js module'); |
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; |
17 | csmod = require(fs.pathJoin(modroot, 'csmodule')); | 19 | try { |
18 | casper.test.assertTrue(csmod.ok, 'require() patched version can load a coffeescript module'); | 20 | csmod = require(fs.pathJoin(modroot, 'csmodule')); |
19 | } catch (e) { | 21 | test.assertTrue(csmod.ok, 'require() patched version can load a coffeescript module'); |
20 | casper.test.fail('require() patched version can load a coffeescript module'); | 22 | } catch (e) { |
21 | } | 23 | test.fail('require() patched version can load a coffeescript module'); |
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; |
25 | config = require(fs.pathJoin(modroot, 'config.json')); | 30 | try { |
26 | casper.test.assertTrue(config.ok, 'require() patched version can load a json module'); | 31 | config = require(fs.pathJoin(modroot, 'config.json')); |
27 | } catch (e) { | 32 | test.assertTrue(config.ok, 'require() patched version can load a json module'); |
28 | casper.test.fail('require() patched version can load a json module'); | 33 | } catch (e) { |
29 | } | 34 | test.fail('require() patched version can load a json module'); |
30 | 35 | } | |
31 | casper.test.done(3); | 36 | test.done(); |
37 | }); | ... | ... |
-
Please register or sign in to post a comment