[njs] Tests: making exception test more portable in js.t.

noreply at nginx.com noreply at nginx.com
Fri Jul 26 00:56:02 UTC 2024


details:   https://github.com/nginx/njs/commit/29c71bf771a30e8120bf332f240c14257000dd05
branches:  master
commit:    29c71bf771a30e8120bf332f240c14257000dd05
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu, 18 Jul 2024 22:37:25 -0700
description:
Tests: making exception test more portable in js.t.


---
 nginx/t/js.t | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/nginx/t/js.t b/nginx/t/js.t
index 1e4a07b6..b7dfe3e6 100644
--- a/nginx/t/js.t
+++ b/nginx/t/js.t
@@ -260,13 +260,11 @@ $t->write_file('test.js', <<EOF);
     }
 
     function except(r) {
-        var fs = require('fs');
-        fs.readFileSync();
+        decodeURI("%E0");
     }
 
-
     function content_except(r) {
-        JSON.parse({}.a.a);
+        return {}.a.a;
     }
 
     function content_empty(r) {
@@ -356,9 +354,9 @@ like(http_get('/content_empty'), qr/500 Internal Server Error/,
 $t->stop();
 
 ok(index($t->read_file('error.log'), 'SEE-LOG') > 0, 'log js');
-ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0,
+ok(index($t->read_file('error.log'), 'at decodeURI') > 0,
 	'js_set backtrace');
-ok(index($t->read_file('error.log'), 'at JSON.parse') > 0,
+ok(index($t->read_file('error.log'), 'at content_except') > 0,
 	'js_content backtrace');
 
 ###############################################################################


More information about the nginx-devel mailing list