Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create test command #1

Merged
merged 21 commits into from
Jan 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.js.map
!/*.js
!/tasks/*.js
/_build
/bower_components
/dist
/html-report
/node_modules
/typings
.baseDir.ts
.tscache
coverage-unmapped.json
npm-debug.log
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
sudo: false
language: node_js
node_js:
- '6'
env:
global:
- SAUCE_USERNAME: dojo2-ts-ci
- SAUCE_ACCESS_KEY: e92610e3-834e-4bec-a3b5-6f7b9d874601
install:
- travis_retry npm install grunt cli
- travis_retry npm install
script:
- grunt
- grunt intern:node --combined
- grunt remapIstanbul:ci
- grunt uploadCoverage
notifications:
slack:
secure: O9m3cCkl3H8VXRIuKLFfx91C01n9yLlehem9K3snnBMiyrtGWR2aXo+t1eeZYGfFWIl8UBEaSPlDurI1KspIcW/JbszuYAVje21rbl+ptkp008f5gDVfFCFpqdM9S5+lrVJLlx1mrikWKBRsjYqZHYV9EJx/ss+P86JsQ0utC7zgBFYId+UCMybAemzi1FPfeULFWpoi8QavoN8fNr4yHBayrqOlqnnIhlYLoTiGL6yY8L/meUrmWVxSY3JMDxLeIYNppt4puvTGUD1hU2LZgFZp1y6jGMcAlZI5amGV+iyTl/h2w1wiB6q5tolJ1JslosFvh53y7+1Crbm8wQDkX42+z7Rn3/jXRUBFwLZBGZQ99FcE0Yz+XBaQA3GuCgPNd0rcHmJxeYAKMm7jg2B8Nzd6It3q5mjdp9ITA5kR2G7g+iH8R4y112FXCpvt4/RUvHuyhl7w8lFlHK+LslH3DBjDi3fKUuwiGtU8oD3xpCunJ4JUgQmAWIOy3mpFIOX4QPcBKqByp10fNw3G73JDsJ9DXrFGb/+WnA2OgpDnKOnjoporwufRZLeioRwCJAWM0DbFDvRc1mbnECwcKiedzKdTxSWUGyJ6sxKydZtC11tF356BkzIsf3x7cKSed2LI8VXYNiPOJu9P+/s5/jRf/7kZ+i2ETfuKZC2awhgkBGo=
on_success: change
34 changes: 34 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = function (grunt) {
var staticFiles = [ 'intern/**' ];
require('grunt-dojo2').initConfig(grunt, {
ts: {
dist: {
exclude: [
'./src/intern',
'./tests/**/*.ts'
]
}
},
copy: {
staticDistFiles: {
expand: true,
cwd: 'src',
src: staticFiles,
dest: '<%= distDirectory %>'
},
staticDevFiles: {
expand: true,
cwd: 'src',
src: staticFiles,
dest: '<%= devDirectory %>/src'
}
}
});

grunt.registerTask('ci', [
'intern:node'
]);

grunt.registerTask('dist', grunt.config.get('distTasks').concat(['copy:staticDistFiles']));
grunt.registerTask('dev', grunt.config.get('devTasks').concat(['copy:staticDevFiles']));
};
28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
The "New" BSD License
*********************

Copyright (c) 2015 - 2017, The JS Foundation
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Dojo Foundation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,53 @@
# cli-test-intern
The Dojo 2 cli command for testing applications

