Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Revert "Bug 1172363 - gaia/package.json shouldn't depend on jsmarione…
Browse files Browse the repository at this point in the history
…tte dependencies r=gaye"

This reverts commit dbee856.
  • Loading branch information
KevinGrandon committed Jun 12, 2015
1 parent a447f46 commit bdc3410
Show file tree
Hide file tree
Showing 21 changed files with 177 additions and 170 deletions.
33 changes: 27 additions & 6 deletions Makefile
Expand Up @@ -180,7 +180,7 @@ REPORTER?=mocha-tbpl-reporter
endif
REPORTER?=spec
MARIONETTE_RUNNER_HOST?=marionette-b2gdesktop-host
TEST_MANIFEST?=$(shell pwd)/shared/test/integration/local-manifest.json
TEST_MANIFEST?=./shared/test/integration/local-manifest.json

ifeq ($(MAKECMDGOALS), demo)
GAIA_DOMAIN=thisdomaindoesnotexist.org
Expand Down Expand Up @@ -746,9 +746,27 @@ npm-cache:
npm install
touch -c node_modules

node_modules:
# TODO: Get rid of references to gaia-node-modules stuff.
npm install
node_modules: gaia_node_modules.revision
# Running make without using a dependency ensures that we can run
# "make node_modules" with a custom NODE_MODULES_GIT_URL variable, and then
# run another target without specifying the variable
$(MAKE) $(NODE_MODULES_SRC)
ifeq "$(NODE_MODULES_SRC)" "modules.tar"
$(TAR_WILDCARDS) --strip-components 1 -x -m -f $(NODE_MODULES_SRC) "mozilla-b2g-gaia-node-modules-*/node_modules"
else ifeq "$(NODE_MODULES_SRC)" "git-gaia-node-modules"
rm -fr node_modules
cp -R $(NODE_MODULES_SRC)/node_modules node_modules
endif
ifneq "$(NODE_MODULES_SRC)" "npm-cache"
node --version
npm --version
VIRTUALENV_EXISTS=$(VIRTUALENV_EXISTS) npm install && npm rebuild
@echo "node_modules installed."
touch -c $@
endif
ifeq ($(BUILDAPP),device)
export LANG=en_US.UTF-8;
endif

###############################################################################
# Tests #
Expand Down Expand Up @@ -786,8 +804,11 @@ test-integration: clean $(PROFILE_FOLDER) test-integration-test
#
# Remember to remove this target after bug-969215 is finished !
.PHONY: test-integration-test
test-integration-test: b2g node_modules
TEST_MANIFEST=$(TEST_MANIFEST) ./node_modules/.bin/gaia-marionette --buildapp $(BUILDAPP) --reporter $(REPORTER)
test-integration-test: b2g
TEST_MANIFEST=$(TEST_MANIFEST) \
./bin/gaia-marionette \
--reporter $(REPORTER) \
--buildapp $(BUILDAPP)

.PHONY: jsmarionette-unit-tests
jsmarionette-unit-tests: b2g node_modules $(PROFILE_FOLDER) tests/jsmarionette/runner/marionette-js-runner/venv
Expand Down
3 changes: 1 addition & 2 deletions apps/sms/test/marionette/generators/thread.js
Expand Up @@ -2,8 +2,7 @@

/* global module */

// TODO(gaye): This is no bueno and we need to fix.
var _ = require('SMS/node_modules/lodash');
var _ = require('lodash');

