mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-25 09:23:17 +01:00
38 lines
658 B
Plaintext
38 lines
658 B
Plaintext
meta {
|
|
name: invalid and valid module imports
|
|
type: http
|
|
seq: 3
|
|
}
|
|
|
|
get {
|
|
url: {{host}}/ping
|
|
body: none
|
|
auth: none
|
|
}
|
|
|
|
assert {
|
|
invalid_module_error_thrown: eq true
|
|
valid_module_no_error: eq true
|
|
}
|
|
|
|
script:pre-request {
|
|
try {
|
|
bru.setVar('invalid_module_error_thrown', false);
|
|
// should throw an error
|
|
const invalid = require("./lib/invalid");
|
|
}
|
|
catch(error) {
|
|
bru.setVar('invalid_module_error_thrown', true);
|
|
}
|
|
|
|
|
|
try {
|
|
bru.setVar('valid_module_no_error', true);
|
|
// should not throw an error
|
|
const math = require("./lib/math");
|
|
}
|
|
catch(error) {
|
|
bru.setVar('valid_module_no_error', false);
|
|
}
|
|
}
|