Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf5fd56e

Browse files
committed
- added a test for the case where a comment is on the last line
1 parent1a807a5 commitf5fd56e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

‎test/testModules/emptyModule.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
"use strict";// run code in ES5 strict mode
2+
3+
varsomeVar;
4+
5+
// Comment on file end. Hope this won't break anything

‎test/testModules/sharedTestCases.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ describe("rewire " + (typeof testEnv === "undefined"? "(node)": "(" + testEnv +
145145
}
146146
}
147147
});
148+
it("should not be a problem to have a comment on file end",function(){
149+
varrewired=rewire("./emptyModule.js");
150+
151+
rewired.__set__("someVar","hello");
152+
expect(rewired.__get__("someVar")).to.be("hello");
153+
});
148154
it("should not influence the original require if nothing has been required within the rewired module",function(){
149155
rewire("./emptyModule.js");// nothing happens here because emptyModule doesn't require anything
150156
expect(require("./moduleA.js").__set__).to.be(undefined);// if restoring the original node require didn't worked, the module would have a setter

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp