Permalink
Browse files

Revert "Clean up tests directory, make fixtures be generated from the…

… tests rather than existing as static files"

This reverts commit 502fd50.
  • Loading branch information...
1 parent 9f2e7ac commit 4ad2c2667c57784b9ce7c4a552837eec56b3c52d @mixu committed Jun 4, 2014
Showing with 348 additions and 241 deletions.
  1. +5 −5 Makefile
  2. +33 −0 lib/runner/concat.js
  3. +19 −0 lib/runner/static-server.js
  4. +12 −0 test/{integration → }/command-integration/Makefile
  5. 0 test/{integration → }/command-integration/es6-module.js
  6. 0 test/{integration → }/command-integration/jade-module.js
  7. 0 test/{integration → }/command-integration/robot.html
  8. +3 −0 test/command-integration/test.brfs.js
  9. +3 −0 test/command-integration/test.coffee
  10. 0 test/{integration → }/command-integration/test.es6.js
  11. 0 test/{integration → }/command-integration/test.hbs
  12. 0 test/{integration → }/command-integration/test.jade
  13. +4 −0 test/fixtures/complex-package/lib/index.js
  14. +9 −0 test/fixtures/complex-package/package.json
  15. 0 test/fixtures/empty-file/empty.js
  16. +3 −0 test/fixtures/jade-file/foo.jade
  17. +1 −0 test/fixtures/jade-file/index.js
  18. +3 −0 test/fixtures/json-file/foo.json
  19. +1 −0 test/fixtures/json-file/index.js
  20. +4 −0 test/fixtures/single-file/has_dependency.js
  21. +2 −0 test/fixtures/single-file/simple.js
  22. +94 −153 test/integration.test.js
  23. +0 −63 test/lib/fixture-gen.js
  24. +6 −16 test/{unit → }/list-tasks/annotate-stat.test.js
  25. +1 −1 test/{unit → }/list-tasks/filter-npm.test.js
  26. +2 −2 test/{unit → }/list-tasks/filter-package.test.js
  27. +1 −1 test/{unit → }/list-tasks/infer-packages.test.js
  28. +12 −0 test/list-tasks/tmp/Makefile
  29. +3 −0 test/list-tasks/tmp/index.html
  30. +1 −0 test/list-tasks/tmp/index.js
  31. +4 −0 test/list-tasks/tmp/lib/bar.js
  32. +11 −0 test/list-tasks/tmp/package.json
  33. +10 −0 test/runner/concat.test.js
  34. +10 −0 test/runner/package.test.js
  35. +9 −0 test/runner/server.test.js
  36. +1 −0 test/tmp/placeholder.txt
  37. +81 −0 test/tools/file-task.js
View
@@ -1,8 +1,8 @@
-TESTS += ./*.test.js
-TESTS += ./unit/list-tasks/*.test.js
+TESTS += test/*.test.js
+TESTS += test/list-tasks/*.test.js
test:
- @cd test && mocha \
+ @mocha \
--ui exports \
--reporter spec \
--slow 2000ms \
@@ -30,5 +30,5 @@ test-lint:
--no-cache \
--include ./lib \
--basepath ./ \
- --out /tmp/lint.js
- gjslint --nojsdoc --custom_jsdoc_tags=api --max_line_length=120 --disable=0131,300,2,1,6 /tmp/lint.js
+ --out ./test/tmp/lint.js
+ gjslint --nojsdoc --custom_jsdoc_tags=api --max_line_length=120 --disable=0131,300,2,1,6 ./test/tmp/lint.js
View
@@ -0,0 +1,33 @@
+var fs = require('fs'),
+ runner = require('minitask').runner;
+
+// this runner concatenates the files to stdout after running wrap-commonjs-web
+module.exports = function(list, options) {
+ var current = 0;
+
+ // output the header
+ console.log('/* header */');
+
+ function next() {
+ var last = runner(
+ { stdout: fs.createReadStream(list.files[current].name) },
+ [ require('../file-tasks/wrap-commonjs-web.js')]
+ );
+ last.stdout.on('end', function() {
+ if(current == list.files.length){
+ console.log('/* footer */');
+ return;
+ }
+ next();
+ });
+
+ // log a file header
+ console.log('\n/* file: '+list.files[current].name+' */');
+
+ // need to do this here so we can catch the second-to-last stream's "end" event;
+ last.stdout.pipe(process.stdout);
+ current++;
+ }
+
+ next();
+};
@@ -0,0 +1,19 @@
+var http = require('http'),
+ annotateBasepath = require('../list-tasks/annotate-basepath.js');
+
+module.exports = function(list, options) {
+ // infer the basepath (longest common string)
+ annotateBasepath(list);
+
+ http.createServer(function(req, res) {
+ if(req.url == '/') {
+ res.end('<html><ul><li>'+ list.files.map(function(file) {
+ return file.name.substr(list.basepath.length);
+ }).join('</li><li>') +'</li></ul></html>');
+ } else {
+ res.end('Unknown: ' + req.url);
+ }
+ }).listen(8000).on('listening', function() {
+ console.log('Listening on localhost:8000');
+ });
+};
@@ -1,5 +1,17 @@
all: brfs coffee hbsfy es6 jade
+brfs:
+ @printf "\n\n"
+ @printf "**** brfs ****\n"
+ @printf "\n"
+ ../../bin/gluejs --transform brfs --include ./test.brfs.js
+
+coffee:
+ @printf "\n\n"
+ @printf "**** coffee ****\n"
+ @printf "\n"
+ ../../bin/gluejs --transform coffeeify --include ./test.coffee
+
hbsfy:
@printf "\n\n"
@printf "**** hbsfy ****\n"
@@ -0,0 +1,3 @@
+var fs = require('fs');
+var html = fs.readFileSync(__dirname + '/robot.html');
+console.log(html);
@@ -0,0 +1,3 @@
+square = (x) -> x * x
+
+module.exports = square
@@ -0,0 +1,4 @@
+module.exports = {
+ text: 'lib/index.js from the root of the complex package',
+ 'l1_dep': require('l1_dep')
+};
@@ -0,0 +1,9 @@
+{
+ "main": "lib/index.js",
+ "dependencies": {
+ "l1_dep": "*"
+ },
+ "devDependencies": {
+ "l1_dev_only": "~1.2.3"
+ }
+}
No changes.
@@ -0,0 +1,3 @@
+h1
+ | Hello
+ = ' ' + name
@@ -0,0 +1 @@
+module.exports = 'index.js';
@@ -0,0 +1,3 @@
+{
+ "foo": "bar"
+}
@@ -0,0 +1 @@
+module.exports = require('./foo.json');
@@ -0,0 +1,4 @@
+module.exports = {
+ has_dependency: true,
+ dependency: require('dependency')
+};
@@ -0,0 +1,2 @@
+exports.simple = true;
+
Oops, something went wrong.

0 comments on commit 4ad2c26

Please sign in to comment.