require_spec.js (phantomjs-2.1.0) | : | require_spec.js (phantomjs-2.1.1) | ||
---|---|---|---|---|
skipping to change at line 53 | skipping to change at line 53 | |||
assert_throws("Cannot find module 'dummy_missing'", | assert_throws("Cannot find module 'dummy_missing'", | |||
function () { require('dummy_missing'); }); | function () { require('dummy_missing'); }); | |||
try { | try { | |||
require('./not_found').requireNonExistent(); | require('./not_found').requireNonExistent(); | |||
} catch (e) { | } catch (e) { | |||
assert_regexp_match(e.stack, /\nrequire@/); | assert_regexp_match(e.stack, /\nrequire@/); | |||
} | } | |||
}, "error handling 1"]); | }, "error handling 1"]); | |||
// XFAIL: 'thrower' and 'error_handling_2' fail to have source locations | ||||
// reported. | ||||
tests.push([function error_handling_2 () { | tests.push([function error_handling_2 () { | |||
try { | try { | |||
require('./thrower').fn(); | require('./thrower').fn(); | |||
} catch (e) { | } catch (e) { | |||
assert_regexp_match(e.toString() + "\n" + e.stack, | assert_regexp_match(e.toString() + "\n" + e.stack, | |||
/^Error: fn\nthrower@[^\n]+?\nerror_handling_2@[^\n]+?\n/); | /^Error: fn\nthrower@[^\n]+?\nerror_handling_2@[^\n]+?\n/); | |||
} | } | |||
}, "error handling 2", { expected_fail: true }]); | }, "error handling 2"]); | |||
tests.push([function () { | tests.push([function () { | |||
assert_equals(require('./stubber').stubbed, 'stubbed module'); | assert_equals(require('./stubber').stubbed, 'stubbed module'); | |||
assert_equals(require('./stubber').child.stubbed, 'stubbed module'); | assert_equals(require('./stubber').child.stubbed, 'stubbed module'); | |||
assert_throws("Cannot find module 'stubbed'", | assert_throws("Cannot find module 'stubbed'", | |||
function () { require('stubbed'); }); | function () { require('stubbed'); }); | |||
var count = 0; | var count = 0; | |||
require.stub('lazily_stubbed', function() { | require.stub('lazily_stubbed', function() { | |||
++count; | ++count; | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 1 lines changed or added |