[Pkg-javascript-commits] [node-module-deps] 354/444: undef file test
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:48:12 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-module-deps.
commit 0d85dfb50cfbc18c5b5834776376fee248212876
Author: James Halliday <mail at substack.net>
Date: Wed Apr 1 21:58:27 2015 +1300
undef file test
---
test/undef_file.js | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/test/undef_file.js b/test/undef_file.js
new file mode 100644
index 0000000..e352f7d
--- /dev/null
+++ b/test/undef_file.js
@@ -0,0 +1,48 @@
+var parser = require('../');
+var test = require('tape');
+var fs = require('fs');
+var path = require('path');
+
+var files = {
+ main: path.join(__dirname, '/files/main.js'),
+ foo: path.join(__dirname, '/files/foo.js'),
+ bar: path.join(__dirname, '/files/bar.js')
+};
+
+var sources = Object.keys(files).reduce(function (acc, file) {
+ acc[file] = fs.readFileSync(files[file], 'utf8');
+ return acc;
+}, {});
+
+test('undef file', function (t) {
+ t.plan(1);
+ var p = parser();
+ p.end({ id: files.main, entry: true });
+
+ var rows = [];
+ p.on('data', function (row) { rows.push(row) });
+ p.on('end', function () {
+ t.same(rows.sort(cmp), [
+ {
+ id: files.main,
+ source: sources.main,
+ entry: true,
+ deps: { './foo': files.foo }
+ },
+ {
+ id: files.foo,
+ file: files.foo,
+ source: sources.foo,
+ deps: { './bar': files.bar }
+ },
+ {
+ id: files.bar,
+ file: files.bar,
+ source: sources.bar,
+ deps: {}
+ }
+ ].sort(cmp));
+ });
+});
+
+function cmp (a, b) { return a.id < b.id ? -1 : 1 }
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-module-deps.git
More information about the Pkg-javascript-commits
mailing list