diff options
author | Johannes <johannes.ewald@roomieplanet.de> | 2012-06-23 16:10:34 +0400 |
---|---|---|
committer | Johannes <johannes.ewald@roomieplanet.de> | 2012-06-23 16:10:34 +0400 |
commit | d432d902513b69eb216c95505f755f616b9cf698 (patch) | |
tree | 7b488730232696aacd8ede60defc4c39a65c9960 /test | |
parent | b4c182b65a7d3ad4f8ab539fd24e138f86db6f0a (diff) |
added comments
Diffstat (limited to 'test')
-rw-r--r-- | test/testModules/moduleA.js | 8 | ||||
-rw-r--r-- | test/testModules/moduleB.js | 8 | ||||
-rw-r--r-- | test/testModules/sharedTestCases.js | 12 |
3 files changed, 3 insertions, 25 deletions
diff --git a/test/testModules/moduleA.js b/test/testModules/moduleA.js index fd665f7..6e655ab 100644 --- a/test/testModules/moduleA.js +++ b/test/testModules/moduleA.js @@ -31,9 +31,6 @@ function checkSomeGlobals() { if (typeof global === "undefined") {
throw new ReferenceError("global is undefined");
}
- if (typeof process === "undefined") {
- throw new ReferenceError("process is undefined");
- }
if (typeof console === "undefined") {
throw new ReferenceError("console is undefined");
}
@@ -52,10 +49,6 @@ function getConsole() { return console;
}
-function getProcess() {
- return process;
-}
-
function getFilename() {
return __filename;
}
@@ -68,6 +61,5 @@ exports.getMyObj = getMyObj; exports.readFileSync = readFileSync;
exports.checkSomeGlobals = checkSomeGlobals;
exports.getConsole = getConsole;
-exports.getProcess = getProcess;
exports.getFilename = getFilename;
exports.someOtherModule = someOtherModule;
\ No newline at end of file diff --git a/test/testModules/moduleB.js b/test/testModules/moduleB.js index fd665f7..6e655ab 100644 --- a/test/testModules/moduleB.js +++ b/test/testModules/moduleB.js @@ -31,9 +31,6 @@ function checkSomeGlobals() { if (typeof global === "undefined") {
throw new ReferenceError("global is undefined");
}
- if (typeof process === "undefined") {
- throw new ReferenceError("process is undefined");
- }
if (typeof console === "undefined") {
throw new ReferenceError("console is undefined");
}
@@ -52,10 +49,6 @@ function getConsole() { return console;
}
-function getProcess() {
- return process;
-}
-
function getFilename() {
return __filename;
}
@@ -68,6 +61,5 @@ exports.getMyObj = getMyObj; exports.readFileSync = readFileSync;
exports.checkSomeGlobals = checkSomeGlobals;
exports.getConsole = getConsole;
-exports.getProcess = getProcess;
exports.getFilename = getFilename;
exports.someOtherModule = someOtherModule;
\ No newline at end of file diff --git a/test/testModules/sharedTestCases.js b/test/testModules/sharedTestCases.js index 01f7e7b..b705e40 100644 --- a/test/testModules/sharedTestCases.js +++ b/test/testModules/sharedTestCases.js @@ -37,7 +37,7 @@ function cleanRequireCache() { }
}
-describe("rewire " + (typeof window === "undefined"? "in node.js": "in the browser"), function () {
+describe("rewire " + (typeof window === "undefined"? "(node.js)": "(browser)"), function () {
beforeEach(cleanRequireCache); // ensuring a clean test environment
it("should work like require()", function () {
expect(rewire("./moduleA.js")).to.be(require("./moduleA.js"));
@@ -109,25 +109,19 @@ describe("rewire " + (typeof window === "undefined"? "in node.js": "in the brows var rewiredModuleA = rewire("./moduleA.js"),
rewiredModuleB = rewire("./moduleB.js"),
consoleMock = {},
- processMock = {},
newFilename = "myFile.js";
rewiredModuleA.__set__({
- console: consoleMock,
- process: processMock
+ console: consoleMock
});
rewiredModuleA.__set__("__filename", newFilename);
rewiredModuleB.__set__({
- console: consoleMock,
- process: processMock
+ console: consoleMock
});
rewiredModuleB.__set__("__filename", newFilename);
expect(rewiredModuleA.getConsole()).to.be(consoleMock);
expect(rewiredModuleB.getConsole()).to.be(consoleMock);
expect(console).not.to.be(consoleMock);
- expect(rewiredModuleA.getProcess()).to.be(processMock);
- expect(rewiredModuleB.getProcess()).to.be(processMock);
- expect(process).not.to.be(processMock);
expect(rewiredModuleA.getFilename()).to.be(newFilename);
expect(rewiredModuleB.getFilename()).to.be(newFilename);
});
|