@lumjs/tests 2.1.0 → 2.2.0
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/CHANGELOG.md +17 -1
- package/TODO.md +2 -3
- package/lib/harness/plugin/node.js +14 -2
- package/lib/index.js +3 -4
- package/lib/test/stats.js +2 -1
- package/package.json +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,20 @@ and a reference to a property of a module will be in `@tests.propName` format.
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [2.2.0] - 2026-01-30
|
|
15
|
+
### Changed
|
|
16
|
+
- Updated to reflect several changes in `@lumjs/core` in regards to deprecated
|
|
17
|
+
functions, etc. There's more to do yet, but it's a start!
|
|
18
|
+
|
|
19
|
+
## [2.1.1] - 2025-11-26
|
|
20
|
+
### Fixed / Changed
|
|
21
|
+
- The Harness (and `lumtest.js` script) can now handle ES Module test files.
|
|
22
|
+
Unlike CommonJS, you need to explicitly export the test instance!
|
|
23
|
+
- I have marked this as requiring Node.js v22 or higher.
|
|
24
|
+
That is mostly due to how the `node` plugin works, as it currently uses
|
|
25
|
+
`require()` for all test files regardless as to if they are CommonJS
|
|
26
|
+
or ES Modules, and that will explode on older Node.js versions.
|
|
27
|
+
|
|
14
28
|
## [2.1.0] - 2025-11-26
|
|
15
29
|
### Changed
|
|
16
30
|
- Bumped core version to newest release with changes to _stringify_.
|
|
@@ -204,7 +218,9 @@ and a reference to a property of a module will be in `@tests.propName` format.
|
|
|
204
218
|
- Ported from Lum.js v4 library set.
|
|
205
219
|
- Added a few more features from the PHP version.
|
|
206
220
|
|
|
207
|
-
[Unreleased]: https://github.com/supernovus/lum.tests.js/compare/v2.
|
|
221
|
+
[Unreleased]: https://github.com/supernovus/lum.tests.js/compare/v2.1.1...HEAD
|
|
222
|
+
[2.1.1]: https://github.com/supernovus/lum.tests.js/compare/v2.1.0...v2.1.1
|
|
223
|
+
[2.1.0]: https://github.com/supernovus/lum.tests.js/compare/v2.0.0...v2.1.0
|
|
208
224
|
[2.0.0]: https://github.com/supernovus/lum.tests.js/compare/v1.9.0...v2.0.0
|
|
209
225
|
[1.9.0]: https://github.com/supernovus/lum.tests.js/compare/v1.8.0...v1.9.0
|
|
210
226
|
[1.8.0]: https://github.com/supernovus/lum.tests.js/compare/v1.7.1...v1.8.0
|
package/TODO.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# TODO
|
|
2
2
|
|
|
3
|
-
-
|
|
4
|
-
|
|
3
|
+
- Update the `peggy` package to the v5.x releases.
|
|
4
|
+
|
|
5
5
|
- Write tests for:
|
|
6
6
|
- `call()`
|
|
7
7
|
- `diesWith()`
|
|
@@ -11,4 +11,3 @@
|
|
|
11
11
|
- `async()` (currently used in `@lumjs/encode:v2.0.0` package).
|
|
12
12
|
- Test the `harness/parser` and associated `grammar/tap` libraries.
|
|
13
13
|
- Test the *external* test mode in `Harness`.
|
|
14
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Node.js harness plugin
|
|
2
2
|
const core = require('@lumjs/core');
|
|
3
|
-
const {N,F,S} = core.types;
|
|
3
|
+
const {N,F,S,isObj} = core.types;
|
|
4
4
|
const Plugin = require('./index');
|
|
5
5
|
const cp = require('node:child_process');
|
|
6
6
|
const getCwd = require('node:process').cwd;
|
|
@@ -8,6 +8,7 @@ const fs = require('node:fs');
|
|
|
8
8
|
const path = require('node:path');
|
|
9
9
|
const RE = /[\/\(\[]+/;
|
|
10
10
|
const WS = /\s+/g;
|
|
11
|
+
const MJS_EXPS = ['default','test','t'];
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Node.js Harness plugin
|
|
@@ -20,7 +21,16 @@ class NodePlugin extends Plugin
|
|
|
20
21
|
runInternal(queued)
|
|
21
22
|
{
|
|
22
23
|
let name = path.join(getCwd(), queued.filename);
|
|
23
|
-
|
|
24
|
+
let mod = require(name);
|
|
25
|
+
if (!(mod instanceof Stats)) {
|
|
26
|
+
for (let exp of MJS_EXPS) {
|
|
27
|
+
if (mod[exp] instanceof Stats) {
|
|
28
|
+
return mod[exp];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
throw new Error("test files MUST export the Test instance");
|
|
32
|
+
}
|
|
33
|
+
return mod;
|
|
24
34
|
}
|
|
25
35
|
|
|
26
36
|
runExternal(queued)
|
|
@@ -97,3 +107,5 @@ class NodePlugin extends Plugin
|
|
|
97
107
|
} // Node plugin class
|
|
98
108
|
|
|
99
109
|
module.exports = NodePlugin;
|
|
110
|
+
|
|
111
|
+
const Stats = require('../../test/stats');
|
package/lib/index.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Several test related classes.
|
|
3
3
|
* @module @lumjs/tests
|
|
4
4
|
*/
|
|
5
|
-
const {
|
|
6
|
-
|
|
7
|
-
const E = def.e;
|
|
5
|
+
const {df,lazy} = require('@lumjs/core');
|
|
6
|
+
const E = {enumerable: true};
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* The main Test class
|
|
@@ -13,7 +12,7 @@ const E = def.e;
|
|
|
13
12
|
* @class
|
|
14
13
|
* @see module:@lumjs/tests/test
|
|
15
14
|
*/
|
|
16
|
-
|
|
15
|
+
df(exports, 'Test', require('./test'), E);
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* Test Harness class (lazy loaded)
|
package/lib/test/stats.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const core = require('@lumjs/core');
|
|
2
2
|
const mods = require('@lumjs/core/modules');
|
|
3
|
+
const describe = require('@lumjs/describe');
|
|
3
4
|
const {types} = core;
|
|
4
5
|
const {S,N,F,isObj,def} = types;
|
|
5
6
|
const Log = require('./log');
|
|
@@ -144,7 +145,7 @@ class LumTestStats
|
|
|
144
145
|
|
|
145
146
|
stringify(what)
|
|
146
147
|
{
|
|
147
|
-
return
|
|
148
|
+
return describe(what, this.stringifyOpts);
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumjs/tests",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"bin":
|
|
6
6
|
{
|
|
@@ -27,15 +27,19 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies":
|
|
29
29
|
{
|
|
30
|
-
"@lumjs/core": "^1.38.
|
|
30
|
+
"@lumjs/core": "^1.38.6",
|
|
31
|
+
"@lumjs/describe": "^1.0.0"
|
|
31
32
|
},
|
|
32
33
|
"scripts": {
|
|
33
|
-
"test": "./bin/lumtest.js",
|
|
34
|
+
"test": "./bin/lumtest.js -e '\\.[mc]?js$'",
|
|
34
35
|
"build-docs": "jsdoc -c ./jsdoc.json",
|
|
35
36
|
"build": "npm run build:grammar",
|
|
36
37
|
"build:grammar": "./bin/build-grammar.sh tap"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"peggy": "^2.0.1"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=22.0.0"
|
|
40
44
|
}
|
|
41
45
|
}
|