[Pkg-javascript-commits] [node-parse-base64vlq-mappings] 25/26: Add testsuite

Bastien Roucariès rouca at moszumanska.debian.org
Mon Sep 18 09:24:06 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-parse-base64vlq-mappings.

commit 51e15ba2d32d945ca4d1db8a9f5ed61b478660f1
Author: Bastien ROUCARIÈS <roucaries.bastien at gmail.com>
Date:   Mon Sep 4 23:04:39 2017 +0200

    Add testsuite
---
 debian/examples           |  1 +
 debian/rules              | 11 +++++++++++
 debian/tests/control      |  8 +++++++-
 debian/tests/require      |  2 +-
 debian/tests/runtestsuite | 16 ++++++++++++++++
 5 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/debian/examples b/debian/examples
new file mode 100644
index 0000000..e5a7b8d
--- /dev/null
+++ b/debian/examples
@@ -0,0 +1 @@
+example/*
\ No newline at end of file
diff --git a/debian/rules b/debian/rules
index be8b1a1..0c403bb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,3 +17,14 @@ else
 endif
 
 
+override_dh_installexamples:
+ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
+	dh_installexamples
+	# patch example
+	find $(CURDIR)/debian/node-parse-base64vlq-mappings/usr/share/doc/node-parse-base64vlq-mappings/examples/ -name '*.js' -exec \
+                sed -i "s,require\s*[(]\s*'[.][.][^']*'\s*[)],require('parse-base64vlq-mappings'),g" {} \;
+else
+	@echo '**********************************************************'
+	@echo 'Skip example                          '
+	@echo '**********************************************************'
+endif
diff --git a/debian/tests/control b/debian/tests/control
index 5cd4353..870e9ec 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,2 +1,8 @@
 Tests: require
-Depends: node-parse-base64vlq-mappings
+Depends: node-parse-base64vlq-mappings, nodejs (>= 6)
+
+Tests: runtestsuite
+Depends: node-parse-base64vlq-mappings, nodejs (>= 6)
+ , node-source-map (>= 0.1.9)
+ , node-tap (>= 0.4.3)
+
diff --git a/debian/tests/require b/debian/tests/require
index 12b2af0..a618abf 100644
--- a/debian/tests/require
+++ b/debian/tests/require
@@ -1,3 +1,3 @@
 #!/bin/sh
 set -e
-nodejs -e "require('parse-base64vlq-mappings');"
+node -e "require('parse-base64vlq-mappings');"
diff --git a/debian/tests/runtestsuite b/debian/tests/runtestsuite
new file mode 100755
index 0000000..4a07d9f
--- /dev/null
+++ b/debian/tests/runtestsuite
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -e
+# notice the / at end in order to load this module
+PACKAGE='parse-base64vlq-mappings'
+SEDCMD="s,require\s*[(]\s*'[.][.]/?([^']*)'\s*[)],require('$PACKAGE/\1'),g"
+
+tmpdir=$(mktemp -d)
+trap 'rm -rf "$tmpdir"' EXIT INT TERM HUP
+
+cp -r test/ $tmpdir/test
+find test/ -name '*.js' -print0 | \
+    xargs -0 -n1  \
+	  sh -c 'set -e; echo "Create: $3"; sed -E "$1" < "$3" > "$2/$3"' sedtape "$SEDCMD" "$tmpdir"
+
+cd $tmpdir
+tap -R spec test/*.js

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-parse-base64vlq-mappings.git



More information about the Pkg-javascript-commits mailing list