logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

abbrev-2.0.0-node_test.patch (2606B)


  1. From 08f0f108ece47624da15a77a6f1aeb3016946201 Mon Sep 17 00:00:00 2001
  2. From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
  3. Date: Fri, 8 Sep 2023 10:11:49 +0200
  4. Subject: [PATCH] Depend on node:test instead of npm:tap
  5. ---
  6. package.json | 15 ++++-----------
  7. test/test.js | 23 +++++++++++------------
  8. 2 files changed, 15 insertions(+), 23 deletions(-)
  9. diff --git a/package.json b/package.json
  10. index e264004..4123322 100644
  11. --- a/package.json
  12. +++ b/package.json
  13. @@ -3,9 +3,9 @@
  14. "version": "2.0.0",
  15. "description": "Like ruby's abbrev module, but in js",
  16. "author": "GitHub Inc.",
  17. - "main": "lib/index.js",
  18. + "exports": "./lib/index.js",
  19. "scripts": {
  20. - "test": "tap",
  21. + "test": "node test/test.js",
  22. "lint": "eslint \"**/*.js\"",
  23. "postlint": "template-oss-check",
  24. "template-oss-apply": "template-oss-apply --force",
  25. @@ -20,21 +20,14 @@
  26. "license": "ISC",
  27. "devDependencies": {
  28. "@npmcli/eslint-config": "^4.0.0",
  29. - "@npmcli/template-oss": "4.8.0",
  30. - "tap": "^16.3.0"
  31. - },
  32. - "tap": {
  33. - "nyc-arg": [
  34. - "--exclude",
  35. - "tap-snapshots/**"
  36. - ]
  37. + "@npmcli/template-oss": "4.8.0"
  38. },
  39. "files": [
  40. "bin/",
  41. "lib/"
  42. ],
  43. "engines": {
  44. - "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
  45. + "node": ">=18.0.0"
  46. },
  47. "templateOSS": {
  48. "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
  49. diff --git a/test/test.js b/test/test.js
  50. index 6192f3d..a4db824 100644
  51. --- a/test/test.js
  52. +++ b/test/test.js
  53. @@ -1,17 +1,16 @@
  54. -const abbrev = require('../')
  55. -const t = require('tap')
  56. +const abbrev = require('abbrev')
  57. +const t = require('node:test')
  58. +const assert = require('assert');
  59. const util = require('util')
  60. function test (list, expect) {
  61. - let actual = abbrev(list)
  62. - t.same(actual, expect,
  63. - 'abbrev(' + util.inspect(list) + ') === ' + util.inspect(expect) + '\n' +
  64. - 'actual: ' + util.inspect(actual))
  65. + t.test(() => {
  66. + let actual = abbrev(list);
  67. + assert.deepStrictEqual(actual, expect);
  68. - actual = abbrev(...list)
  69. - t.same(abbrev(...list), expect,
  70. - 'abbrev(' + list.map(JSON.stringify).join(',') + ') === ' + util.inspect(expect) + '\n' +
  71. - 'actual: ' + util.inspect(actual))
  72. + actual = abbrev(...list);
  73. + assert.deepStrictEqual(actual, expect);
  74. + });
  75. }
  76. test(['ruby', 'ruby', 'rules', 'rules', 'rules'],
  77. @@ -50,5 +49,5 @@ test(['a', 'ab', 'abc', 'abcd', 'abcde', 'acde'].reverse(),
  78. acde: 'acde',
  79. })
  80. -t.notOk([].abbrev)
  81. -t.notOk({}.abbrev)
  82. +t.test(() => assert(![].abbrev))
  83. +t.test(() => assert(!{}.abbrev))
  84. --
  85. 2.41.0