var ThreadGenerator = {
uniqueThreadId: 0,
Expand Down
46 changes: 29 additions & 17 deletions bin/gaia-marionette/gaia-marionette → bin/gaia-marionette
Expand Up @@ -5,12 +5,10 @@
# for more options.
export MOZ_DISABLE_NONLOCAL_CONNECTIONS=1

# Find the source of this file. This will exist in
# $GAIA/node_modules/.bin/gaia-marionette.
# Find the source of this file
SOURCE="${BASH_SOURCE[0]}"
# Make it an absolute path
DIR="$(cd "$(dirname $SOURCE)" && pwd)"
BINDIR="$(cd "$DIR/../../bin" && pwd)"
DIR="$( cd "$( dirname "$SOURCE" )" && pwd )"
BUILDAPP=${BUILDAPP:-desktop}

safe_which() {
Expand All @@ -23,7 +21,7 @@ safe_which() {
# Go to the isolated Python environment if we already setup the virtualenv.
VIRTUALENV=$(safe_which virtualenv)

CI_VENV=$(find $BINDIR/.. -path "*/ci_venv")
CI_VENV=$(find $DIR/.. -path "*/ci_venv")
if [ -x "$VIRTUALENV" -a -x "$CI_VENV" ]; then
source ./ci_venv/bin/activate
fi
Expand All @@ -45,13 +43,26 @@ if [ -n "$SKIP_TEST_FILES" ]; then
SKIP_TEST_FILES="$SKIP_TEST_FILES_SCRIPT"
fi

HARNESS_PATHS="$(cat "$BINDIR/../tests/jsmarionette/marionette_tests.txt")"
# make sure node_modules are 100% up to date
make node_modules

if [ "$BUILDAPP" == "desktop" ]; then
# download b2g-desktop (if its not present)
make -C $DIR/../ b2g
fi

# tests can timeout without the profile-test folder so build it here.
if [ ! -d $DIR/../profile-test ]; then
PROFILE_FOLDER=profile-test make -C $DIR/../
fi

HARNESS_PATHS=$(cat ./tests/jsmarionette/marionette_tests.txt)

if [ -z "$TEST_FILES" ]; then
if [ -z "$APP" ]; then
if [ -z "$SKIP_TEST_FILES" ]; then
if [ -z "$HARNESS_ONLY" ]; then
TEST_FILES=$(find "$BINDIR/.." -path "*/apps/*/test/marionette/*_test.js" \
TEST_FILES=$(find $DIR/.. -path "*/apps/*/test/marionette/*_test.js" \
-or -path "*/dev_apps/*/test/marionette/*_test.js" \
-or -path "*/tv_apps/*/test/marionette/*_test.js" \
-or -path "*/tests/integration/*/*_test.js")
Expand All @@ -60,12 +71,12 @@ if [ -z "$TEST_FILES" ]; then
fi

for wildcard in $HARNESS_PATHS; do
HARNESS_FILES=$(find "$BINDIR/../tests/jsmarionette" -path $wildcard)
HARNESS_FILES=$(find tests/jsmarionette -path $wildcard)
TEST_FILES="$TEST_FILES $HARNESS_FILES"
done
else
if [ -z "$HARNESS_ONLY" ]; then
TEST_FILES=$(find "$BINDIR/.." -path "*/apps/*/test/marionette/*_test.js" $SKIP_TEST_FILES \
TEST_FILES=$(find $DIR/.. -path "*/apps/*/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/dev_apps/*/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/tv_apps/*/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/tests/integration/*/*_test.js" $SKIP_TEST_FILES)
Expand All @@ -74,18 +85,18 @@ if [ -z "$TEST_FILES" ]; then
fi

for wildcard in $HARNESS_PATHS; do
HARNESS_FILES=$(find "$BINDIR/../tests/jsmarionette" -path $wildcard $SKIP_TEST_FILES)
HARNESS_FILES=$(find tests/jsmarionette -path $wildcard $SKIP_TEST_FILES)
TEST_FILES="$TEST_FILES $HARNESS_FILES"
done
fi
else
if [ -z "$SKIP_TEST_FILES" ]; then
TEST_FILES=$(find "$BINDIR/.." -path "*/apps/$APP/test/marionette/*_test.js" \
TEST_FILES=$(find $DIR/.. -path "*/apps/$APP/test/marionette/*_test.js" \
-or -path "*/dev_apps/$APP/test/marionette/*_test.js" \
-or -path "*/tv_apps/$APP/test/marionette/*_test.js" \
-or -path "*/tests/integration/$APP/*_test.js")
else
TEST_FILES=$(find "$BINDIR/.." -path "*/apps/$APP/test/marionette/*_test.js" $SKIP_TEST_FILES \
TEST_FILES=$(find $DIR/.. -path "*/apps/$APP/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/dev_apps/$APP/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/tv_apps/$APP/test/marionette/*_test.js" $SKIP_TEST_FILES \
-or -path "*/tests/integration/$APP/*_test.js" $SKIP_TEST_FILES)
Expand All @@ -111,7 +122,7 @@ fi

if [ -z "$XULRUNNER_DIRECTORY" ] ; then
# the xulrunner directory isn't in the environment
XULRUNNER_DIRECTORY=$(ls -d "$BINDIR"/../b2g_sdk/* | sort -nr | head -n1 2> /dev/null)
XULRUNNER_DIRECTORY=$(ls -d "$DIR"/../b2g_sdk/* | sort -nr | head -n1 2> /dev/null)
fi

if [ -z "$XPCSHELLSDK" ] ; then
Expand All @@ -121,6 +132,7 @@ fi
# find xpcshell and put it in the path
XPCSHELL_DIR=$(dirname "$XPCSHELLSDK")


VERBOSE_OPTS=""
if [ "$VERBOSE" ]; then
VERBOSE_OPTS="--verbose"
Expand Down Expand Up @@ -172,15 +184,15 @@ fi

TARGET=""
if [[ $@ == *"mocha-tbpl-reporter"* ]]; then
TARGET="$DIR/../gaia-marionette/gaia_marionette_retry.js"
TARGET=$DIR/gaia_marionette_retry.js
else
TARGET="$DIR/marionette-mocha"
TARGET=$DIR/../node_modules/.bin/marionette-mocha
fi

export PATH=$XPCSHELL_DIR:$PATH

if [ ! -z $TEST_MANIFEST ]; then
TEST_FILES="$("$DIR/apply-manifest" $TEST_MANIFEST $TEST_FILES)"
TEST_FILES=$(./node_modules/.bin/apply-manifest $TEST_MANIFEST $TEST_FILES)
fi

# We export TEST_FILES here to enable gaia_marionette_retry to self
Expand All @@ -190,12 +202,12 @@ export TEST_FILES
# wrap marionette-mocha with gaia's defaults. We also need to alter the paths to
# xpcshell in available for email fake servers.
$TARGET \
--timeout 60s \
$VERBOSE_OPTS \
$OOP_OPTS \
$RUNTIME_OPTS \
$DEVICE_OPTS \
$BUILDAPP_OPTS \
$TEST_FILES \
$DEVICE_TYPE_OPT \
--profile-builder "$DIR/../gaia-marionette/node_modules/profile-builder" \
$@
12 changes: 0 additions & 12 deletions bin/gaia-marionette/package.json

This file was deleted.

Expand Up @@ -171,7 +171,7 @@ function runTests(filenames, args, retry) {
*/
function runTest(filename, args, retry) {
return new Promise(function(resolve, reject) {
var command = path.resolve(__dirname, '../.bin/marionette-mocha');
var command = path.resolve(__dirname, '../node_modules/.bin/marionette-mocha');
args = args.concat(filename);

var jsmarionette = spawn(command, args);
Expand Down
16 changes: 9 additions & 7 deletions package.json
Expand Up @@ -4,13 +4,10 @@
"version": "0.0.3",
"description": "A bundle of components which Gaia needs.",
"author": "The Gaia Team <dev-gaia@lists.mozilla.org>",

"engineStrict": "true",
"engines": {
"node": ">=0.10",
"npm": ">=2"
},

"engineStrict": "true",
"devDependencies": {
"adm-zip": "0.4.3",
"app-root-path": "^1.0.0",
Expand All @@ -28,13 +25,13 @@
"eslint": "0.21.2",
"eslint-plugin-no-unsafe-innerhtml": "0.1.5",
"fe.js": "~0.1.4",
"gaia-marionette": "file:./bin/gaia-marionette",
"gulp": "^3.9.0",
"gulp-gh-pages": "^0.5.2",
"gulp-shell": "^0.4.1",
"istanbul": "^0.3.2",
"jsdoc": "^3.3.0",
"jshint": "2.7.0",
"json-wire-protocol": "file:./tests/jsmarionette/client/json-wire-protocol",
"load-grunt-tasks": "0.4.0",
"mail-fakeservers": "0.0.24",
"marionette-apps": "file:./tests/jsmarionette/plugins/marionette-apps",
Expand All @@ -45,16 +42,19 @@
"marionette-helper": "file:./tests/jsmarionette/plugins/marionette-helper",
"marionette-js-runner": "file:./tests/jsmarionette/runner/marionette-js-runner",
"marionette-plugin-forms": "file:./tests/jsmarionette/plugins/marionette-plugin-forms",
"marionette-profile-builder": "file:./tests/jsmarionette/runner/marionette-profile-builder",
"marionette-settings-api": "file:./tests/jsmarionette/plugins/marionette-settings-api",
"mime": "^1.2.11",
"mocha": "1.20.0",
"mocha-json-proxy": "file:./tests/jsmarionette/mocha/mocha-json-proxy",
"mocha-parallel": "0.1.0",
"mocha-tbpl-reporter": "file:./tests/jsmarionette/mocha/mocha-tbpl-reporter",
"moment": "~2.4.0",
"mozdevice": "file:./tools/mozdevice",
"mozilla-download": "1.0.4",
"mozilla-profile-builder": "file:./tests/jsmarionette/runner/mozilla-profile-builder",
"mozilla-runner": "file:./tests/jsmarionette/runner/mozilla-runner",
"node-static": "0.6.9",
"npmr": "0.0.3",
"proxyquire": "~0.4",
"q": "~0.9.7",
"raptor": "file:./tools/raptor",
Expand All @@ -63,7 +63,9 @@
"rimraf": "2.2.5",
"sinon": "1.7.3",
"slugid": "^1.0.2",
"SMS": "file:./apps/sms",
"sms": "file:./apps/sms",
"socket-retry-connect": "file:./tests/jsmarionette/client/socket-retry-connect",
"sockit-to-me": "file:./tests/jsmarionette/client/sockit-to-me",
"superagent-promise": ">=0.2.0",
"taskcluster-client": "0.21.4",
"taskcluster-npm-cache": "1.1.14",
Expand Down
11 changes: 0 additions & 11 deletions shared/test/integration/profile-builder/package.json

This file was deleted.

Expand Up @@ -19,9 +19,8 @@ var exec = require('child_process').exec;
var fs = require('fs');
var fsPath = require('path');

// TODO(gaye): This is terrible :(
// we need to know where to invoke the Makefile
var GAIA_ROOT = fsPath.resolve(__dirname, '..', '..', '..', '..');
var GAIA_ROOT = fsPath.resolve(__dirname, '..', '..', '..');

// custom profile folder for tests... We use this as a baseProfile option in
// marionette-profile-builder so while we use these files we never directly
Expand Down
3 changes: 2 additions & 1 deletion shared/test/integration/setup.js
@@ -1,7 +1,8 @@
marionette.plugin('loader', require(__dirname + '/marionette_loader'));

marionette.plugin('apps', require('marionette-apps'));
marionette.plugin('contentScript', require('marionette-content-script'));
marionette.plugin('fileManager', require('marionette-file-manager'));
marionette.plugin('forms', require('marionette-plugin-forms'));
marionette.plugin('helper', require('marionette-helper'));
marionette.plugin('loader', require(__dirname + '/marionette_loader'));
marionette.plugin('settings', require('marionette-settings-api'));
11 changes: 7 additions & 4 deletions tests/jsmarionette/client/marionette-client/package.json
Expand Up @@ -6,15 +6,18 @@
"main": "lib/marionette/index",

"dependencies": {
"debug": "~0.6",
"json-wire-protocol": "file:../json-wire-protocol",
"socket-retry-connect": "file:../socket-retry-connect",
"sockit-to-me": "file:../sockit-to-me"
"debug": "~0.6"
},

"devDependencies": {
"yuidocjs": "~0.3",
"node-static": "~0.6",
"chai": "~1.7.2"
},

"peerDependencies": {
"json-wire-protocol": "*",
"socket-retry-connect": "*",
"sockit-to-me": "*"
}
}
4 changes: 2 additions & 2 deletions tests/jsmarionette/mocha/mocha-json-proxy/test/helper.js
Expand Up @@ -7,7 +7,7 @@ var exec = require('child_process').exec,

function forkFixture(test) {
var reporterPath = __dirname + '/../reporter.js';
var exec = __dirname + '/../../../../.bin/_mocha';
var exec = __dirname + '/../../.bin/_mocha';
var cmd = [
'--reporter', reporterPath,
'--ui', 'tdd',
Expand All @@ -31,7 +31,7 @@ function forkFixture(test) {

function runFixture(test, callback) {
var cmd =
__dirname + '/../../../../.bin/mocha' +
__dirname + '/../../.bin/mocha' +
' --ui tdd --reporter ' + __dirname + '/../reporter ' +
__dirname + '/fixtures/' + test;

Expand Down
5 changes: 3 additions & 2 deletions tests/jsmarionette/plugins/marionette-helper/package.json
Expand Up @@ -7,7 +7,8 @@
"email": "dev-gaia@lists.mozilla.org"
},

"dependencies": {
"marionette-apps": "file:../marionette-apps"
"peerDependencies": {
"marionette-apps": "*",
"marionette-client": ">=1.0.0"
}
}

0 comments on commit bdc3410

Please sign in to comment.