Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Able to run venus run command with PhantomJS #300

Merged
merged 3 commits into from
Oct 14, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions Venus.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,6 @@ Venus.prototype.shutdown = function () {
*/
Venus.prototype.init = function (args) {

// Define command line options
program
.version(require('./package').version)
.option('-p, --port [port]', i18n('port to run on'), function (value) { return parseInt(value, 10); })
.option('-l, --locale [locale]', i18n('Specify locale to use'))
.option('-v, --verbose', i18n('Run in verbose mode'))
.option('-d, --debug', i18n('Run in debug mode'))
.option('-c, --coverage', i18n('Generate Code Coverage Report'))
.option('--hostname [host]', i18n('Set hostname for test URLs, defaults to your ip address'))
.option('--no-annotations', i18n('Include test files with no Venus annotations (@venus-*)'))
.option('-e, --environment [env]', i18n('Specify environment to run tests in'))
.option('-r, --reporter [reporter]', i18n('Test reporter to use. Default is "DefaultReporter"'))
.option('-o, --output-file [path]', i18n('File to record test results'))
.option('-n, --phantom', i18n('Run with PhantomJS. This is a shortcut to --environment ghost'))
.option('--singleton', i18n('Ensures all other Venus processes are killed before starting'));

// init command
program
.command('init')
Expand Down Expand Up @@ -124,7 +108,27 @@ Venus.prototype.init = function (args) {

program.parse(args);

// No command (e.g., "init", "demo", "run") was provided in command line arguments, so run venus with defaults
if (this.noCommand) {

// Define command line options
program
.version(require('./package').version)
.option('-p, --port [port]', i18n('port to run on'), function (value) { return parseInt(value, 10); })
.option('-l, --locale [locale]', i18n('Specify locale to use'))
.option('-v, --verbose', i18n('Run in verbose mode'))
.option('-d, --debug', i18n('Run in debug mode'))
.option('-c, --coverage', i18n('Generate Code Coverage Report'))
.option('--hostname [host]', i18n('Set hostname for test URLs, defaults to your ip address'))
.option('--no-annotations', i18n('Include test files with no Venus annotations (@venus-*)'))
.option('-e, --environment [env]', i18n('Specify environment to run tests in'))
.option('-r, --reporter [reporter]', i18n('Test reporter to use. Default is "DefaultReporter"'))
.option('-o, --output-file [path]', i18n('File to record test results'))
.option('-n, --phantom', i18n('Run with PhantomJS. This is a shortcut to --environment ghost'))
.option('--singleton', i18n('Ensures all other Venus processes are killed before starting'));

program.parse(args);

this.runWithDefaults();
}
};
Expand Down
2 changes: 1 addition & 1 deletion lib/executor.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ Executor.prototype.initRoutes = function() {
app.get(this.urlNamespace + '/sandbox/:testid', this.handleSandboxPage.bind(this));

/** Serves sandbox resources **/
app.get(this.urlNamespace + '/sandbox/:testid/:resource', this.handleSandboxResource.bind(this));
app.get(this.urlNamespace + '/sandbox/:testid/:resource([^\\s]+)', this.handleSandboxResource.bind(this));

// Serves the page that will render the sandbox in an iframe
app.get(this.urlNamespace + '/:testid', this.handleNamespacePage.bind(this));
Expand Down
10 changes: 4 additions & 6 deletions lib/testcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ TestCase.prototype.prepareIncludes = function (annotations) {
return fileMappings;
};

// Prepare
// Prepare
TestCase.prototype.prepareExecuteScripts = function (annotations) {
var scripts, modules;

Expand Down Expand Up @@ -432,12 +432,10 @@ TestCase.prototype.prepareResources = function (annotations) {
return;
}

if (part === '..') {
prepend += '_.';
} else if (part === '.') {
if ((part === '..') || (part === '.')) {
prepend += '';
} else if (part) {
prepend += part + '.';
prepend += part + '/';
}
});

Expand All @@ -457,7 +455,7 @@ TestCase.prototype.prepareResources = function (annotations) {
resources.forEach(function (resource) {
var filePath = resource.path,
httpDir = resource.httpDir,
destination = pathm.resolve(httpRoot + '/' + httpDir + '/' + pathHelper(filePath).file),
destination = pathm.resolve(httpRoot + '/' + httpDir + '/' + resource.prepend + pathHelper(filePath).file),
httpUrl = '/' + destination.substr(destination.indexOf('temp/test/' + testId)),
instrumentable = resource.instrumentable;

Expand Down