From ad834a144564955941d69a47da92dfb8c1dfa67f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Sun, 8 Sep 2024 15:36:59 +0200 Subject: [PATCH] Fix Error.prepareStackTrace tests on Windows - Reset state before doing assertions since they also throw errors - Make the path check independent of the path separator --- tests/test_builtin.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_builtin.js b/tests/test_builtin.js index a5b03a0..8933589 100644 --- a/tests/test_builtin.js +++ b/tests/test_builtin.js @@ -40,15 +40,15 @@ function test_exception_prepare_stack() e = _e; } + Error.prepareStackTrace = undefined; + assert(e.stack.length === 2); const f = e.stack[0]; assert(f.getFunctionName() === 'test_exception_prepare_stack'); - assert(f.getFileName() === 'tests/test_builtin.js'); + assert(f.getFileName().endsWith('test_builtin.js')); assert(f.getLineNumber() === 38); assert(f.getColumnNumber() === 19); assert(!f.isNative()); - - Error.prepareStackTrace = undefined; } // Keep this at the top; it tests source positions. @@ -68,16 +68,16 @@ function test_exception_stack_size_limit() e = _e; } + Error.stackTraceLimit = 10; + Error.prepareStackTrace = undefined; + assert(e.stack.length === 1); const f = e.stack[0]; assert(f.getFunctionName() === 'test_exception_stack_size_limit'); - assert(f.getFileName() === 'tests/test_builtin.js'); + assert(f.getFileName().endsWith('test_builtin.js')); assert(f.getLineNumber() === 66); assert(f.getColumnNumber() === 19); assert(!f.isNative()); - - Error.stackTraceLimit = 10; - Error.prepareStackTrace = undefined; } function assert(actual, expected, message) {