@lumjs/tests 2.1.0 → 2.1.1
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 +12 -1
- package/TODO.md +0 -3
- package/lib/harness/plugin/node.js +14 -2
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,15 @@ and a reference to a property of a module will be in `@tests.propName` format.
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [2.1.1] - 2025-11-26
|
|
15
|
+
### Fixed / Changed
|
|
16
|
+
- The Harness (and `lumtest.js` script) can now handle ES Module test files.
|
|
17
|
+
Unlike CommonJS, you need to explicitly export the test instance!
|
|
18
|
+
- I have marked this as requiring Node.js v22 or higher.
|
|
19
|
+
That is mostly due to how the `node` plugin works, as it currently uses
|
|
20
|
+
`require()` for all test files regardless as to if they are CommonJS
|
|
21
|
+
or ES Modules, and that will explode on older Node.js versions.
|
|
22
|
+
|
|
14
23
|
## [2.1.0] - 2025-11-26
|
|
15
24
|
### Changed
|
|
16
25
|
- Bumped core version to newest release with changes to _stringify_.
|
|
@@ -204,7 +213,9 @@ and a reference to a property of a module will be in `@tests.propName` format.
|
|
|
204
213
|
- Ported from Lum.js v4 library set.
|
|
205
214
|
- Added a few more features from the PHP version.
|
|
206
215
|
|
|
207
|
-
[Unreleased]: https://github.com/supernovus/lum.tests.js/compare/v2.
|
|
216
|
+
[Unreleased]: https://github.com/supernovus/lum.tests.js/compare/v2.1.1...HEAD
|
|
217
|
+
[2.1.1]: https://github.com/supernovus/lum.tests.js/compare/v2.1.0...v2.1.1
|
|
218
|
+
[2.1.0]: https://github.com/supernovus/lum.tests.js/compare/v2.0.0...v2.1.0
|
|
208
219
|
[2.0.0]: https://github.com/supernovus/lum.tests.js/compare/v1.9.0...v2.0.0
|
|
209
220
|
[1.9.0]: https://github.com/supernovus/lum.tests.js/compare/v1.8.0...v1.9.0
|
|
210
221
|
[1.8.0]: https://github.com/supernovus/lum.tests.js/compare/v1.7.1...v1.8.0
|
package/TODO.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# TODO
|
|
2
2
|
|
|
3
|
-
- Add explicit support for running ES Module based tests.
|
|
4
|
-
- An alternative to passing `module` object to test instances.
|
|
5
3
|
- Write tests for:
|
|
6
4
|
- `call()`
|
|
7
5
|
- `diesWith()`
|
|
@@ -11,4 +9,3 @@
|
|
|
11
9
|
- `async()` (currently used in `@lumjs/encode:v2.0.0` package).
|
|
12
10
|
- Test the `harness/parser` and associated `grammar/tap` libraries.
|
|
13
11
|
- 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'];
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumjs/tests",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"bin":
|
|
6
6
|
{
|
|
@@ -30,12 +30,15 @@
|
|
|
30
30
|
"@lumjs/core": "^1.38.4"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"test": "./bin/lumtest.js",
|
|
33
|
+
"test": "./bin/lumtest.js -e '\\.[mc]?js$'",
|
|
34
34
|
"build-docs": "jsdoc -c ./jsdoc.json",
|
|
35
35
|
"build": "npm run build:grammar",
|
|
36
36
|
"build:grammar": "./bin/build-grammar.sh tap"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"peggy": "^2.0.1"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=22.0.0"
|
|
40
43
|
}
|
|
41
44
|
}
|