phptest 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -3
- package/src/createIntegrationTools.js +17 -18
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.4",
|
|
3
3
|
"name": "phptest",
|
|
4
4
|
"description": "Test helper library for PHP core runtime components",
|
|
5
5
|
"keywords": [
|
|
@@ -29,12 +29,14 @@
|
|
|
29
29
|
"lie": "^3.3.0",
|
|
30
30
|
"microdash": "^1.4.2",
|
|
31
31
|
"regexp.escape": "^1.1.0",
|
|
32
|
-
"source-map": "^0.
|
|
32
|
+
"source-map": "^0.8.0-beta.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"phpcore": "^7.1.0"
|
|
33
36
|
},
|
|
34
37
|
"peerDependencies": {
|
|
35
38
|
"core-js-pure": "^3.21.1",
|
|
36
39
|
"mocha": "^9.2.2",
|
|
37
|
-
"phpcore": "^7.1.0",
|
|
38
40
|
"phptoast": "^9.0.1",
|
|
39
41
|
"phptojs": "^9.0.0"
|
|
40
42
|
},
|
|
@@ -13,27 +13,30 @@ var _ = require('microdash'),
|
|
|
13
13
|
escapeRegex = require('regexp.escape'),
|
|
14
14
|
path = require('path'),
|
|
15
15
|
mochaPath = path.dirname(require.resolve('mocha/package.json')),
|
|
16
|
-
phpCorePath = path.resolve(__dirname, '../..'),
|
|
17
16
|
phpToAST = require('phptoast'),
|
|
18
17
|
phpToJS = require('phptojs'),
|
|
19
18
|
util = require('util'),
|
|
20
|
-
OpcodeExecutor = require('phpcore/src/Core/Opcode/Handler/OpcodeExecutor'),
|
|
21
|
-
Reference = require('../../src/Reference/Reference'),
|
|
22
19
|
SourceMapConsumer = require('source-map').SourceMapConsumer,
|
|
23
|
-
|
|
24
|
-
Variable = require('../../src/Variable').sync(),
|
|
25
|
-
WeakMap = require('es6-weak-map'),
|
|
26
|
-
runtimeFactory = require('../../src/shared/runtimeFactory');
|
|
20
|
+
WeakMap = require('es6-weak-map');
|
|
27
21
|
|
|
28
22
|
/**
|
|
29
23
|
* Creates an integration test helper tools object.
|
|
30
24
|
*
|
|
31
|
-
* @param {
|
|
25
|
+
* @param {string} phpCorePath
|
|
26
|
+
* @param {Function=} initRuntime
|
|
32
27
|
* @returns {Object}
|
|
33
28
|
*/
|
|
34
|
-
module.exports = function (initRuntime) {
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
module.exports = function (phpCorePath, initRuntime) {
|
|
30
|
+
var
|
|
31
|
+
OpcodeExecutor = require(phpCorePath + '/src/Core/Opcode/Handler/OpcodeExecutor'),
|
|
32
|
+
Reference = require(phpCorePath + '/src/Reference/Reference'),
|
|
33
|
+
Value = require(phpCorePath + '/src/Value').sync(),
|
|
34
|
+
Variable = require(phpCorePath + '/src/Variable').sync(),
|
|
35
|
+
runtimeFactory = require(phpCorePath + '/src/shared/runtimeFactory'),
|
|
36
|
+
|
|
37
|
+
// A map that allows looking up the source map data for a module later on.
|
|
38
|
+
moduleDataMap = new WeakMap(),
|
|
39
|
+
|
|
37
40
|
/**
|
|
38
41
|
* Creates a Runtime with the given mode.
|
|
39
42
|
*
|
|
@@ -41,7 +44,9 @@ module.exports = function (initRuntime) {
|
|
|
41
44
|
* @returns {Runtime}
|
|
42
45
|
*/
|
|
43
46
|
createRuntime = function (mode) {
|
|
44
|
-
|
|
47
|
+
var runtime = runtimeFactory.create(mode);
|
|
48
|
+
|
|
49
|
+
return initRuntime ? initRuntime(runtime) : runtime;
|
|
45
50
|
},
|
|
46
51
|
|
|
47
52
|
createAsyncRuntime = function () {
|
|
@@ -133,12 +138,6 @@ module.exports = function (initRuntime) {
|
|
|
133
138
|
)()
|
|
134
139
|
.match(/<anonymous>:(\d+):\d+/)[1] - 1;
|
|
135
140
|
|
|
136
|
-
if (!initRuntime) {
|
|
137
|
-
initRuntime = function (runtime) {
|
|
138
|
-
return runtime;
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
|
|
142
141
|
// Force all opcodes to be async for all async mode tests, to help ensure async handling is in place.
|
|
143
142
|
asyncRuntime.install({
|
|
144
143
|
serviceGroups: [
|