1 |
|
2 | "use strict";
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | var _ = require("lodash");
|
10 | var mochaSettings = require("./settings");
|
11 |
|
12 | var MochaTestRun = function (options) {
|
13 | _.extend(this, options);
|
14 | };
|
15 |
|
16 |
|
17 | MochaTestRun.prototype.getCommand = function () {
|
18 | return "./node_modules/.bin/mocha";
|
19 | };
|
20 |
|
21 |
|
22 | MochaTestRun.prototype.getEnvironment = function (env) {
|
23 | return _.extend({}, env);
|
24 | };
|
25 |
|
26 | MochaTestRun.prototype.getArguments = function () {
|
27 | var grepString = this.locator.name;
|
28 |
|
29 | var escapees = "\\^$[]+*.()\"";
|
30 | escapees.split("").forEach(function (ch) {
|
31 | grepString = grepString.split(ch).join("\\" + ch);
|
32 | });
|
33 |
|
34 | var args = [
|
35 | "--mocking_port=" + this.mockingPort,
|
36 | "--worker=1",
|
37 | "-g",
|
38 | grepString
|
39 | ];
|
40 |
|
41 | if (mochaSettings.mochaOpts) {
|
42 | args.push("--opts", mochaSettings.mochaOpts);
|
43 | }
|
44 |
|
45 | args = args.concat(mochaSettings.mochaTestFolders);
|
46 |
|
47 | return args;
|
48 | };
|
49 |
|
50 | module.exports = MochaTestRun;
|