[Pkg-javascript-devel] [RFS] node-prosemirror-commands

Nilesh Patra npatra974 at gmail.com
Sun Dec 20 18:48:04 GMT 2020


On Sun, 20 Dec 2020 at 21:32, Abraham Raji <abrahamrajione at gmail.com> wrote:

> Hey Everyone,
>
> I've made all the changes suggested by the team in the previous mails
> except enabling tests. I ran the tests with the dependencies from npm
> registry and they ran just fine. So it should be a dependency issue. Is it
> possible to upload the package without the tests for now?
>
> https://salsa.debian.org/avron/node-prosemirror-commands/
>

I tried enabling tests but it seems to need HUGE amounts of heap memory
somehow, and due to insufficient RAM at my end, it crashes :/
If you have some resources, maybe you could give it a try? (Patch below) I
wonder if there is a memory leak somewhere, since the tests seemingly do
not looks so intensive.

diff --git a/debian/control b/debian/control
index af2ee7b..8b8b322 100644
--- a/debian/control
+++ b/debian/control
@@ -12,6 +12,8 @@ Build-Depends:
  , node-rollup-plugin-buble
  , node-prosemirror-transform (>= 1.0.0)
  , node-prosemirror-state (>= 1.0.0)
+ , node-mocha
+ , node-prosemirror-test-builder
 Standards-Version: 4.5.1
 Homepage: https://github.com/prosemirror/prosemirror-commands#readme
 Vcs-Git: https://salsa.debian.org/js-team/node-prosemirror-commands.git
diff --git a/debian/patches/0002-do-not-use-ist.patch
b/debian/patches/0002-do-not-use-ist.patch
new file mode 100644
index 0000000..024c7ec
--- /dev/null
+++ b/debian/patches/0002-do-not-use-ist.patch
@@ -0,0 +1,39 @@
+--- a/test/test-commands.js
++++ b/test/test-commands.js
+@@ -1,7 +1,7 @@
+ const {Schema} = require("prosemirror-model")
+ const {EditorState, Selection, TextSelection, NodeSelection} =
require("prosemirror-state")
+ const {schema, eq, doc, blockquote, pre, h1, p, li, ol, ul, em, strong,
hr, img} = require("prosemirror-test-builder")
+-const ist = require("ist")
++const assert = require('assert')
+
+ const {joinBackward, selectNodeBackward, joinForward, selectNodeForward,
deleteSelection, joinUp, joinDown, lift,
+        wrapIn, splitBlock, splitBlockKeepMarks, liftEmptyBlock,
createParagraphNear, setBlockType,
+@@ -24,8 +24,8 @@
+ function apply(doc, command, result) {
+   let state = mkState(doc)
+   command(state, tr => state = state.apply(tr))
+-  ist(state.doc, result || doc, eq)
+-  if (result && result.tag.a != null) ist(state.selection,
 selFor(result), eq)
++  assert.equal(state.doc, result || doc)
++  if (result && result.tag.a != null) assert.equal(state.selection,
 selFor(result))
+ }
+
+ describe("joinBackward", () => {
+@@ -339,14 +339,14 @@
+   it("keeps marks when used after marked text", () => {
+     let state = mkState(doc(p(strong("foo<a>"), "bar")))
+     splitBlockKeepMarks(state, tr => state = state.apply(tr))
+-    ist(state.storedMarks.length, 1)
++    assert.equal(state.storedMarks.length, 1)
+   })
+
+   it("preserves the stored marks", () => {
+     let state = mkState(doc(p(em("foo<a>"))))
+     toggleMark(schema.marks.strong)(state, tr => state = state.apply(tr))
+     splitBlockKeepMarks(state, tr => state = state.apply(tr))
+-    ist(state.storedMarks.length, 2)
++    assert.equal(state.storedMarks.length, 2)
+   })
+ })
+
diff --git a/debian/patches/series b/debian/patches/series
index 7f0ff15..7f1e189 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
 001_rollup-plugin-buble.patch
+0002-do-not-use-ist.patch
diff --git a/debian/tests/pkg-js/test b/debian/tests/pkg-js/test
new file mode 100644
index 0000000..dd9f788
--- /dev/null
+++ b/debian/tests/pkg-js/test
@@ -0,0 +1,2 @@
+export NODE_OPTIONS=--max_old_space_size=6000
+mocha -R spec test/test-*.js
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-javascript-devel/attachments/20201221/11240067/attachment.html>


More information about the Pkg-javascript-devel mailing list