Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Bug 1143357 Starting gulp tasks for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvold committed Mar 19, 2015
1 parent 6b62724 commit 5089f26
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 22 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Expand Up @@ -14,11 +14,8 @@ before_install:

before_script:
- npm install mozilla-download -g
- npm install jpm -g
- npm install gulp -g
- cd ..
- mozilla-download --branch nightly -c prerelease --host ftp.mozilla.org firefox
- export JPM_FIREFOX_BINARY=$TRAVIS_BUILD_DIR/../firefox/firefox
- cd $TRAVIS_BUILD_DIR

script:
- npm test
30 changes: 16 additions & 14 deletions bin/jpm-test.js
Expand Up @@ -3,25 +3,27 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";

var readParam = require("./node-scripts/utils").readParam;
var path = require("path");
var Promise = require("promise");
var Mocha = require("mocha");
var mocha = new Mocha({
ui: "bdd",
reporter: "spec",
timeout: 900000
});

var type = readParam("type");
exports.run = function(type) {
return new Promise(function(resolve) {
type = type || "";
[
(/^(modules)?$/.test(type)) && require.resolve("../bin/node-scripts/test.modules"),
(/^(addons)?$/.test(type)) && require.resolve("../bin/node-scripts/test.addons"),
(/^(examples)?$/.test(type)) && require.resolve("../bin/node-scripts/test.examples"),
].sort().forEach(function(filepath) {
filepath && mocha.addFile(filepath);
})

[
(!type || type == "modules") && require.resolve("../bin/node-scripts/test.modules"),
(!type || type == "addons") && require.resolve("../bin/node-scripts/test.addons"),
(!type || type == "examples") && require.resolve("../bin/node-scripts/test.examples"),
].sort().forEach(function(filepath) {
filepath && mocha.addFile(filepath);
})

mocha.run(function (failures) {
process.exit(failures);
});
mocha.run(function(failures) {
resolve(failures);
});
});
}
23 changes: 23 additions & 0 deletions gulpfile.js
@@ -0,0 +1,23 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";

var gulp = require('gulp');

gulp.task('test', function(done) {
require("./bin/jpm-test").run().then(done);
});

gulp.task('test:addons', function(done) {
require("./bin/jpm-test").run("addons").then(done);
});

gulp.task('test:examples', function(done) {
require("./bin/jpm-test").run("examples").then(done);
});

gulp.task('test:modules', function(done) {
require("./bin/jpm-test").run("modules").then(done);
});

6 changes: 2 additions & 4 deletions package.json
Expand Up @@ -8,10 +8,7 @@
"license": "MPL 2.0",
"unpack": true,
"scripts": {
"test": "node ./bin/jpm-test.js",
"modules": "node ./bin/jpm-test.js --type modules",
"addons": "node ./bin/jpm-test.js --type addons",
"examples": "node ./bin/jpm-test.js --type examples"
"test": "gulp test"
},
"homepage": "https://github.com/mozilla/addon-sdk",
"repository": {
Expand All @@ -25,6 +22,7 @@
"async": "0.9.0",
"chai": "2.1.1",
"glob": "4.4.2",
"gulp": "3.8.11",
"jpm": "0.0.29",
"lodash": "3.3.1",
"mocha": "2.1.0",
Expand Down

0 comments on commit 5089f26

Please sign in to comment.