Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JS: fix bugs in test environment for mocha.js
- Loading branch information
Alexey Andreev
authored and
Alexey Andreev
committed
Sep 29, 2016
1 parent
aa1a030
commit 44f7a94
Showing
6 changed files
with
66 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// SKIP_NODE_JS | ||
package foo | ||
|
||
val EXPECTED = """Hello, World | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
(function(global) { | ||
var modules = { kotlin: kotlin }; | ||
|
||
var emulatedModules = { kotlin: kotlin }; | ||
var module = { exports: {} }; | ||
|
||
function require(moduleId) { | ||
return modules[moduleId]; | ||
return emulatedModules[moduleId]; | ||
} | ||
|
||
function beginModule() { | ||
function __beginModule__() { | ||
module.exports = {}; | ||
} | ||
|
||
function endModule(moduleId) { | ||
modules[moduleId] = module.exports; | ||
function __endModule__(moduleId) { | ||
emulatedModules[moduleId] = module.exports; | ||
} | ||
|
||
function define(moduleId, dependencies, body) { | ||
var resolvedDependencies = []; | ||
for (var i = 0; i < dependencies.length; ++i) { | ||
resolvedDependencies.push(modules[dependencies[i]]); | ||
resolvedDependencies.push(emulatedModules[dependencies[i]]); | ||
} | ||
modules[moduleId] = body.apply(null, resolvedDependencies); | ||
emulatedModules[moduleId] = body.apply(null, resolvedDependencies); | ||
} | ||
|
||
global.require = require; | ||
global.define = define; | ||
global.__beginModule__ = beginModule; | ||
global.__endModule__ = endModule; | ||
global.module = module; | ||
})(this); | ||
define.amd = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters