Greasy Fork is available in English.

NH_base

Base library usable any time.

Ниже показаны версии этого скрипта, в которых изменялся код. Показать все версии.

  • v52 25.02.2024

    Implement base Exception class that will use the name of the class.

    When exception types inherit from Error, the name property sticks with the string "Error", making logs less useful.

    Issue #259.

    Bump version number.

  • v51 14.02.2024

    Stop using event as a local name as it shadows a global.

    Issue #238.

    Bump version number.

  • v50 12.02.2024

    Migrate Service to lib/base.

    Issue #167.

    Bump version number.

  • v49 08.02.2024

    Normalize vertical white space around logging {intro,outro}s.

    Closes #243.

    Bump version number.

  • v48 09.01.2024

    JSDoc: Correct @typedef

    Bump version number.

  • v47 06.01.2024

    Call a real console method to generate a stack trace.

    Closes #226.

    Bump version number.

  • v46 02.01.2024

    Minor tweak to wording in error message.

    Bump version number.

  • v45 19.12.2023

    Migrate asserts to using supported new constructs.

    Issue #183.

    Support chaining with Dispatcher.{on,off,fire}().

    Closes #207.

    Bump version number.

  • v44 14.12.2023

    Add descriptive text to some assertions.

    Issue #215.

    Bump version number.

  • v43 08.12.2023

    Add descriptive text to the assertEqual() in a loop.

    Issue #215.

    Bump version number.

  • v42 05.12.2023

    Update exports and documentation to match current file order.

    Promote ONE_ITEM to a global constant.

    Issue #216.

    Bump version number.

  • v41 04.12.2023

    Make use of new TestCase features in testing.

    Issue #183.

    Bump version number.

  • v40 02.12.2023

    Wrap call to console.error() with a MessageQueue.

    Just to make it easier to test.

    Issue #210.

    Replace a loop around a push() with the spread syntax.

    Bump version number.

  • v39 01.12.2023

    Move MessageQueue and friends higher in the file.

    Issue #210.

    Bump version number.

  • v38 29.11.2023

    Move Dispatcher higher in the file and write tests.

    Issue #210.

    Bump version number.

  • v37 26.11.2023

    Update comment now that we have a plan.

    Issue #210.

    Bump version number.

  • v36 24.11.2023

    Implement a simple message queuing system, MessageQueue.

    Issue #205.

    Expose a common issue collection for libraries and apps.

    Issue #205.

    Bump version number.

  • v35 22.11.2023

    eslint: Deal with some upcoming tweaks to newline-per-chained-call.

    Issue #203.

    Bump version number.

  • v34 18.11.2023

    Retire NH.xunit.testing.log and replace with local Logger.

    Issue #179.

    style-nudge: Right place nested classes in Logger.

    Issue #197.

    Bump version number.

  • v33 16.11.2023

    Use the new TestResult.summary() feature.

    Issue #200.

    Retire now unused doFunctionTests().

    Issue #179.

    Bump version number.

  • v32 15.11.2023

    Rewrite testLogger() as a TestCase.

    Issue #179.

    Bump version number.

  • v31 14.11.2023

    Rewrite Logger.#testGroupMode() as a TestCase.

    Issue #179.

    Bump version number.

  • v30 13.11.2023

    Only reset Logger instances that have configs when restored.

    Closes #199.

    Add some vertical whitespace.

    Rewrite testSafeId() as a TestCase.

    Issue #179.

    Bump version number.

  • v29 12.11.2023

    Rewrite testDefaultMap() as a TestCase.

    Issue #179.

    Bump version number.

  • v28 10.11.2023

    Rewrite testNumberOp() as a TestCase.

    Issue #179.

    Bump version number.

  • v27 09.11.2023

    Explicitly log fields in a failure.

    We are starting to add some formatting to failure messages, and this will make them apparent in the logs.

    Issue #183.

    Rewrite testEnsure() as a TestCase.

    Turns out there was a mistake, and being a Map resulting in one test being overwritten by another one registered.

    Also normalized casing of text in the exceptions and other minor cleanups.

    Issue #179.

    Bump version number.

  • v26 08.11.2023

    Bump minVersion of lib/xunit.

    Necessary to ensure TestCase.assertEqual().

    Issue #180.

    Bump version numbers.

  • v25 07.11.2023

    Reset the existing loggers after configs are changed.

    We were setting the global config section, but each Logger instance actually contained its own copy. This made changing configs at runtime impossible.

    Amusingly enough, this was planned for, by tracking the loggers, but we forgot to actually make use of it.

    Issue #145.

    style-nudge: Right place #private fields in Logger.

    Issue #173.

    Bump version numbers.

  • v24 05.11.2023

    Improved error message on library version failure.

    Improved error message on using wrong Dispatcher eventType.

    Bump version numbers.

  • v23 04.11.2023

    style-nudge: Right place getters in Logger.#GroupMode.

    Issue #173.

    style-nudge: Right place a getter in Logger.

    Issue #173.

    Bump version numbers.

  • v22 03.11.2023

    style-nudge: Right place a property in Logger.#Config.

    Issue #173.

    Bump version numbers.

  • v21 02.11.2023

    Implement simpleParseWords().

    This will replace SPA._parseHeader().

    Issue #180.

    Bump version numbers.

  • v20 01.11.2023

    Stop exporting the legacy testing object.

    Issue #167.

    Bump version numbers.

  • v19 28.10.2023

    Give each test failure its own log entry.

    Issue #172.

    Bump version numbers.

  • v18 28.10.2023

    Bump min version for lib/xunit; have test runners give a result code.

    Issue #172.

    Bump version numbers.

  • v17 27.10.2023

    Move internal functions outside of runTests().

    Issue #172.

    Bump version numbers.

  • v16 27.10.2023

    Have ensure() return a restricted namespace.

    This should reduce use of undeclared dependencies.

    Issue #175.

    The variable result should be singular.

    Issue #172.

    Bump version numbers.

  • v15 25.10.2023

    Depend on lib/xunit version 0.

    Issue #167.

    Have lib/base use testing from lib/xunit.

    Currently rexports it until the next release.

    Issues #167, #172.

    Bump version numbers.

  • v14 25.10.2023

    Oops, dropped a period after the last comment change.

    Start refactoring testing into its own library.

    Issues #167, #172.

    Bump version numbers.

  • v13 24.10.2023

    Add fields and methods to TestResult.

    Also moved it to just above TestRunner.

    Issue #172.

    Bring lib/base.{js,md} into sync.

    Issue #167.

    Track skipping or errors during TestCase.setUpClass.

    Issue #172.

    Bump version numbers.

  • v12 22.10.2023

    Document how to effectively use Logger.

    Issue #145.

    Forgot to export the new ensure function.

    Issue #167.

    Bump version numbers.

  • v11 21.10.2023

    Add a sequence number to Logger.

    Each logger instance, and individual groups, are updated to the current sequence upon use. The current sequence number grows each time configurations are restored from a saved state.

    If exposed to the end users, they will be able to use the sequence number as an indicator of the last time a particular logger or group was used. Useful if they want to clean up old settings they have (perhaps a logger was renamed, or a particular group no longer exists). It could also be used to rediscover perhaps forgotten features of the program.

    Issue #145.

    Bump version numbers.

  • v10 19.10.2023

    Include call counts in Logger's restore config tests.

    Issue #145.

    Move Logger.#Group pojo handling into #Group.

    Issue #145.

    Add ensure() for library validation.

    Because I wanted to use something different than require.

    Issue #167.

    Replace TestCase.run with a dedicated TestRunner class.

    Issue #172.

    Bump version numbers.

  • v9 19.10.2023

    Make NumberOp more robust against assigning null or undefined.

    This does move NumberOp a bit more away from the built-in Number class, but more useful.

    Issue #145.

    Fix a bug in Logger.#outro and normalize #intro.

    #outro was calling the actual log method after the group was popped, meaning the message was being controlled by the wrong mode. Since modes are fairly new, this had gone unnoticed.

    In fixing this, the actual logging was moved outside of the ending of the group. Updated #intro to be similar for consistency. (Though both of these will result in more accurate stats in the next change.)

    Issue #145.

    Add call counts to Logger.

    Both the logger itself, and the individual groups, now have counts.

    Users can use these counts to determine to identify where they may be excessive logging, or help figure out which loggers should be disabled or groups silenced when debugging.

    Issue #145.

    Migrate Dispatcher to lib/base.

    Issue #167.

    Enhance test runner to loop over the new TestCases.

    Issue #172.

    Rename FooTestCase to TestTestCase.

    Issue #172.

    Add missing space in comment.

    Rename TestCase.#classCleanups as classCleanups.

    That darned JavaScript issue where subclasses cannot update the #private properties of base classes.

    Issue #172.

    Have TestCase.run() call class setup and cleanups.

    Issue #172.

    Bump version numbers.

  • v8 18.10.2023

    Move a constant closer to the top of the file.

    Issue #167.

    Create a simple test runner.

    Issue #172.

    Make Logger groups always have a default name and mode.

    This does mean that a plain log() invocation outside of a group gets the name null and defaults to opened.

    Issue #145.

    Bump version number.

  • v7 17.10.2023

    Enhance DefaultMap to let the factory function take arguments.

    Issue #145.

    Change Logger.#groups to be a DefaultMap.

    This simplifies the code a bit, and will allow for a future enhancement.

    Issue #145.

    Bump version number.

  • v6 16.10.2023

    Start an xUnit style test framework.

    Not ready yet.

    Issue #167.

    Minor test cleanups.

    Issue #145.

    Migrate uuId, safeId, and strHash to lib/base.

    Issue #167.

    Bump version number.

  • v5 15.10.2023

    Create Logger.#Group and move GroupMode into it.

    We are soon going to have more items to track by group than just mode.

    This does change the API a bit, but we had already make an incompatible change when we made GroupMode private anyway. Since we currently still only have one known user, I think this is still a safe change to make.

    Issue #145.

    Bump version number.

  • v4 15.10.2023

    Add a NumberOp class that supports operator methods.

    Currently only supports the add operator and basic type coercion methods.

    Also converted one of the DefaultMap tests to use this, as that is similar to why this class is needed.

    Issue #145.

    Add assign method to NumberOp.

    Allows an existing instance to get a new value.

    Issue #145.

  • v4 15.10.2023

    eslint: Reconfigure no-multiple-empty-lines along with fix-ups.

    Rename trace to includeStackTrace.

    Now that this can be toggled with a few clicks, can make the name a bit longer.

    Issue #167.

    Retire Bob.

    I like Bob. But, Bob was confusing. But do not fear! Bob is still here part-time.

    Issue #167.

    Freeze #GroupMode instances.

    We verified the class was frozen, but not the instances.

    Issue #145.

    Add a NumberOp class that supports operator methods.

    Currently only supports the add operator and basic type coercion methods.

    Also converted one of the DefaultMap tests to use this, as that is similar to why this class is needed.

    Issue #145.

    Add assign method to NumberOp.

    Allows an existing instance to get a new value.

    Issue #145.

Показать все версии скрипта