[Pkg-javascript-commits] [node-umd] 14/18: Run cli

Bastien Roucariès rouca at moszumanska.debian.org
Mon Apr 17 07:38:18 UTC 2017


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

rouca pushed a commit to tag debian-3.0.1+ds-1
in repository node-umd.

commit 2fd0730ba583c8f45badb1f0ebc6f50ba87bde74
Author: Bastien ROUCARIÈS <roucaries.bastien at gmail.com>
Date:   Fri Apr 14 15:23:54 2017 +0200

    Run cli
---
 debian/tests/control      |  6 ++++++
 debian/tests/runexamples  | 16 ++++++++++++++++
 debian/tests/runtestsuite | 14 ++++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/debian/tests/control b/debian/tests/control
index 5345588..efba089 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -1,2 +1,8 @@
 Tests: require
 Depends: node-umd
+
+Tests: runtestsuite
+Depends: node-umd, mocha
+
+Tests: runexamples
+Depends: node-umd
\ No newline at end of file
diff --git a/debian/tests/runexamples b/debian/tests/runexamples
new file mode 100755
index 0000000..1b7aa52
--- /dev/null
+++ b/debian/tests/runexamples
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -e
+
+tmpdir=$(mktemp -d)
+trap 'rm -rf "$tmpdir"' EXIT INT TERM HUP
+
+cp -r /usr/share/doc/node-umd/examples $tmpdir
+umd -c common-js-module < $tmpdir/examples/cjs/index.js > $tmpdir/examples/cjs/bundle.js
+umd common-js-module < $tmpdir/examples/raw/index.js > $tmpdir/examples/raw/bundle.js
+umd Common-Js-Module < $tmpdir/examples/constructor/index.js > $tmpdir/examples/constructor/bundle.js
+cd $tmpdir
+xargs nodejs -e << EOF
+console.log(require('./examples/cjs/bundle'));
+console.log(require('./examples/raw/bundle'));
+console.log(require('./examples/constructor/bundle'));
+EOF
diff --git a/debian/tests/runtestsuite b/debian/tests/runtestsuite
new file mode 100755
index 0000000..a9a1a52
--- /dev/null
+++ b/debian/tests/runtestsuite
@@ -0,0 +1,14 @@
+#!/bin/sh
+set -e
+# notice the / at end in order to load this module
+PACKAGE='umd/'
+SEDCMD="s,require\s*[(]\s*'[.][.][^']*'\s*[)],require('$PACKAGE'),g"
+
+tmpdir=$(mktemp -d)
+trap 'rm -rf "$tmpdir"' EXIT INT TERM HUP
+
+cp -r test $tmpdir
+find test/ -maxdepth 1 -name '*.js' -print0 | \
+    xargs -0 -n1  \
+	  sh -c 'set -e; echo "TESTING: $3"; sed $1 < $3 > $2/$3; tape "$2/$3"' sedtape "$SEDCMD" "$tmpdir"
+mocha -R spec $tmpdir/test

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



More information about the Pkg-javascript-commits mailing list