Permalink
Browse files

Merge pull request #3198 from adobe/dangoor/testing-domain

Enable installation tests
  • Loading branch information...
2 parents 7d357f2 + 876f618 commit 5a0fbcdeb84dfdd310e2d48270fb7264b3482683 @njx njx committed Mar 21, 2013
Showing with 3,451 additions and 10 deletions.
  1. +2 −1 Gruntfile.js
  2. +57 −0 test/SpecRunner.js
  3. +54 −0 test/node/TestingDomain.js
  4. +1 −0 test/node/node_modules/fs-extra/.npmignore
  5. +5 −0 test/node/node_modules/fs-extra/.travis.yml
  6. +67 −0 test/node/node_modules/fs-extra/CHANGELOG.md
  7. +16 −0 test/node/node_modules/fs-extra/LICENSE
  8. +281 −0 test/node/node_modules/fs-extra/README.md
  9. +42 −0 test/node/node_modules/fs-extra/lib/copy.js
  10. +53 −0 test/node/node_modules/fs-extra/lib/create.js
  11. +102 −0 test/node/node_modules/fs-extra/lib/index.js
  12. +6 −0 test/node/node_modules/fs-extra/lib/mkdir.js
  13. +35 −0 test/node/node_modules/fs-extra/lib/output.js
  14. +17 −0 test/node/node_modules/fs-extra/lib/remove.js
  15. +1 −0 test/node/node_modules/fs-extra/node_modules/.bin/ncp
  16. +1 −0 test/node/node_modules/fs-extra/node_modules/jsonfile/.npmignore
  17. +4 −0 test/node/node_modules/fs-extra/node_modules/jsonfile/.travis.yml
  18. +3 −0 test/node/node_modules/fs-extra/node_modules/jsonfile/CHANGELOG.md
  19. +15 −0 test/node/node_modules/fs-extra/node_modules/jsonfile/LICENSE
  20. +116 −0 test/node/node_modules/fs-extra/node_modules/jsonfile/README.md
  21. +44 −0 test/node/node_modules/fs-extra/node_modules/jsonfile/lib/jsonfile.js
  22. +37 −0 test/node/node_modules/fs-extra/node_modules/jsonfile/package.json
  23. +66 −0 test/node/node_modules/fs-extra/node_modules/jsonfile/test/jsonfile.test.js
  24. +3 −0 test/node/node_modules/fs-extra/node_modules/jsonfile/test/mocha.opts
  25. 0 test/node/node_modules/fs-extra/node_modules/jsonfile/test/resources/.gitkeep
  26. +2 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/.npmignore
  27. +5 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/.travis.yml
  28. +21 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/LICENSE
  29. +6 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/examples/pow.js
  30. +82 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/index.js
  31. +30 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/package.json
  32. +63 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/readme.markdown
  33. +38 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/chmod.js
  34. +37 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/clobber.js
  35. +28 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/mkdirp.js
  36. +32 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/perm.js
  37. +39 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/perm_sync.js
  38. +41 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/race.js
  39. +32 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/rel.js
  40. +25 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/return.js
  41. +24 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/return_sync.js
  42. +18 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/root.js
  43. +32 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/sync.js
  44. +28 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/umask.js
  45. +32 −0 test/node/node_modules/fs-extra/node_modules/mkdirp/test/umask_sync.js
  46. +4 −0 test/node/node_modules/fs-extra/node_modules/ncp/.npmignore
  47. +6 −0 test/node/node_modules/fs-extra/node_modules/ncp/.travis.yml
  48. +21 −0 test/node/node_modules/fs-extra/node_modules/ncp/LICENSE.md
  49. +46 −0 test/node/node_modules/fs-extra/node_modules/ncp/README.md
  50. +48 −0 test/node/node_modules/fs-extra/node_modules/ncp/bin/ncp
  51. +216 −0 test/node/node_modules/fs-extra/node_modules/ncp/lib/ncp.js
  52. +37 −0 test/node/node_modules/fs-extra/node_modules/ncp/package.json
  53. +1 −0 test/node/node_modules/fs-extra/node_modules/ncp/test/fixtures/src/a
  54. +1 −0 test/node/node_modules/fs-extra/node_modules/ncp/test/fixtures/src/b
  55. 0 test/node/node_modules/fs-extra/node_modules/ncp/test/fixtures/src/c
  56. 0 test/node/node_modules/fs-extra/node_modules/ncp/test/fixtures/src/d
  57. 0 test/node/node_modules/fs-extra/node_modules/ncp/test/fixtures/src/e
  58. 0 test/node/node_modules/fs-extra/node_modules/ncp/test/fixtures/src/f
  59. +1 −0 test/node/node_modules/fs-extra/node_modules/ncp/test/fixtures/src/sub/a
  60. 0 test/node/node_modules/fs-extra/node_modules/ncp/test/fixtures/src/sub/b
  61. +74 −0 test/node/node_modules/fs-extra/node_modules/ncp/test/ncp-test.js
  62. +6 −0 test/node/node_modules/fs-extra/node_modules/rimraf/AUTHORS
  63. +23 −0 test/node/node_modules/fs-extra/node_modules/rimraf/LICENSE
  64. +21 −0 test/node/node_modules/fs-extra/node_modules/rimraf/README.md
  65. +1 −0 test/node/node_modules/fs-extra/node_modules/rimraf/node_modules/graceful-fs/.npmignore
  66. +23 −0 test/node/node_modules/fs-extra/node_modules/rimraf/node_modules/graceful-fs/LICENSE
  67. +5 −0 test/node/node_modules/fs-extra/node_modules/rimraf/node_modules/graceful-fs/README.md
  68. +316 −0 test/node/node_modules/fs-extra/node_modules/rimraf/node_modules/graceful-fs/graceful-fs.js
  69. +36 −0 test/node/node_modules/fs-extra/node_modules/rimraf/node_modules/graceful-fs/package.json
  70. +46 −0 test/node/node_modules/fs-extra/node_modules/rimraf/node_modules/graceful-fs/test/open.js
  71. +55 −0 test/node/node_modules/fs-extra/node_modules/rimraf/package.json
  72. +132 −0 test/node/node_modules/fs-extra/node_modules/rimraf/rimraf.js
  73. +10 −0 test/node/node_modules/fs-extra/node_modules/rimraf/test/run.sh
  74. +47 −0 test/node/node_modules/fs-extra/node_modules/rimraf/test/setup.sh
  75. +5 −0 test/node/node_modules/fs-extra/node_modules/rimraf/test/test-async.js
  76. +3 −0 test/node/node_modules/fs-extra/node_modules/rimraf/test/test-sync.js
  77. +63 −0 test/node/node_modules/fs-extra/package.json
  78. +85 −0 test/node/node_modules/fs-extra/test/copy.test.js
  79. +60 −0 test/node/node_modules/fs-extra/test/create.test.js
  80. +66 −0 test/node/node_modules/fs-extra/test/mkdir.test.js
  81. +4 −0 test/node/node_modules/fs-extra/test/mocha.opts
  82. +62 −0 test/node/node_modules/fs-extra/test/output.test.js
  83. +68 −0 test/node/node_modules/fs-extra/test/read.test.js
  84. +127 −0 test/node/node_modules/fs-extra/test/remove.test.js
  85. +7 −0 test/node/package.json
  86. +52 −9 test/spec/ExtensionInstallation-test.js
  87. +30 −0 test/spec/SpecRunnerUtils.js
