Skip to content

Commit ad834a1

Browse files
committed
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
1 parent 7513260 commit ad834a1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/test_builtin.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ function test_exception_prepare_stack()
4040
e = _e;
4141
}
4242

43+
Error.prepareStackTrace = undefined;
44+
4345
assert(e.stack.length === 2);
4446
const f = e.stack[0];
4547
assert(f.getFunctionName() === 'test_exception_prepare_stack');
46-
assert(f.getFileName() === 'tests/test_builtin.js');
48+
assert(f.getFileName().endsWith('test_builtin.js'));
4749
assert(f.getLineNumber() === 38);
4850
assert(f.getColumnNumber() === 19);
4951
assert(!f.isNative());
50-
51-
Error.prepareStackTrace = undefined;
5252
}
5353

5454
// Keep this at the top; it tests source positions.
@@ -68,16 +68,16 @@ function test_exception_stack_size_limit()
6868
e = _e;
6969
}
7070

71+
Error.stackTraceLimit = 10;
72+
Error.prepareStackTrace = undefined;
73+
7174
assert(e.stack.length === 1);
7275
const f = e.stack[0];
7376
assert(f.getFunctionName() === 'test_exception_stack_size_limit');
74-
assert(f.getFileName() === 'tests/test_builtin.js');
77+
assert(f.getFileName().endsWith('test_builtin.js'));
7578
assert(f.getLineNumber() === 66);
7679
assert(f.getColumnNumber() === 19);
7780
assert(!f.isNative());
78-
79-
Error.stackTraceLimit = 10;
80-
Error.prepareStackTrace = undefined;
8181
}
8282

8383
function assert(actual, expected, message) {

0 commit comments

Comments
 (0)