diff --git a/.gitignore b/.gitignore index 5da931f..2cf6237 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules/ *.pid versions.json .meteor/versions +.meteor/dev_bundle diff --git a/.travis.yml b/.travis.yml index abee2b6..b4b7071 100755 --- a/.travis.yml +++ b/.travis.yml @@ -21,4 +21,5 @@ before_install: - export PATH="$HOME/.meteor:$PATH" - meteor --version - npm install -g coffee-script@1.8.0 +- npm install -g phantomjs-prebuilt@2.1.7 - phantomjs -v diff --git a/Cakefile b/Cakefile index 0e657da..392b7e2 100755 --- a/Cakefile +++ b/Cakefile @@ -1,10 +1,11 @@ +require('coffee-script/register'); ChildProcess = require './lib/ChildProcess' -mochaCmdLine = "mocha --colors --compilers coffee:coffee-script/register --reporter spec tests/lib/*Test.coffee" +mochaCmdLine = "mocha --colors --compilers coffee:coffee-script/register --reporter spec tests/lib/*Test*.coffee" task "compile", "Compile coffee-script library sources", -> - child = new ChildProcess() - child.exec "coffee -o lib -c lib" +# child = new ChildProcess() +# child.exec "coffee -o lib -c lib" child = new ChildProcess() child.exec "coffee -o tests/lib -c tests/lib" diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..dc57b29 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,21 @@ +# Test against this version of Node.js +environment: + nodejs_version: "0.10.25" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node.js or io.js + - ps: Install-Product node $env:nodejs_version + # install modules + - npm install + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - npm test + +# Don't actually build. +build: off \ No newline at end of file diff --git a/bin/spacejam b/bin/spacejam index f1de6e5..d257c71 100755 --- a/bin/spacejam +++ b/bin/spacejam @@ -1,5 +1,7 @@ #!/usr/bin/env node +require('coffee-script/register'); + require('../lib/log'); require('../lib/CLI').get().exec(); diff --git a/lib/ChildProcess.coffee b/lib/ChildProcess.coffee index 6f0faff..5c93abe 100755 --- a/lib/ChildProcess.coffee +++ b/lib/ChildProcess.coffee @@ -6,7 +6,7 @@ path = require 'path' class ChildProcess # Design for testability - so we can spy on them / stub them in tests - @_spawn: require("child_process").spawn + @_spawn: require('cross-spawn') @_exec: require("child_process").exec child: null diff --git a/lib/Meteor.coffee b/lib/Meteor.coffee index badf914..6dd046d 100755 --- a/lib/Meteor.coffee +++ b/lib/Meteor.coffee @@ -47,6 +47,10 @@ class Meteor extends EventEmitter expect(+options.port, "options.port is not a number.").to.be.ok expect(options.packages, "options.packages is not an array of package names").to.be.an 'array' + # Always use 'practicalmeteor:mocha' package for xunit or console-runner + if options.mocha? or options['driver-package'] is 'practicalmeteor:mocha-console-runner' + options["driver-package"] = "practicalmeteor:mocha" + args = [ command '--driver-package' @@ -56,11 +60,7 @@ class Meteor extends EventEmitter args.push(["--port", options.port]) args.push(["--settings", options.settings]) if options.settings args.push("--production") if options.production - - if options.mocha? - options["driver-package"] = "practicalmeteor:mocha-console-runner" - - + options["root-url"] ?= "http://localhost:#{options.port}/" if command is 'test' @@ -124,6 +124,14 @@ class Meteor extends EventEmitter else delete env.MONGO_URL if env.MONGO_URL? + if @options.mocha? or @options['driver-package'] is 'practicalmeteor:mocha' + if @options.xunit? or @options['xunit-out']? + env.MOCHA_REPORTER = 'xunit' + else + env.MOCHA_REPORTER = 'console' + + + options = { cwd: cwd, env: env, diff --git a/lib/MeteorMongodb.coffee b/lib/MeteorMongodb.coffee index 843bf0f..ba6931c 100755 --- a/lib/MeteorMongodb.coffee +++ b/lib/MeteorMongodb.coffee @@ -23,19 +23,61 @@ class MeteorMongodb extends EventEmitter findAllChildren: -> log.debug "MeteorMongodb.findAllChildren()", arguments - log.debug "@meteorPid", @meteorPid - ps.lookup - command: 'mongod' - psargs: '-l' - ppid: @meteorPid - , (err, resultList )=> - @mongodChilds = resultList - if (err) - log.warn "spacjam: Warning: Couldn't find any mongod children:\n", err + if process.platform is 'win32' + @getChildProcessOnWindows(@meteorPid, (childsPid, _this) -> + _this.meteorPid = childsPid[0].pid + log.debug "@meteorPid", _this.meteorPid + _this.getChildProcessOnWindows(childsPid[0].pid, (childsPid, _this) -> + _this.mongodChilds = childsPid + ) + ) + + else + log.debug "@meteorPid", @meteorPid + ps.lookup + command: 'mongod' + psargs: '-l' + ppid: @meteorPid + , (err, resultList )=> + @mongodChilds = resultList + if (err) + log.warn "spacjam: Warning: Couldn't find any mongod children:\n", err + else if resultList.length > 1 + log.warn "spacjam: Warning: Found more than one mongod child:\n", resultList + else + log.debug "Found meteor mongod child with pid: ", resultList[0]?.pid + + getChildProcessOnWindows: (processPid, onSuccess) -> + resultList = []; + bat = require('child_process').spawn('cmd.exe', [ + '/c' + "#{__dirname}\\get_children.bat #{processPid}" + ]) + + bat.stdout.setEncoding "utf8" + bat.stderr.setEncoding "utf8" + + bat.stdout.on 'data', (data) -> + + childPid = data.toString().trim() + resultList.push pid: parseInt(childPid) + + bat.stderr.on 'data', (data) -> + log.warn 'spacejam: Warning: Error enumerating process children:\n', data + + bat.on 'exit', (code) => + if code != 0 + return log.warn('spacejam: Warning: Enumerating child process returned with error code: ', code) + log.debug 'MongoDB children:\n', resultList + if resultList.length == 0 + log.warn 'spacejam: Warning: Couldn\'t find any child process :\n', err else if resultList.length > 1 - log.warn "spacjam: Warning: Found more than one mongod child:\n", resultList + log.warn 'spacejam: Warning: Found more than one child process :\n', resultList + onSuccess(resultList, _this) else - log.debug "Found meteor mongod child with pid: ", resultList[0].pid + log.debug 'Found meteor child process with pid: ', resultList[0].pid + onSuccess(resultList, _this) + kill: -> diff --git a/lib/Phantomjs.coffee b/lib/Phantomjs.coffee index edee612..6a1fcdb 100755 --- a/lib/Phantomjs.coffee +++ b/lib/Phantomjs.coffee @@ -38,10 +38,14 @@ class Phantomjs extends EventEmitter if useSystemPhantomjs process.env.PATH = DEFAULT_PATH else - process.env.PATH = path.dirname(phantomjs.path) + ':' + DEFAULT_PATH + process.env.PATH = path.dirname(phantomjs.path) + path.delimiter + DEFAULT_PATH + + # Get the cross-platform program name +# program = path.basename(phantomjs.path) + program = phantomjs.path @childProcess = new ChildProcess() - @childProcess.spawn("phantomjs", spawnArgs, spawnOptions, pipeClass, pipeClassOptions) + @childProcess.spawn(program, spawnArgs, spawnOptions, pipeClass, pipeClassOptions) @childProcess.child.on "exit", (code, signal) => @emit "exit", code, signal diff --git a/lib/get_children.bat b/lib/get_children.bat new file mode 100755 index 0000000..5a67bbc --- /dev/null +++ b/lib/get_children.bat @@ -0,0 +1,5 @@ +@echo off & setlocal enabledelayedexpansion +set PPID=%1 +for /F "skip=1 tokens=1" %%a in ('wmic process where "ParentProcessID=%PPID%" get processid') do for %%b in (%%a) do ( + echo %%a +) \ No newline at end of file diff --git a/package.json b/package.json old mode 100755 new mode 100644 index b6612c0..236a3ad --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spacejam", - "version": "1.6.1", + "version": "1.6.2-rc.4", "dependencies": { "chai": "1.9.2", "glob": "4.0.6", @@ -9,10 +9,13 @@ "psext": "0.0.4", "rc": "0.5.1", "semver": "4.1.0", - "underscore": "1.7.0" + "underscore": "1.7.0", + "sinon": "^1.17.4", + "coffee-script": "1.8.0", + "try-thread-sleep": "1.0.0", + "cross-spawn": "^4.0.0" }, "devDependencies": { - "coffee-script": "1.8.0", "mocha": "1.21.5", "sinon-chai": "2.6.0", "tmp": "0.0.25", diff --git a/tests/apps/failing-app-tests/.meteor/.gitignore b/tests/apps/failing-app-tests/.meteor/.gitignore index 4083037..501f92e 100644 --- a/tests/apps/failing-app-tests/.meteor/.gitignore +++ b/tests/apps/failing-app-tests/.meteor/.gitignore @@ -1 +1,2 @@ +dev_bundle local diff --git a/tests/apps/failing-app-tests/.meteor/packages b/tests/apps/failing-app-tests/.meteor/packages index d3c0241..50a6ace 100644 --- a/tests/apps/failing-app-tests/.meteor/packages +++ b/tests/apps/failing-app-tests/.meteor/packages @@ -19,6 +19,5 @@ ecmascript # Enable ECMAScript2015+ syntax in app code autopublish # Publish all data to the clients (for prototyping) insecure # Allow all DB writes from clients (for prototyping) -practicalmeteor:mocha@2.4.5_2 -practicalmeteor:mocha-console-runner@0.2.0 +practicalmeteor:mocha@2.4.5_6 practicalmeteor:chai diff --git a/tests/apps/failing-app-tests/.meteor/release b/tests/apps/failing-app-tests/.meteor/release index 4fd7a93..f6a1c79 100644 --- a/tests/apps/failing-app-tests/.meteor/release +++ b/tests/apps/failing-app-tests/.meteor/release @@ -1 +1 @@ -METEOR@1.3 +METEOR@1.3.4.4 \ No newline at end of file diff --git a/tests/apps/failing-app-tests/.meteor/versions b/tests/apps/failing-app-tests/.meteor/versions index 15e169b..7fd234b 100644 --- a/tests/apps/failing-app-tests/.meteor/versions +++ b/tests/apps/failing-app-tests/.meteor/versions @@ -1,77 +1,76 @@ -allow-deny@1.0.2 -autopublish@1.0.5 -autoupdate@1.2.6 -babel-compiler@6.5.2 -babel-runtime@0.1.6 -base64@1.0.6 -binary-heap@1.0.6 -blaze@2.1.5 -blaze-html-templates@1.0.2 -blaze-tools@1.0.6 -boilerplate-generator@1.0.6 -caching-compiler@1.0.2 -caching-html-compiler@1.0.4 -callback-hook@1.0.6 -check@1.1.2 -coffeescript@1.0.15 -ddp@1.2.3 -ddp-client@1.2.3 -ddp-common@1.2.3 -ddp-server@1.2.4 -deps@1.0.10 -diff-sequence@1.0.3 -ecmascript@0.4.1 -ecmascript-runtime@0.2.8 -ejson@1.0.9 -es5-shim@4.5.8 -fastclick@1.0.9 -geojson-utils@1.0.6 -hot-code-push@1.0.2 -html-tools@1.0.7 -htmljs@1.0.7 -http@1.1.3 -id-map@1.0.5 -insecure@1.0.5 -jquery@1.11.6 -launch-screen@1.0.8 -livedata@1.0.16 -logging@1.0.10 -meteor@1.1.12 -meteor-base@1.0.2 -minifier-css@1.1.9 -minifier-js@1.1.9 -minimongo@1.0.12 -mobile-experience@1.0.2 -mobile-status-bar@1.0.10 -modules@0.5.1 -modules-runtime@0.6.1 -mongo@1.1.5 -mongo-id@1.0.2 -npm-mongo@1.4.41 -observe-sequence@1.0.9 -ordered-dict@1.0.5 +allow-deny@1.0.5 +autopublish@1.0.7 +autoupdate@1.2.11 +babel-compiler@6.8.4 +babel-runtime@0.1.9_1 +base64@1.0.9 +binary-heap@1.0.9 +blaze@2.1.8 +blaze-html-templates@1.0.4 +blaze-tools@1.0.9 +boilerplate-generator@1.0.9 +caching-compiler@1.0.6 +caching-html-compiler@1.0.6 +callback-hook@1.0.9 +check@1.2.3 +coffeescript@1.1.3 +ddp@1.2.5 +ddp-client@1.2.9 +ddp-common@1.2.6 +ddp-server@1.2.9 +deps@1.0.12 +diff-sequence@1.0.6 +ecmascript@0.4.7 +ecmascript-runtime@0.2.12 +ejson@1.0.12 +es5-shim@4.5.13 +fastclick@1.0.12 +geojson-utils@1.0.9 +hot-code-push@1.0.4 +html-tools@1.0.10 +htmljs@1.0.10 +http@1.1.8 +id-map@1.0.8 +insecure@1.0.7 +jquery@1.11.9 +launch-screen@1.0.12 +livedata@1.0.18 +logging@1.0.14 +meteor@1.1.16 +meteor-base@1.0.4 +minifier-css@1.1.13 +minifier-js@1.1.13 +minimongo@1.0.17 +mobile-experience@1.0.4 +mobile-status-bar@1.0.12 +modules@0.6.5 +modules-runtime@0.6.5 +mongo@1.1.9_1 +mongo-id@1.0.5 +npm-mongo@1.4.45 +observe-sequence@1.0.12 +ordered-dict@1.0.8 practicalmeteor:chai@2.1.0_1 practicalmeteor:loglevel@1.2.0_2 -practicalmeteor:mocha@2.4.6-rc.1 -practicalmeteor:mocha-console-runner@0.2.1-rc.2 -practicalmeteor:mocha-core@0.1.4 +practicalmeteor:mocha@2.4.5_3 +practicalmeteor:mocha-core@1.0.1 practicalmeteor:sinon@1.14.1_2 -promise@0.6.5 -random@1.0.7 -reactive-var@1.0.7 -reload@1.1.6 -retry@1.0.5 -routepolicy@1.0.8 -spacebars@1.0.9 -spacebars-compiler@1.0.9 -standard-minifier-css@1.0.4 -standard-minifier-js@1.0.4 -templating@1.1.7 -templating-tools@1.0.2 +promise@0.7.3 +random@1.0.10 +reactive-var@1.0.10 +reload@1.1.10 +retry@1.0.8 +routepolicy@1.0.11 +spacebars@1.0.12 +spacebars-compiler@1.0.12 +standard-minifier-css@1.0.8 +standard-minifier-js@1.0.8 +templating@1.1.13 +templating-tools@1.0.4 tmeasday:test-reporter-helpers@0.2.1 -tracker@1.0.11 -ui@1.0.9 -underscore@1.0.6 -url@1.0.7 -webapp@1.2.6 -webapp-hashing@1.0.7 +tracker@1.0.14 +ui@1.0.11 +underscore@1.0.9 +url@1.0.10 +webapp@1.2.10 +webapp-hashing@1.0.9 diff --git a/tests/apps/leaderboard/.meteor/.finished-upgraders b/tests/apps/leaderboard/.meteor/.finished-upgraders index 68df3d8..dacc2c0 100644 --- a/tests/apps/leaderboard/.meteor/.finished-upgraders +++ b/tests/apps/leaderboard/.meteor/.finished-upgraders @@ -5,3 +5,9 @@ notices-for-0.9.0 notices-for-0.9.1 0.9.4-platform-file +notices-for-facebook-graph-api-2 +1.2.0-standard-minifiers-package +1.2.0-meteor-platform-split +1.2.0-cordova-changes +1.2.0-breaking-changes +1.3.0-split-minifiers-package diff --git a/tests/apps/leaderboard/.meteor/.gitignore b/tests/apps/leaderboard/.meteor/.gitignore index 41144ec..f2a2095 100644 --- a/tests/apps/leaderboard/.meteor/.gitignore +++ b/tests/apps/leaderboard/.meteor/.gitignore @@ -1,2 +1,3 @@ +dev_bundle local versions diff --git a/tests/apps/leaderboard/.meteor/packages b/tests/apps/leaderboard/.meteor/packages old mode 100755 new mode 100644 index 1cba902..9aeb92c --- a/tests/apps/leaderboard/.meteor/packages +++ b/tests/apps/leaderboard/.meteor/packages @@ -11,3 +11,5 @@ success settings failure timeout +standard-minifier-css +standard-minifier-js diff --git a/tests/apps/leaderboard/.meteor/release b/tests/apps/leaderboard/.meteor/release index b3841a0..e5b4dc1 100644 --- a/tests/apps/leaderboard/.meteor/release +++ b/tests/apps/leaderboard/.meteor/release @@ -1 +1 @@ -METEOR@1.0.2 +METEOR@1.3.4.4 diff --git a/tests/apps/passing-app-tests/.meteor/.gitignore b/tests/apps/passing-app-tests/.meteor/.gitignore index 4083037..501f92e 100644 --- a/tests/apps/passing-app-tests/.meteor/.gitignore +++ b/tests/apps/passing-app-tests/.meteor/.gitignore @@ -1 +1,2 @@ +dev_bundle local diff --git a/tests/apps/passing-app-tests/.meteor/packages b/tests/apps/passing-app-tests/.meteor/packages index d3c0241..50a6ace 100644 --- a/tests/apps/passing-app-tests/.meteor/packages +++ b/tests/apps/passing-app-tests/.meteor/packages @@ -19,6 +19,5 @@ ecmascript # Enable ECMAScript2015+ syntax in app code autopublish # Publish all data to the clients (for prototyping) insecure # Allow all DB writes from clients (for prototyping) -practicalmeteor:mocha@2.4.5_2 -practicalmeteor:mocha-console-runner@0.2.0 +practicalmeteor:mocha@2.4.5_6 practicalmeteor:chai diff --git a/tests/apps/passing-app-tests/.meteor/release b/tests/apps/passing-app-tests/.meteor/release index 4fd7a93..f6a1c79 100644 --- a/tests/apps/passing-app-tests/.meteor/release +++ b/tests/apps/passing-app-tests/.meteor/release @@ -1 +1 @@ -METEOR@1.3 +METEOR@1.3.4.4 \ No newline at end of file diff --git a/tests/apps/passing-app-tests/.meteor/versions b/tests/apps/passing-app-tests/.meteor/versions index 15e169b..4df14b7 100644 --- a/tests/apps/passing-app-tests/.meteor/versions +++ b/tests/apps/passing-app-tests/.meteor/versions @@ -1,77 +1,76 @@ -allow-deny@1.0.2 -autopublish@1.0.5 -autoupdate@1.2.6 -babel-compiler@6.5.2 -babel-runtime@0.1.6 -base64@1.0.6 -binary-heap@1.0.6 -blaze@2.1.5 -blaze-html-templates@1.0.2 -blaze-tools@1.0.6 -boilerplate-generator@1.0.6 -caching-compiler@1.0.2 -caching-html-compiler@1.0.4 -callback-hook@1.0.6 -check@1.1.2 -coffeescript@1.0.15 -ddp@1.2.3 -ddp-client@1.2.3 -ddp-common@1.2.3 -ddp-server@1.2.4 -deps@1.0.10 -diff-sequence@1.0.3 -ecmascript@0.4.1 -ecmascript-runtime@0.2.8 -ejson@1.0.9 -es5-shim@4.5.8 -fastclick@1.0.9 -geojson-utils@1.0.6 -hot-code-push@1.0.2 -html-tools@1.0.7 -htmljs@1.0.7 -http@1.1.3 -id-map@1.0.5 -insecure@1.0.5 -jquery@1.11.6 -launch-screen@1.0.8 -livedata@1.0.16 -logging@1.0.10 -meteor@1.1.12 -meteor-base@1.0.2 -minifier-css@1.1.9 -minifier-js@1.1.9 -minimongo@1.0.12 -mobile-experience@1.0.2 -mobile-status-bar@1.0.10 -modules@0.5.1 -modules-runtime@0.6.1 -mongo@1.1.5 -mongo-id@1.0.2 -npm-mongo@1.4.41 -observe-sequence@1.0.9 -ordered-dict@1.0.5 +allow-deny@1.0.5 +autopublish@1.0.7 +autoupdate@1.2.11 +babel-compiler@6.8.4 +babel-runtime@0.1.9_1 +base64@1.0.9 +binary-heap@1.0.9 +blaze@2.1.8 +blaze-html-templates@1.0.4 +blaze-tools@1.0.9 +boilerplate-generator@1.0.9 +caching-compiler@1.0.6 +caching-html-compiler@1.0.6 +callback-hook@1.0.9 +check@1.2.3 +coffeescript@1.1.3 +ddp@1.2.5 +ddp-client@1.2.9 +ddp-common@1.2.6 +ddp-server@1.2.9 +deps@1.0.12 +diff-sequence@1.0.6 +ecmascript@0.4.7 +ecmascript-runtime@0.2.12 +ejson@1.0.12 +es5-shim@4.5.13 +fastclick@1.0.12 +geojson-utils@1.0.9 +hot-code-push@1.0.4 +html-tools@1.0.10 +htmljs@1.0.10 +http@1.1.8 +id-map@1.0.8 +insecure@1.0.7 +jquery@1.11.9 +launch-screen@1.0.12 +livedata@1.0.18 +logging@1.0.14 +meteor@1.1.16 +meteor-base@1.0.4 +minifier-css@1.1.13 +minifier-js@1.1.13 +minimongo@1.0.17 +mobile-experience@1.0.4 +mobile-status-bar@1.0.12 +modules@0.6.5 +modules-runtime@0.6.5 +mongo@1.1.9_1 +mongo-id@1.0.5 +npm-mongo@1.4.45 +observe-sequence@1.0.12 +ordered-dict@1.0.8 practicalmeteor:chai@2.1.0_1 practicalmeteor:loglevel@1.2.0_2 -practicalmeteor:mocha@2.4.6-rc.1 -practicalmeteor:mocha-console-runner@0.2.1-rc.2 -practicalmeteor:mocha-core@0.1.4 +practicalmeteor:mocha@2.4.5_6 +practicalmeteor:mocha-core@1.0.1 practicalmeteor:sinon@1.14.1_2 -promise@0.6.5 -random@1.0.7 -reactive-var@1.0.7 -reload@1.1.6 -retry@1.0.5 -routepolicy@1.0.8 -spacebars@1.0.9 -spacebars-compiler@1.0.9 -standard-minifier-css@1.0.4 -standard-minifier-js@1.0.4 -templating@1.1.7 -templating-tools@1.0.2 +promise@0.7.3 +random@1.0.10 +reactive-var@1.0.10 +reload@1.1.10 +retry@1.0.8 +routepolicy@1.0.11 +spacebars@1.0.12 +spacebars-compiler@1.0.12 +standard-minifier-css@1.0.8 +standard-minifier-js@1.0.8 +templating@1.1.13 +templating-tools@1.0.4 tmeasday:test-reporter-helpers@0.2.1 -tracker@1.0.11 -ui@1.0.9 -underscore@1.0.6 -url@1.0.7 -webapp@1.2.6 -webapp-hashing@1.0.7 +tracker@1.0.14 +ui@1.0.11 +underscore@1.0.9 +url@1.0.10 +webapp@1.2.10 +webapp-hashing@1.0.9 diff --git a/tests/apps/todos/.meteor/.finished-upgraders b/tests/apps/todos/.meteor/.finished-upgraders index 68df3d8..dacc2c0 100644 --- a/tests/apps/todos/.meteor/.finished-upgraders +++ b/tests/apps/todos/.meteor/.finished-upgraders @@ -5,3 +5,9 @@ notices-for-0.9.0 notices-for-0.9.1 0.9.4-platform-file +notices-for-facebook-graph-api-2 +1.2.0-standard-minifiers-package +1.2.0-meteor-platform-split +1.2.0-cordova-changes +1.2.0-breaking-changes +1.3.0-split-minifiers-package diff --git a/tests/apps/todos/.meteor/.gitignore b/tests/apps/todos/.meteor/.gitignore index 41144ec..f2a2095 100644 --- a/tests/apps/todos/.meteor/.gitignore +++ b/tests/apps/todos/.meteor/.gitignore @@ -1,2 +1,3 @@ +dev_bundle local versions diff --git a/tests/apps/todos/.meteor/packages b/tests/apps/todos/.meteor/packages old mode 100755 new mode 100644 index 893df59..6a3348b --- a/tests/apps/todos/.meteor/packages +++ b/tests/apps/todos/.meteor/packages @@ -11,3 +11,5 @@ jquery preserve-inputs insecure appfails +standard-minifier-css +standard-minifier-js diff --git a/tests/apps/todos/.meteor/release b/tests/apps/todos/.meteor/release index b3841a0..f6a1c79 100644 --- a/tests/apps/todos/.meteor/release +++ b/tests/apps/todos/.meteor/release @@ -1 +1 @@ -METEOR@1.0.2 +METEOR@1.3.4.4 \ No newline at end of file diff --git a/tests/apps/todos/client/todos.html b/tests/apps/todos/client/todos.html old mode 100644 new mode 100755 index f03e83b..019337e --- a/tests/apps/todos/client/todos.html +++ b/tests/apps/todos/client/todos.html @@ -72,7 +72,7 @@

