blob: 2674cf62218f6a30555af3bbbc17e8516c55afdc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
test("normal mode", () => {
expect(() => {
NaN = 5; // NaN is a non-writable global variable
}).not.toThrow();
});
test("strict mode", () => {
expect(() => {
"use strict";
NaN = 5; // NaN is a non-writable global variable
}).toThrowWithMessage(TypeError, "Cannot write to non-writable property 'NaN'");
});
|