mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
tools/run-all-tests.sh and some related clarifications
This commit is contained in:
committed by
David Glasser
parent
3be4c74ac9
commit
d730b9f658
@@ -99,6 +99,7 @@ Fiber(function () {
|
||||
.boolean('production')
|
||||
.describe('production', 'Run in production mode. Minify and bundle CSS and JS files.')
|
||||
.describe('settings', 'Set optional data for Meteor.settings on the server')
|
||||
// #Once
|
||||
// With --once, meteor does not re-run the project if it crashes and
|
||||
// does not monitor for file changes. Intentionally undocumented:
|
||||
// intended for automated testing (eg, cli-test.sh), not end-user
|
||||
@@ -142,6 +143,7 @@ Fiber(function () {
|
||||
.describe('port', 'Port to listen on. NOTE: Also uses port N+1 and N+2.')
|
||||
.describe('release', 'Meteor release version to test.')
|
||||
.describe('deploy', 'Optionally, specify a domain to deploy to instead of running locally.')
|
||||
.boolean('once') // See #Once
|
||||
.usage(
|
||||
"Usage: meteor test-packages [options] [comma delimited packages]\n" +
|
||||
"\n" +
|
||||
@@ -182,7 +184,7 @@ Fiber(function () {
|
||||
};
|
||||
deploy.deployToServer(app_dir, bundleOptions, deployOptions);
|
||||
} else {
|
||||
runner.run(app_dir, bundleOptions, new_argv.port);
|
||||
runner.run(app_dir, bundleOptions, new_argv.port, new_argv.once);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -328,7 +328,7 @@ var packages = module.exports = {
|
||||
_.each(self._localPackageDirs(), function (dir) {
|
||||
_.each(fs.readdirSync(dir), function (name) {
|
||||
if (files.is_package_dir(path.join(dir, name))) {
|
||||
if (!list[name])
|
||||
if (!list[name]) // earlier directories get precedent
|
||||
list[name] = packages.get(null, name); // empty manifest, we're loading from local packages
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
set -e
|
||||
trap 'echo FAILED' EXIT
|
||||
|
||||
METEOR_DIR=$(pwd)/..
|
||||
|
||||
# run tests
|
||||
../../tools/node.sh test_bundler.js
|
||||
./node.sh $METEOR_DIR/lib/tests/test_bundler.js
|
||||
|
||||
# cleanup trap, and print "SUCCESS"
|
||||
trap - EXIT
|
||||
@@ -0,0 +1,7 @@
|
||||
Package.describe({
|
||||
summary: "Kill a server spawned with --once on test completion, after printing results"
|
||||
});
|
||||
|
||||
Package.on_test(function (api) {
|
||||
api.add_files('tests_complete_hook.js', ['client', 'server']);
|
||||
});
|
||||
@@ -0,0 +1,57 @@
|
||||
if (Meteor.isServer) {
|
||||
|
||||
Meteor.methods({
|
||||
packageTestsComplete: function(results) {
|
||||
console.log("Package test results");
|
||||
console.log("---");
|
||||
console.log();
|
||||
console.log(results);
|
||||
if (results.indexOf('FAIL') === -1)
|
||||
process.exit(0);
|
||||
else
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
} else { // isClient
|
||||
|
||||
// Copied from test-in-browser/driver.js
|
||||
expandFailures = function() {
|
||||
// walk whole tree to look for failed tests
|
||||
var walk = function (groups) {
|
||||
var ret = true;
|
||||
|
||||
_.each(groups || [], function (group) {
|
||||
if (!ret)
|
||||
return;
|
||||
|
||||
_.each(group.tests || [], function (t) {
|
||||
if (!ret)
|
||||
return;
|
||||
if (_testStatus(t) === "failed")
|
||||
t.expanded = true;
|
||||
});
|
||||
|
||||
if (!walk(group.groups))
|
||||
ret = false;
|
||||
});
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
walk(resultTree);
|
||||
_resultsChanged();
|
||||
};
|
||||
|
||||
Meteor.onTestsComplete = function() {
|
||||
// XXX I couldn't get this to work without setTimeout
|
||||
// (it saw "running..." in the DOM); even with a call to
|
||||
// Meteor.flush()
|
||||
setTimeout(function() {
|
||||
expandFailures();
|
||||
setTimeout(function() {
|
||||
var results = document.body.innerText;
|
||||
Meteor.call('packageTestsComplete', results);
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
};
|
||||
}
|
||||
22
tools/run-all-tests.sh
Executable file
22
tools/run-all-tests.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
METEOR_DIR=`pwd`/..
|
||||
|
||||
trap 'echo FAILED' EXIT
|
||||
|
||||
# Die on failure, print commands being executed
|
||||
set -e -x
|
||||
|
||||
# Test the Meteor CLI
|
||||
./cli-test.sh
|
||||
|
||||
# Run bundler unit tests
|
||||
./bundler-test.sh
|
||||
|
||||
# Test all packages, adding 'kill-server-on-test-completion'
|
||||
(sleep 1; open http://localhost:3000) &
|
||||
PACKAGE_DIRS=$METEOR_DIR/tools/cli-test-packages/ $METEOR_DIR/meteor test-packages --once
|
||||
|
||||
trap - EXIT
|
||||
echo PASSED
|
||||
|
||||
Reference in New Issue
Block a user