logo

overlay

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

abbrev-3.0.1-node_test.patch (2657B)


  1. From 8f8b90eb0c9cda32c77fa2114e63c6b64c5a22e0 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] Use builtin node:test instead of npm:tap dependency
  5. ---
  6. package.json | 13 +++----------
  7. test/test.js | 29 ++++++++++++++---------------
  8. 2 files changed, 17 insertions(+), 25 deletions(-)
  9. diff --git a/package.json b/package.json
  10. index 077d4bc..622ee50 100644
  11. --- a/package.json
  12. +++ b/package.json
  13. @@ -3,9 +3,9 @@
  14. "version": "3.0.1",
  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": "npm run eslint",
  23. "postlint": "template-oss-check",
  24. "template-oss-apply": "template-oss-apply --force",
  25. @@ -21,14 +21,7 @@
  26. "license": "ISC",
  27. "devDependencies": {
  28. "@npmcli/eslint-config": "^5.0.0",
  29. - "@npmcli/template-oss": "4.24.3",
  30. - "tap": "^16.3.0"
  31. - },
  32. - "tap": {
  33. - "nyc-arg": [
  34. - "--exclude",
  35. - "tap-snapshots/**"
  36. - ]
  37. + "@npmcli/template-oss": "4.24.3"
  38. },
  39. "files": [
  40. "bin/",
  41. diff --git a/test/test.js b/test/test.js
  42. index b82a839..ea2a289 100644
  43. --- a/test/test.js
  44. +++ b/test/test.js
  45. @@ -1,28 +1,27 @@
  46. -const abbrev = require('../')
  47. -const t = require('tap')
  48. +const abbrev = require('abbrev')
  49. +const t = require('node:test')
  50. +const assert = require('assert');
  51. const util = require('util')
  52. function test (list, expect) {
  53. - let actual = abbrev(list)
  54. - t.same(actual, expect,
  55. - 'abbrev(' + util.inspect(list) + ') === ' + util.inspect(expect) + '\n' +
  56. - 'actual: ' + util.inspect(actual))
  57. + t.test(() => {
  58. + let actual = abbrev(list)
  59. + assert.deepStrictEqual(actual, expect)
  60. - actual = abbrev(...list)
  61. - t.same(abbrev(...list), expect,
  62. - 'abbrev(' + list.map(JSON.stringify).join(',') + ') === ' + util.inspect(expect) + '\n' +
  63. - 'actual: ' + util.inspect(actual))
  64. + actual = abbrev(...list)
  65. + assert.deepStrictEqual(actual, expect)
  66. + })
  67. }
  68. t.test('single string input', t => {
  69. const result = abbrev('asdf')
  70. - t.same(result, {
  71. + let expect = {
  72. a: 'asdf',
  73. as: 'asdf',
  74. asd: 'asdf',
  75. asdf: 'asdf',
  76. - }, 'correctly abbreviates a single string')
  77. - t.end()
  78. + }
  79. + assert.deepStrictEqual(result, expect)
  80. })
  81. test(['ruby', 'ruby', 'rules', 'rules', 'rules'],
  82. @@ -61,5 +60,5 @@ test(['a', 'ab', 'abc', 'abcd', 'abcde', 'acde'].reverse(),
  83. acde: 'acde',
  84. })
  85. -t.notOk([].abbrev)
  86. -t.notOk({}.abbrev)
  87. +t.test(() => assert(![].abbrev))
  88. +t.test(() => assert(!{}.abbrev))
  89. --
  90. 2.49.0