Todo Lists

{{else}}
- +
{{text}}
{{/if}} diff --git a/tests/lib/CLITest.coffee b/tests/lib/CLITest.coffee index 51c5ae8..065d322 100755 --- a/tests/lib/CLITest.coffee +++ b/tests/lib/CLITest.coffee @@ -16,7 +16,7 @@ ChildProcess = require '../../lib/ChildProcess' describe "CLI", -> - @timeout 30000 + @timeout 60000 processArgv = null @@ -99,7 +99,7 @@ describe "CLI", -> try if code is 0 then done() else done("spacejam.done=#{code}") - firstPathEntry = process.env.PATH.split(":")[0] + firstPathEntry = process.env.PATH.split(path.delimiter)[0] expect(firstPathEntry).to.equal(path.dirname(phantomjs.path)) catch err done(err) diff --git a/tests/lib/FunctionalTests.coffee b/tests/lib/FunctionalTests.coffee index 1796a2a..6acbc83 100755 --- a/tests/lib/FunctionalTests.coffee +++ b/tests/lib/FunctionalTests.coffee @@ -2,7 +2,7 @@ path = require 'path' fs = require 'fs' DOMParser = require('xmldom').DOMParser xpath = require('xpath') - +os = require("os") expect = require("chai").expect CLI = require '../../lib/CLI' @@ -12,9 +12,10 @@ spacejamBin = require.resolve("../../bin/spacejam") log.info spacejamBin - +#should exit with 0 with successful tests describe "spacejam", -> - @timeout 120000 + + @timeout 150000 spacejamChild = null @@ -146,16 +147,18 @@ describe "spacejam", -> done() - it "should save xunit output to file, if --xunit-out is specified", (done)-> + it "should save xunit output to file, if --xunit-out is specified", (done)-> spacejamChild = new ChildProcess() # TODO: Have a global singleton to provide the port testPort = "20096" - args = ["test-packages", "--port", testPort, '--xunit-out', '/tmp/xunit.xml', "success"] + + xunitFile = path.join(os.tmpdir(), 'xunit.xml') + args = ["test-packages", "--port", testPort, '--xunit-out', xunitFile, "success"] spacejamChild.spawn(spacejamBin,args) spacejamChild.child.on "close", (code, signal) => try expect(code,"spacejam exited with errors").to.equal Spacejam.DONE.TEST_SUCCESS - xml = fs.readFileSync('/tmp/xunit.xml', encoding: 'utf8') + xml = fs.readFileSync(xunitFile, encoding: 'utf8') log.debug xml expect(xml).to.be.ok xmlDom = new DOMParser().parseFromString(xml) @@ -181,7 +184,8 @@ describe "spacejam", -> it "should print the package version", (done)-> process.chdir(__dirname + "/../packages/standalone-package") spacejamChild = new ChildProcess() - spacejamChild.exec "#{spacejamBin} package-version", null, (err, stdout, stderr)=> + # Using also node to avoid problems with windows + spacejamChild.exec "node #{spacejamBin} package-version", null, (err, stdout, stderr)=> try expect(err).to.be.null expect(stdout.toString()).to.contain '0.9.5' diff --git a/tests/lib/MeteorTest.coffee b/tests/lib/MeteorTest.coffee index 17ae1b5..b04980a 100755 --- a/tests/lib/MeteorTest.coffee +++ b/tests/lib/MeteorTest.coffee @@ -66,29 +66,6 @@ describe "Meteor", -> expectedSpawnOptions.env.MONGO_URL = mongoUrl if mongoUrl? return expectedSpawnOptions - - it "getTestArgs() - get common args for test and test-packages command", -> - options = { - "driver-package": "package" - "release": 'release' - "port": '3000' - "settings": 'settings' - "production": true - "packages": ['pkg1', 'pkg2'] - } - - args = meteor.getTestArgs('test', options) - - expect(args).to.be.deep.equal([ - "test", - "--driver-package", "package", - "--release", "release", - "--port", "3000", - "--settings", "settings" - "--production" - ]) - - describe "getTestArgs()", -> beforeEach -> @@ -103,6 +80,29 @@ describe "Meteor", -> meteor.options = @options + it "get common args for test and test-packages command", -> + options = { + "driver-package": "package" + "release": 'release' + "port": '3000' + "settings": 'settings' + "production": true + "packages": ['pkg1', 'pkg2'] + } + + args = meteor.getTestArgs('test', options) + + expect(args).to.be.deep.equal([ + "test", + "--driver-package", "package", + "--release", "release", + "--port", "3000", + "--settings", "settings" + "--production" + ]) + + + it "create args for test-packages command", -> args = meteor.getTestArgs('test-packages', @options) @@ -138,6 +138,75 @@ describe "Meteor", -> "--full-app" ]) + it "use package practicalmeteor:mocha if mocha practicalmeteor:mocha-console-runner as driver-package", -> + + expectedArgs = [ + "test", + "--driver-package", "practicalmeteor:mocha", + "--release", "release", + "--port", "3000", + "--settings", "settings", + "--production", + "--test-app-path", "/tmp/app", + "--full-app" + ] + + opts = _.extend(_.clone(@options),{ + "test-app-path": "/tmp/app" + "full-app": true, + "mocha": true + }); + + args = meteor.getTestArgs('test', opts) + + expect(args, "--mocha").to.be.deep.equal(expectedArgs) + + opts = _.extend(_.clone(@options),{ + "test-app-path": "/tmp/app" + "full-app": true, + "xunit": true, + "mocha": true + }); + + args = meteor.getTestArgs('test', opts) + + expect(args, "--xunit").to.be.deep.equal(expectedArgs) + + opts = _.extend(_.clone(@options),{ + "test-app-path": "/tmp/app" + "full-app": true, + "driver-package": "practicalmeteor:mocha-console-runner" + }); + + args = meteor.getTestArgs('test', opts) + + expect(args, "--driver-package=practicalmeteor:mocha-console-runner").to.be.deep.equal(expectedArgs) + + + describe "runTestCommand", -> + + beforeEach -> + @expectedSpawnArgs = [ + "test", + "--driver-package", "practicalmeteor:mocha" + "--port", defaultTestPort + ] + @expectedSpawnOptions = getExpectedSpawnOptions(4096) + @expectedSpawnOptions.env.MOCHA_REPORTER = 'console' + + it "should spawn meteor with env var MOCHA_REPORTER to console if mocha option or practicalmeteor:mocha as driver-package", -> + + meteor.runTestCommand("test",{"mocha": true}) + expect(spawnStub.args[0]).to.eql(["meteor", @expectedSpawnArgs, @expectedSpawnOptions]) + + meteor = new Meteor() + meteor.runTestCommand("test",{"driver-package": "practicalmeteor:mocha"}) + expect(spawnStub.args[0]).to.eql(["meteor", @expectedSpawnArgs, @expectedSpawnOptions]) + + + it "should spawn meteor with env var MOCHA_REPORTER to console with practicalmeteor:mocha-console-runner as driver-package", -> + meteor.runTestCommand("test", {"driver-package": "practicalmeteor:mocha-console-runner"}) + expect(spawnStub.args[0]).to.eql(["meteor", @expectedSpawnArgs, @expectedSpawnOptions]) it "testApp - should spawn meteor with correct arguments", -> meteor.testApp({"full-app": true}) @@ -231,7 +300,7 @@ describe "Meteor", -> it "kill() - should kill internal mongodb child processes", (done)-> - @timeout 60000 + @timeout 120000 spawnStub.restore() spawnStub = null ChildProcess.prototype.child = null diff --git a/tests/lib/ScriptsTests.coffee b/tests/lib/ScriptsTests.coffee index 7efbc9d..eb7becc 100755 --- a/tests/lib/ScriptsTests.coffee +++ b/tests/lib/ScriptsTests.coffee @@ -3,7 +3,11 @@ ChildProcess = require '../../lib/ChildProcess' path = require 'path' _ = require('underscore') -describe "scripts", -> +describe "scripts", -> + + if process.platform is 'win32' + console.log("spacejam scripts are not supported in windows") + return spacejamBinDir = path.resolve(__dirname, "../../bin") meteorStubDir = path.resolve(__dirname, "../bin") @@ -61,6 +65,7 @@ describe "scripts", -> delete childEnv.TEST_ROOT_URL delete childEnv.TEST_MONGO_URL delete childEnv.TEST_METEOR_SETTINGS_PATH + delete childEnv.METEOR_ENV execOptions = env: childEnv diff --git a/tests/lib/mainTest.coffee b/tests/lib/mainTest.coffee new file mode 100644 index 0000000..8894a0e --- /dev/null +++ b/tests/lib/mainTest.coffee @@ -0,0 +1 @@ +log.setLevel("debug") \ No newline at end of file