From 407d1567ce4364acc98ac61c9cc8bff1937188b8 Mon Sep 17 00:00:00 2001 From: wangjiab <17600275226@163.com> Date: Tue, 19 Mar 2019 23:08:52 +0800 Subject: [PATCH] committed --- karma.conf.js | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ test/test.js | 6 +++++ 2 files changed, 77 insertions(+) create mode 100644 karma.conf.js diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 00000000..2565b3e9 --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,71 @@ +// Karma configuration +// Generated on Tue Mar 19 2019 23:02:26 GMT+0800 (GMT+08:00) + +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: ['mocha'], + + + // list of files / patterns to load in the browser + files: [ + 'https://cdn.bootcss.com/jquery/2.2.4/jquery.js', + 'node_modules/should/should.js', + 'test/**.js' + ], + + + // list of files to exclude + exclude: [ + ], + + + // 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_INFO, + + + // 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, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: Infinity + }) +} diff --git a/test/test.js b/test/test.js index 7c01938c..c3426acd 100644 --- a/test/test.js +++ b/test/test.js @@ -32,5 +32,11 @@ describe('jQuery', function () { it('should able to request https://raw.githubusercontent.com/FE-star/exercise1/master/test/test.js', function (done) { // 使用 jQuery.ajax 请求 https://raw.githubusercontent.com/FE-star/exercise1/master/test/test.js,并验证是否拿到文件 + $.ajax({ + url: "https://raw.githubusercontent.com/FE-star/exercise1/master/test/test.js", + success: function() { + done(); + } + }) }) }) \ No newline at end of file