setup testing
Project: http://git-wip-us.apache.org/repos/asf/cordova-serve/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-serve/commit/5ab863a7 Tree: http://git-wip-us.apache.org/repos/asf/cordova-serve/tree/5ab863a7 Diff: http://git-wip-us.apache.org/repos/asf/cordova-serve/diff/5ab863a7 Branch: refs/heads/master Commit: 5ab863a715ad6f70b52208fa8b7f008fdb16bccc Parents: 4608607 Author: Jesse MacFadyen <[email protected]> Authored: Thu Jun 29 11:27:14 2017 -0700 Committer: Jesse MacFadyen <[email protected]> Committed: Thu Jun 29 11:27:14 2017 -0700 ---------------------------------------------------------------------- package.json | 10 ++++++---- spec/jasmine.json | 8 ++++++++ spec/main.spec.js | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-serve/blob/5ab863a7/package.json ---------------------------------------------------------------------- diff --git a/package.json b/package.json index 464fe36..ea460a7 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,11 @@ "version": "1.0.2-dev", "description": "Apache Cordova server support for cordova-lib and cordova-browser.", "main": "src/main.js", + "scripts": { + "jasmine": "jasmine JASMINE_CONFIG_PATH=spec/jasmine.json", + "jshint": "node node_modules/jshint/bin/jshint src", + "test": "npm run jshint && npm run jasmine" + }, "repository": { "type": "git", "url": "https://github.com/apache/cordova-lib" @@ -27,12 +32,9 @@ "shelljs": "^0.5.3" }, "devDependencies": { + "jasmine": "^2.5.2", "jshint": "^2.8.0" }, - "scripts": { - "jshint": "node node_modules/jshint/bin/jshint src", - "test": "npm run jshint" - }, "engines": { "node": ">=4.0.0", "npm": ">= 2.5.1" http://git-wip-us.apache.org/repos/asf/cordova-serve/blob/5ab863a7/spec/jasmine.json ---------------------------------------------------------------------- diff --git a/spec/jasmine.json b/spec/jasmine.json new file mode 100644 index 0000000..a5605d2 --- /dev/null +++ b/spec/jasmine.json @@ -0,0 +1,8 @@ +{ + "spec_dir": "spec", + "spec_files": [ + "**/*[sS]pec.js" + ], + "stopSpecOnExpectationFailure": false, + "random": false +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-serve/blob/5ab863a7/spec/main.spec.js ---------------------------------------------------------------------- diff --git a/spec/main.spec.js b/spec/main.spec.js new file mode 100644 index 0000000..b9acb5d --- /dev/null +++ b/spec/main.spec.js @@ -0,0 +1,39 @@ +/** + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +var main = require(".."); + +describe('main', function() { + + it('exists and has expected properties', function() { + expect(main).toBeDefined(); + expect(main.Router).toBeDefined(); + expect(main.static).toBeDefined(); + }); + + it('is creatable',function() { + var instance = main(); + expect(instance.servePlatform).toBeDefined(); + expect(typeof instance.servePlatform).toBe('function'); + + expect(instance.launchServer).toBeDefined(); + expect(typeof instance.launchServer).toBe('function'); + + expect(instance.launchBrowser).toBeDefined(); + expect(typeof instance.launchBrowser).toBe('function'); + }); +}); \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