View
@@ -48,7 +48,8 @@ module.exports = function (grunt) {
'!test/spec/*-files/**/*.js',
'!test/smokes/**',
'!test/temp/**',
- '!test/thirdparty/**'
+ '!test/thirdparty/**',
+ '!test/**/node_modules/**/*.js'
],
grunt: [
'Gruntfile.js',
View
@@ -50,6 +50,7 @@ define(function (require, exports, module) {
NativeFileSystem = require("file/NativeFileSystem").NativeFileSystem,
UrlParams = require("utils/UrlParams").UrlParams,
UnitTestReporter = require("test/UnitTestReporter").UnitTestReporter,
+ NodeConnection = require("utils/NodeConnection"),
BootstrapReporterView = require("test/BootstrapReporterView").BootstrapReporterView;
// Load modules that self-register and just need to get included in the main project
@@ -67,8 +68,17 @@ define(function (require, exports, module) {
var suite,
params = new UrlParams(),
reporter,
+ _nodeConnectionDeferred = new $.Deferred(),
reporterView;
+ /**
+ * @const
+ * Amount of time to wait before automatically rejecting the connection
+ * deferred. If we hit this timeout, we'll never have a node connection
+ * for the installer in this run of Brackets.
+ */
+ var NODE_CONNECTION_TIMEOUT = 30000; // 30 seconds - TODO: share with StaticServer?
+
params.parse();
function _loadExtensionTests(suite) {
@@ -157,6 +167,39 @@ define(function (require, exports, module) {
}
function init() {
+ // Start up the node connection, which is held in the
+ // _nodeConnectionDeferred module variable. (Use
+ // _nodeConnectionDeferred.done() to access it.
+
+ // This is in SpecRunner rather than SpecRunnerUtils because the hope
+ // is to hook up jasmine-node tests in this test runner.
+
+ // TODO: duplicates code from StaticServer
+ // TODO: can this be done lazily?
+
+ var connectionTimeout = setTimeout(function () {
+ console.error("[SpecRunner] Timed out while trying to connect to node");
+ _nodeConnectionDeferred.reject();
+ }, NODE_CONNECTION_TIMEOUT);
+
+ var _nodeConnection = new NodeConnection();
+ _nodeConnection.connect(true).then(function () {
+ var domainPath = FileUtils.getNativeBracketsDirectoryPath() + "/" + FileUtils.getNativeModuleDirectoryPath(module) + "/../test/node/TestingDomain";
+
+ _nodeConnection.loadDomains(domainPath, true)
+ .then(
+ function () {
+ clearTimeout(connectionTimeout);
+ _nodeConnectionDeferred.resolve(_nodeConnection);
+ },
+ function () { // Failed to connect
+ console.error("[SpecRunner] Failed to connect to node", arguments);
+ clearTimeout(connectionTimeout);
+ _nodeConnectionDeferred.reject();
+ }
+ );
+ });
+
suite = params.get("suite") || localStorage.getItem("SpecRunner.suite") || "UnitTestSuite";
// Create a top-level filter to show/hide performance and extensions tests
@@ -260,5 +303,19 @@ define(function (require, exports, module) {
});
}
+ /**
+ * Allows access to the deferred that manages the node connection for tests.
+ *
+ * @return {jQuery.Deferred} The deferred that manages the node connection
+ */
+ function getNodeConnectionDeferred() {
+ return _nodeConnectionDeferred;
+ }
+
+ // this is used by SpecRunnerUtils
+ brackets.testing = {
+ getNodeConnectionDeferred: getNodeConnectionDeferred
+ };
+
init();
});
View
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+
+/*jslint vars: true, plusplus: true, devel: true, node: true, nomen: true,
+indent: 4, maxerr: 50 */
+
+"use strict";
+
+var fs = require("fs-extra");
+
+/**
+ * Initialize the "testing" domain.
+ * The testing domain provides utilities for tests.
+ */
+function init(domainManager) {
+ if (!domainManager.hasDomain("testing")) {
+ domainManager.registerDomain("testing", {major: 0, minor: 1});
+ }
+ domainManager.registerCommand(
+ "testing",
+ "remove",
+ fs.remove,
+ true,
+ "Remove the directory at the path",
+ [{
+ name: "path",
+ type: "string",
+ description: "path to the directory to remove"
+ }]
+ );
+}
+
+exports.init = init;

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 5a0fbcd

Please sign in to comment.