mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
initial test
This commit is contained in:
17
gulpfile.js
17
gulpfile.js
@ -189,15 +189,25 @@ gulp.task('bundle.js', function() {
|
||||
// throw new Error(error);
|
||||
// })
|
||||
//});
|
||||
gulp.task('tests', function() {
|
||||
return gulp.src('ionic/components/*/test/*/**/*.spec.ts')
|
||||
.pipe(tsc(tscOptions, null, tscReporter))
|
||||
.pipe(babel())
|
||||
.pipe(rename(function(file) {
|
||||
file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep)
|
||||
}))
|
||||
.pipe(gulp.dest('dist/tests'))
|
||||
})
|
||||
|
||||
|
||||
gulp.task('examples', function() {
|
||||
var buildTest = lazypipe()
|
||||
//.pipe(traceur, traceurOptions)
|
||||
.pipe(tsc, tscOptions, null, tsc.reporter.nullReporter())
|
||||
.pipe(tsc, tscOptions, null, tscReporter)
|
||||
.pipe(babel, exampleBabelOptions)
|
||||
|
||||
// Get each test folder with gulp.src
|
||||
return gulp.src('ionic/components/*/test/*/**/*')
|
||||
return gulp.src(['ionic/components/*/test/*/**/*', '!ionic/components/*/test/*/**/*.spec.ts'])
|
||||
.pipe(cache('examples', { optimizeMemory: true }))
|
||||
.pipe(gulpif(/.ts$/, buildTest()))
|
||||
.on('error', function (err) {
|
||||
@ -263,7 +273,8 @@ gulp.task('vendor', function() {
|
||||
require('./scripts/snapshot/snapshot.task')(gulp, argv, buildConfig);
|
||||
|
||||
gulp.task('karma', function() {
|
||||
return karma.start({ configFile: __dirname + '/scripts/test/karma.conf.js' })
|
||||
//return karma.start({ configFile: __dirname + '/scripts/test/karma.conf.js' })
|
||||
return karma.start({ configFile: __dirname + '/karma.conf.js' })
|
||||
});
|
||||
|
||||
gulp.task('karma-watch', function() {
|
||||
|
7
ionic/components/app/test/sink/sink.spec.ts
Normal file
7
ionic/components/app/test/sink/sink.spec.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import {Ion} from 'ionic/ion';
|
||||
|
||||
export function main() {
|
||||
it('should be true', () => {
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
}
|
68
karma.conf.js
Normal file
68
karma.conf.js
Normal file
@ -0,0 +1,68 @@
|
||||
// Karma configuration
|
||||
// Generated on Mon Jul 13 2015 15:16:50 GMT-0500 (CDT)
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: '',
|
||||
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
{pattern: 'dist/js/es5/ionic/**/*.js', included: false},
|
||||
{pattern: 'dist/tests/**/*.spec.js', included: true},
|
||||
'test-main.js'
|
||||
],
|
||||
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
'ionic/components/*/test/*/**/*'
|
||||
],
|
||||
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
},
|
||||
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress'],
|
||||
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_DEBUG,
|
||||
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: true,
|
||||
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: ['Chrome'],
|
||||
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
singleRun: false
|
||||
})
|
||||
}
|
@ -25,10 +25,12 @@
|
||||
"karma": "^0.12.31",
|
||||
"karma-chrome-launcher": "^0.1.7",
|
||||
"karma-jasmine": "^0.3.5",
|
||||
"karma-requirejs": "^0.2.2",
|
||||
"lazypipe": "^0.2.3",
|
||||
"lodash": "^2.4.1",
|
||||
"node-libs-browser": "^0.5.2",
|
||||
"node-uuid": "^1.4.1",
|
||||
"requirejs": "^2.1.19",
|
||||
"run-sequence": "^1.1.0",
|
||||
"serve-static": "^1.9.2",
|
||||
"source-map-support": "^0.2.10",
|
||||
|
@ -3,7 +3,7 @@ var buildConfig = require('../build/config');
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
singleRun: true,
|
||||
basePath: '../../dist/lib',
|
||||
basePath: '../..',
|
||||
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
|
2
test-main.js
Normal file
2
test-main.js
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
__karma__.start();
|
Reference in New Issue
Block a user