<!-- TODO: change and uncomment
[![Build Status](https://travis-ci.org/dojo/cli-test-intern.svg?branch=master)](https://travis-ci.org/dojo/cli-test-intern)
[![codecov](https://codecov.io/gh/dojo/cli-test-intern/branch/master/graph/badge.svg)](https://codecov.io/gh/dojo/cli-test-intern)
[![npm version](https://badge.fury.io/js/dojo-cli-test-intern.svg)](http://badge.fury.io/js/dojo-cli-test-intern)
-->

The official Dojo 2 test command.

## Features
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we could fill out the readme a bit?


Builds and runs test cases for a Dojo 2 application. This module assumes that your project is structured
as it would be if created by `dojo create`. Specifically, `src` and `tests` should be in the root of the project directory,
and `tests` should have `functional` and `unit` folders with `all.ts` files in each that import other tests.

## How do I use this package?

To build and run tests locally, just execute `dojo test` in your project. There are several configuration options, to see what
options are available run `dojo test -h`

## How do I contribute?

We appreciate your interest! Please see the [Dojo 2 Meta Repository](https://github.com/dojo/meta#readme) for the
Contributing Guidelines and Style Guide.

## Testing

Test cases MUST be written using [Intern](https://theintern.github.io) using the Object test interface and Assert assertion interface.

90% branch coverage MUST be provided for all code submitted to this repository, as reported by Istanbul’s combined coverage results for all supported platforms.

To test locally in node run:

`grunt test`

## Licensing information

* [ora](https://github.com/sindresorhus/ora) ([MIT](https://opensource.org/licenses/MIT))
* [Chalk](https://github.com/chalk/chalk)([MIT](https://opensource.org/licenses/MIT))
* [cross-spawn](https://github.com/IndigoUnited/node-cross-spawn)([MIT](https://opensource.org/licenses/MIT))
* [pkg-dir](https://github.com/sindresorhus/pkg-dir)([MIT](https://opensource.org/licenses/MIT))
* [Istanbul](https://github.com/gotwarlost/istanbul)([New BSD](http://opensource.org/licenses/BSD-3-Clause))
* [Mockery](https://github.com/mfncooper/mockery)([MIT](https://opensource.org/licenses/MIT))
* [codecov.io](https://github.com/cainus/codecov.io)([MIT](https://opensource.org/licenses/MIT))
* [Glob](https://github.com/isaacs/node-glob)([ISC](https://opensource.org/licenses/ISC))
* [grunt-tslint](https://github.com/palantir/grunt-tslint)([Apache 2.0](https://opensource.org/licenses/Apache-2.0))
* [Sinon.JS](https://github.com/sinonjs/sinon)([New BSD](http://opensource.org/licenses/BSD-3-Clause))
* [TSLint](https://github.com/palantir/tslint)([Apache 2.0](https://opensource.org/licenses/Apache-2.0))
* [yargs](https://github.com/yargs/yargs)([MIT](https://opensource.org/licenses/MIT))

© 2004–2017 JS Foundation & contributors. [New BSD](LICENSE) license.

4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
comment:
branches:
- master
- feature/*
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@dojo/cli-test-intern",
"version": "2.0.0-pre",
"description": "Test a Dojo 2 application",
"private": true,
"homepage": "http://dojotoolkit.org",
"bugs": {
"url": "https://github.com/dojo/cli-test-intern/issues"
},
"license": "BSD-3-Clause",
"main": "main.js",
"repository": {
"type": "git",
"url": "https://github.com/dojo/cli-test-intern.git"
},
"scripts": {
"test": "grunt test"
},
"devDependencies": {
"@types/chalk": "^0.4.31",
"codecov.io": "0.1.6",
"@dojo/cli": "2.0.0-alpha.8",
"@dojo/loader": "2.0.0-beta.9",
"dts-generator": "~1.7.0",
"glob": "^7.0.3",
"grunt": "~1.0.1",
"grunt-tslint": "^3.0.0",
"grunt-dojo2": "2.0.0-beta.23",
"intern": "~3.4.2",
"istanbul": "^0.4.3",
"mockery": "^1.7.0",
"remap-istanbul": "^0.6.4",
"sinon": "^1.17.5",
"tslint": "^3.15.1",
"typescript": "~2.1.4",
"yargs": "^5.0.0"
},
"dependencies": {
"ora": "^0.3.0",
"chalk": "^1.1.3",
"cross-spawn": "^4.0.0",
"pkg-dir": "^1.0.0"
}
}
1 change: 1 addition & 0 deletions src/dirname.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default __dirname;
15 changes: 15 additions & 0 deletions src/intern/intern-browserstack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
define([
'./intern'
], function (intern) {
intern.tunnel = 'BrowserstackTunnel';
intern.tunnelOptions = {};
intern.maxConcurrency = 2;

intern.environments = [
{ browserName: 'internet explorer', version: [ '10', '11' ], platform: 'WINDOWS' },
{ browserName: 'firefox', platform: 'WINDOWS' },
{ browserName: 'chrome', platform: 'WINDOWS' }
];

return intern;
});
21 changes: 21 additions & 0 deletions src/intern/intern-saucelabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
define([
'./intern'
], function (intern) {

intern.environments = [
{ browserName: 'internet explorer', version: [ '10.0', '11.0' ], platform: 'Windows 7' },
{ browserName: 'firefox', version: '49', platform: 'Windows 10' },
{ browserName: 'chrome', platform: 'Windows 10' }
];

/* SauceLabs supports more max concurrency */
intern.maxConcurrency = 4;

/* SauceLabs combined with Travis often causes functional tests to fail with too short a timeout */
intern.defaultTimeout = 10000;

intern.tunnel = 'SauceLabsTunnel';
intern.tunnelOptions = {};

return intern;
});
28 changes: 28 additions & 0 deletions src/intern/intern-testingbot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
define([
'./intern'
], function (intern) {

intern.environments = [
{ browserName: 'internet explorer', version: [ '10', '11' ], platform: 'WIN8' },
{ browserName: 'firefox', version: '49', platform: 'WIN10' },
{ browserName: 'chrome', platform: 'WIN10' }
];

/* Testingbot supports more max concurrency */
intern.maxConcurrency = 3;
intern.tunnel = 'TestingBotTunnel';
intern.webdriver = {
host: 'http://hub.testingbot.com/wd/hub',
username: 'key',
accessKey: 'secret'
};

intern.tunnelOptions = {
verbose: true,
apiKey: 'key',
apiSecret: 'secret'
};
intern.useSauceConnect = false;

return intern;
});
61 changes: 61 additions & 0 deletions src/intern/intern.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
define({
proxyPort: 9000,

// A fully qualified URL to the Intern proxy
proxyUrl: 'http://localhost:9000/',

// Browsers to run integration testing against. Note that version numbers must be strings if used with Sauce
// OnDemand. Options that will be permutated are browserName, version, platform, and platformVersion; any other
// capabilities options specified for an environment will be copied as-is
environments: [
{ browserName: 'chrome' }
],

// Maximum number of simultaneous integration tests that should be executed on the remote WebDriver service
maxConcurrency: 2,

// Name of the tunnel class to use for WebDriver tests
tunnel: 'SeleniumTunnel',
tunnelOptions: {
hostname: 'localhost',
port: '4444'
},
// Support running unit tests from a web server that isn't the intern proxy
initialBaseUrl: (function () {
if (typeof location !== 'undefined' && location.pathname.indexOf('__intern/') > -1) {
return '/';
}
return null;
})(),

// The desired AMD loader to use when running unit tests (client.html/client.js). Omit to use the default Dojo
// loader
loaders: {
'host-browser': 'node_modules/@dojo/loader/loader.js',
'host-node': '@dojo/loader'
},

// Configuration options for the module loader; any AMD configuration options supported by the specified AMD loader
// can be used here
loaderOptions: {
// Packages that should be registered with the loader in each testing environment
packages: [
{ name: 'src', location: '_build/src' },
{ name: 'tests', location: '_build/tests' },
{ name: 'dojo', location: 'node_modules/intern/node_modules/dojo' },
{ name: 'sinon', location: 'node_modules/sinon/pkg', main: 'sinon' },
{ name: '@dojo', location: 'node_modules/@dojo' }
]
},

// Non-functional test suite(s) to run in each browser
suites: [ 'tests/unit/all' ],

// Functional test suite(s) to run in each browser once non-functional tests are completed
functionalSuites: [ 'tests/functional/all' ],

// A regular expression matching URLs to files that should not be included in code coverage analysis
excludeInstrumentation: /(?:node_modules|bower_components|tests)[\/]/,

defaultTimeout: 5000
});
Loading