@lumjs/tests 1.6.0 → 1.7.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 +32 -2
- package/TODO.md +2 -3
- package/bin/lumtest.js +65 -0
- package/lib/grammar/README.md +6 -0
- package/lib/grammar/tap.js +996 -0
- package/lib/harness/browser.js +18 -0
- package/lib/harness/errors.js +44 -0
- package/lib/harness/index.js +260 -0
- package/lib/harness/node.js +71 -0
- package/lib/harness/parser.js +153 -0
- package/lib/harness/plugin.js +77 -0
- package/lib/harness/queuedtest.js +14 -0
- package/lib/index.js +19 -14
- package/lib/{functional.js → test/functional.js} +4 -4
- package/lib/{test.js → test/index.js} +10 -309
- package/lib/{log.js → test/log.js} +14 -8
- package/lib/test/stats.js +385 -0
- package/package.json +22 -13
- package/lib/harness.js +0 -25
- package/test/basics.js +0 -50
- package/test/data/people.js +0 -58
- package/test/dies.js +0 -17
- package/test/functional_basics.js +0 -54
- package/test/functional_dies.js +0 -17
- package/test/functional_isa.js +0 -23
- package/test/inc/basics.js +0 -72
- package/test/inc/dies.js +0 -78
- package/test/inc/isa.js +0 -110
- package/test/isa.js +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,38 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
In this document, an identifier of `@tests` is not a real package name, but a
|
|
8
|
+
shorthand form for the real package name of `@lumjs/tests`.
|
|
9
|
+
So a reference to an exported sub-module will be in `@tests/submodule` format,
|
|
10
|
+
and a reference to a property of a module will be in `@tests.propName` format.
|
|
11
|
+
|
|
7
12
|
## [Unreleased]
|
|
8
13
|
|
|
14
|
+
## [1.7.1] - 2022-10-18
|
|
15
|
+
### Changed
|
|
16
|
+
- Bumped `@lumjs/core` to `1.7.1`.
|
|
17
|
+
- Moved from custom lazy-loading to `ModuleBuilder`.
|
|
18
|
+
|
|
19
|
+
## [1.7.0] - 2022-09-29
|
|
20
|
+
#### The *harness* update
|
|
21
|
+
### Added
|
|
22
|
+
- Implemented `tests.Harness` library.
|
|
23
|
+
- Added a `Tap` grammar using the `peggy` library.
|
|
24
|
+
- Added `.npmignore` file, separate from `.gitignore`.
|
|
25
|
+
- The grammar source is ignored by `npm`, but kept in `git`.
|
|
26
|
+
- The compiled grammar is ignored by `git`, but kept in `npm`.
|
|
27
|
+
- Added `bin/build-grammar.sh` developer-only helper.
|
|
28
|
+
- Added `bin/lumtest.js` package CLI script.
|
|
29
|
+
- Using `lumtest.js` instead of `prove` for `npm test` now.
|
|
30
|
+
### Changed
|
|
31
|
+
- Split `Test` class into `Stats` (test stats) and `Test` (actual testing methods.)
|
|
32
|
+
- A bunch of restructuring of the internal files:
|
|
33
|
+
- `test.js` → `test/index.js`, `test/stats.js`
|
|
34
|
+
- `log.js` → `test/log.js`
|
|
35
|
+
- `functional.js` → `test/functional.js`
|
|
36
|
+
- `harness.js` → `harness/index.js`
|
|
37
|
+
- Made the default module use *lazy-loading* for anything other than `tests.Test`.
|
|
38
|
+
|
|
9
39
|
## [1.6.0] - 2022-09-12
|
|
10
40
|
#### The *sub-classes* update
|
|
11
41
|
### Added
|
|
@@ -46,7 +76,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
46
76
|
- Added `matches` method for using a regular expression to match a string.
|
|
47
77
|
- Added `callIs()` method that is like `call()` but takes a desired value and passes the function return value to `cmp()`, `isa()`, or other test methods.
|
|
48
78
|
- A new `test.ran` computed property.
|
|
49
|
-
|
|
50
79
|
### Changed
|
|
51
80
|
- Updated `@lumjs/core` dependency to `^1.0.0` (no more *beta* tags!)
|
|
52
81
|
- Updated various *docblocks* for documentation.
|
|
@@ -105,7 +134,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
105
134
|
- Ported from Lum.js v4 library set.
|
|
106
135
|
- Added a few more features from the PHP version.
|
|
107
136
|
|
|
108
|
-
[Unreleased]: https://github.com/supernovus/lum.tests.js/compare/v1.
|
|
137
|
+
[Unreleased]: https://github.com/supernovus/lum.tests.js/compare/v1.7.0...HEAD
|
|
138
|
+
[1.7.0]: https://github.com/supernovus/lum.tests.js/compare/v1.6.0...v1.7.0
|
|
109
139
|
[1.6.0]: https://github.com/supernovus/lum.tests.js/compare/v1.5.0...v1.6.0
|
|
110
140
|
[1.5.0]: https://github.com/supernovus/lum.tests.js/compare/v1.4.0...v1.5.0
|
|
111
141
|
[1.4.0]: https://github.com/supernovus/lum.tests.js/compare/v1.3.0...v1.4.0
|
package/TODO.md
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
- `callIs()`
|
|
7
7
|
- `matches()`
|
|
8
8
|
- `run()`
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- Create `lumtest` binary for running the harness without `prove` utility.
|
|
9
|
+
- Test the `harness/parser` and associated `grammar/tap` libraries.
|
|
10
|
+
- Test the *external* test mode in `Harness`.
|
|
12
11
|
|
package/bin/lumtest.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const process = require('node:process');
|
|
3
|
+
const Harness = require('../lib/harness');
|
|
4
|
+
const core = require('@lumjs/core');
|
|
5
|
+
const {S} = core.types;
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
|
|
9
|
+
const hOpts =
|
|
10
|
+
{
|
|
11
|
+
plannedFailure: true,
|
|
12
|
+
plannedWarning: true,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let rPlan = true;
|
|
16
|
+
let aDir = './test';
|
|
17
|
+
|
|
18
|
+
const aOpts =
|
|
19
|
+
{
|
|
20
|
+
ext: '.js',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const flags =
|
|
24
|
+
{
|
|
25
|
+
'-d': v => aDir = v,
|
|
26
|
+
'-e': v => aOpts.ext = v,
|
|
27
|
+
'-r': v => aOpts.recurse = parseInt(v),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const toggles =
|
|
31
|
+
{
|
|
32
|
+
'-f': () => hOpts.plannedFailure = false,
|
|
33
|
+
'-q': () => hOpts.plannedWarning = false,
|
|
34
|
+
'-R': () => aOpts.recurse = 99, // Never will go this far down
|
|
35
|
+
'-P': () => rPlan = false,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let mode = null;
|
|
39
|
+
|
|
40
|
+
for (const arg of args)
|
|
41
|
+
{
|
|
42
|
+
if (flags[arg])
|
|
43
|
+
{ // A mode switch
|
|
44
|
+
mode = arg;
|
|
45
|
+
}
|
|
46
|
+
else if (typeof mode === S)
|
|
47
|
+
{ // A flag that has a single argument
|
|
48
|
+
const flag = flags[mode];
|
|
49
|
+
flag(arg);
|
|
50
|
+
mode = null;
|
|
51
|
+
}
|
|
52
|
+
else if (toggles[arg])
|
|
53
|
+
{ // A toggle that takes no arguments
|
|
54
|
+
toggles[arg]();
|
|
55
|
+
}
|
|
56
|
+
else
|
|
57
|
+
{
|
|
58
|
+
console.warn("unsupported argument", arg);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const harness = new Harness(hOpts); // Create our Harness instance.
|
|
63
|
+
module.exports = harness; // Export it as the 'main' module.
|
|
64
|
+
harness.addDir(aDir, aOpts); // Add all the files in the test dir.
|
|
65
|
+
harness.run(rPlan); // Run all the tests.
|