/
index.js
57 lines (55 loc) · 2.33 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
it("should not create a context for typeof require", function() {
expect(require("./typeof")).toBe("function");
});
it("should answer typeof require correctly", function() {
expect((typeof require)).toBe("function");
});
it("should answer typeof define correctly", function() {
expect((typeof define)).toBe("function");
});
it("should answer typeof require.amd correctly", function() {
expect((typeof require.amd)).toBe("object");
});
it("should answer typeof define.amd correctly", function() {
expect((typeof define.amd)).toBe("object");
});
it("should answer typeof module correctly", function() {
expect((typeof module)).toBe("object");
});
it("should answer typeof exports correctly", function() {
expect((typeof exports)).toBe("object");
});
it("should answer typeof require.include correctly", function() {
expect((typeof require.include)).toBe("function");
});
it("should answer typeof require.ensure correctly", function() {
expect((typeof require.ensure)).toBe("function");
});
it("should answer typeof require.resolve correctly", function() {
expect((typeof require.resolve)).toBe("function");
});
it("should answer typeof __non_webpack_require__ correctly", function() {
var oldValue;
eval("oldValue = require;");
expect((typeof __non_webpack_require__)).toBe("function");
eval("require = undefined;");
expect((typeof __non_webpack_require__)).toBe("undefined");
eval("require = oldValue;");
expect((typeof __non_webpack_require__)).toBe("function");
});
it("should not parse filtered stuff", function() {
if(typeof require != "function") require("fail");
if(typeof require !== "function") require("fail");
if(!(typeof require == "function")) require("fail");
if(!(typeof require === "function")) require("fail");
if(typeof require == "undefined") require = require("fail");
if(typeof require === "undefined") require = require("fail");
if(typeof require.resolve !== "function") require("fail");
if(typeof module == "undefined") module = require("fail");
if(typeof module === "undefined") module = require("fail");
if(typeof module != "object") module = require("fail");
if(typeof exports == "undefined") exports = require("fail");
if(typeof System !== "object") exports = require("fail");
if(typeof require.include !== "function") require.include("fail");
if(typeof require.ensure !== "function") require.ensure(["fail"], function(){});
});