@jsenv/test 3.7.44 → 3.7.46
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/dist/jsenv_test.js +31 -18
- package/package.json +4 -4
package/dist/jsenv_test.js
CHANGED
|
@@ -1611,7 +1611,7 @@ const createDynamicLog = ({
|
|
|
1611
1611
|
};
|
|
1612
1612
|
|
|
1613
1613
|
let lastOutput = "";
|
|
1614
|
-
let
|
|
1614
|
+
let wroteFromOutside = false;
|
|
1615
1615
|
let clearAttemptResult;
|
|
1616
1616
|
let writing = false;
|
|
1617
1617
|
|
|
@@ -1660,7 +1660,7 @@ const createDynamicLog = ({
|
|
|
1660
1660
|
}
|
|
1661
1661
|
let stringToWrite = string;
|
|
1662
1662
|
if (lastOutput) {
|
|
1663
|
-
if (
|
|
1663
|
+
if (wroteFromOutside) {
|
|
1664
1664
|
// We don't want to clear logs written by other code,
|
|
1665
1665
|
// it makes output unreadable and might erase precious information
|
|
1666
1666
|
// To detect this we put a spy on the stream.
|
|
@@ -1668,7 +1668,7 @@ const createDynamicLog = ({
|
|
|
1668
1668
|
// something else than this code has written in the stream
|
|
1669
1669
|
// so we just write without clearing (append instead of replacing)
|
|
1670
1670
|
lastOutput = "";
|
|
1671
|
-
|
|
1671
|
+
wroteFromOutside = false;
|
|
1672
1672
|
} else {
|
|
1673
1673
|
stringToWrite = `${getErasePreviousOutput()}${string}`;
|
|
1674
1674
|
}
|
|
@@ -1699,7 +1699,7 @@ const createDynamicLog = ({
|
|
|
1699
1699
|
update(ouputAfterCallback);
|
|
1700
1700
|
};
|
|
1701
1701
|
|
|
1702
|
-
const writeFromOutsideEffect = (
|
|
1702
|
+
const writeFromOutsideEffect = () => {
|
|
1703
1703
|
if (!lastOutput) {
|
|
1704
1704
|
// we don't care if the log never wrote anything
|
|
1705
1705
|
// or if last update() wrote an empty string
|
|
@@ -1708,8 +1708,10 @@ const createDynamicLog = ({
|
|
|
1708
1708
|
if (writing) {
|
|
1709
1709
|
return;
|
|
1710
1710
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1711
|
+
wroteFromOutside = true;
|
|
1712
|
+
// the outside output is already in the stream: whoever reacts to this must
|
|
1713
|
+
// leave it alone, only stop refreshing above it
|
|
1714
|
+
dynamicLog.onWriteFromOutside();
|
|
1713
1715
|
};
|
|
1714
1716
|
|
|
1715
1717
|
let removeStreamSpy;
|
|
@@ -1736,7 +1738,7 @@ const createDynamicLog = ({
|
|
|
1736
1738
|
removeStreamSpy();
|
|
1737
1739
|
removeStreamSpy = null;
|
|
1738
1740
|
lastOutput = "";
|
|
1739
|
-
|
|
1741
|
+
wroteFromOutside = false;
|
|
1740
1742
|
}
|
|
1741
1743
|
};
|
|
1742
1744
|
|
|
@@ -1754,27 +1756,20 @@ const createDynamicLog = ({
|
|
|
1754
1756
|
// is that node.js will later throw error if stream gets closed
|
|
1755
1757
|
// while something listening data on it
|
|
1756
1758
|
const spyStreamOutput = (stream, callback) => {
|
|
1757
|
-
let output = "";
|
|
1758
1759
|
let installed = true;
|
|
1759
1760
|
const originalWrite = stream.write;
|
|
1760
1761
|
stream.write = function (...args /* chunk, encoding, callback */) {
|
|
1761
|
-
|
|
1762
|
-
callback(output);
|
|
1762
|
+
callback();
|
|
1763
1763
|
return originalWrite.call(this, ...args);
|
|
1764
1764
|
};
|
|
1765
1765
|
|
|
1766
|
-
|
|
1766
|
+
return () => {
|
|
1767
1767
|
if (!installed) {
|
|
1768
1768
|
return;
|
|
1769
1769
|
}
|
|
1770
1770
|
stream.write = originalWrite;
|
|
1771
1771
|
installed = false;
|
|
1772
1772
|
};
|
|
1773
|
-
|
|
1774
|
-
return () => {
|
|
1775
|
-
uninstall();
|
|
1776
|
-
return output;
|
|
1777
|
-
};
|
|
1778
1773
|
};
|
|
1779
1774
|
|
|
1780
1775
|
const pathnameToExtension = (pathname) => {
|
|
@@ -2171,7 +2166,25 @@ const assertAndNormalizeFileUrl = (
|
|
|
2171
2166
|
return value;
|
|
2172
2167
|
};
|
|
2173
2168
|
|
|
2174
|
-
|
|
2169
|
+
/*
|
|
2170
|
+
* Which of two pathnames comes first: directories before what is under them,
|
|
2171
|
+
* deeper before shallower, then the names themselves.
|
|
2172
|
+
*
|
|
2173
|
+
* How a leading number reads is the caller's call, because the two readings are
|
|
2174
|
+
* both right somewhere:
|
|
2175
|
+
* - numeric (the default), where the number is a quantity: "9_x" then "10_x" —
|
|
2176
|
+
* what a generated list wants, so a story numbered by hand stays in the order
|
|
2177
|
+
* it happens;
|
|
2178
|
+
* - { numeric: false }, where the number is part of the name: "10_x" right
|
|
2179
|
+
* after "1_x" — the order the filesystem itself gives, and the one every file
|
|
2180
|
+
* explorer above it shows, so a human reading a directory finds it in the
|
|
2181
|
+
* order their editor already shows.
|
|
2182
|
+
*/
|
|
2183
|
+
const comparePathnames = (
|
|
2184
|
+
leftPathame,
|
|
2185
|
+
rightPathname,
|
|
2186
|
+
{ numeric = true } = {},
|
|
2187
|
+
) => {
|
|
2175
2188
|
const leftPartArray = leftPathame.split("/");
|
|
2176
2189
|
const rightPartArray = rightPathname.split("/");
|
|
2177
2190
|
|
|
@@ -2207,7 +2220,7 @@ const comparePathnames = (leftPathame, rightPathname) => {
|
|
|
2207
2220
|
i++;
|
|
2208
2221
|
// local comparison comes first
|
|
2209
2222
|
const comparison = leftPart.localeCompare(rightPart, undefined, {
|
|
2210
|
-
numeric
|
|
2223
|
+
numeric,
|
|
2211
2224
|
sensitivity: "base",
|
|
2212
2225
|
});
|
|
2213
2226
|
if (comparison !== 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/test",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@c88/v8-coverage": "0.1.1",
|
|
34
|
-
"@jsenv/ast": "6.10.
|
|
35
|
-
"@jsenv/plugin-supervisor": "1.8.
|
|
36
|
-
"@jsenv/sourcemap": "1.4.
|
|
34
|
+
"@jsenv/ast": "6.10.4",
|
|
35
|
+
"@jsenv/plugin-supervisor": "1.8.23",
|
|
36
|
+
"@jsenv/sourcemap": "1.4.9",
|
|
37
37
|
"he": "1.2.0",
|
|
38
38
|
"istanbul-lib-coverage": "3.2.2",
|
|
39
39
|
"istanbul-lib-instrument": "6.0.3",
|