From 3a57450b69b66d756eb4fac2fd4d81ad27eb20fd Mon Sep 17 00:00:00 2001 From: moling Date: Thu, 14 Mar 2019 17:12:23 +0800 Subject: [PATCH 1/7] done 4 --- karma.conf.js | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ test/test.js | 9 +++++++ 2 files changed, 80 insertions(+) create mode 100644 karma.conf.js diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 00000000..df35b1ea --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,71 @@ +// Karma configuration +// Generated on Thu Mar 14 2019 15:41:57 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..44d065d6 100644 --- a/test/test.js +++ b/test/test.js @@ -32,5 +32,14 @@ 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 (data) { + done() + }, + error: function (err) { + done(err) + } + }) }) }) \ No newline at end of file From 9084eb2ddf8f952b6703926686e70d3464fbbd7c Mon Sep 17 00:00:00 2001 From: moling Date: Fri, 15 Mar 2019 16:21:06 +0800 Subject: [PATCH 2/7] add travis CI --- .travis.yml | 9 +++++++++ package.json | 1 + 2 files changed, 10 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..e3a2c623 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +# node版本 +node_js: + - '10' + +install: + - npm install + + diff --git a/package.json b/package.json index 71c96b0c..17428ad1 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "devDependencies": { "karma": "^1.7.0", "karma-chrome-launcher": "^2.2.0", + "karma-firefox-launcher": "^1.1.0", "karma-mocha": "^1.3.0", "mocha": "^3.5.0", "should": "^11.2.1" From 31ec3ec82668cfe5a83914fe513c9e69796b3f0b Mon Sep 17 00:00:00 2001 From: moling Date: Fri, 15 Mar 2019 16:26:23 +0800 Subject: [PATCH 3/7] add 111 --- test/test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index 44d065d6..2a40230a 100644 --- a/test/test.js +++ b/test/test.js @@ -29,17 +29,19 @@ describe('jQuery', function () { ele = null }) }) - + 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 (data) { done() + console.log(data) }, error: function (err) { done(err) } }) }) -}) \ No newline at end of file +}) + From 8eccacb2e7ebc330c21194c1911a9fdda7b6bfc4 Mon Sep 17 00:00:00 2001 From: moling Date: Fri, 15 Mar 2019 16:31:08 +0800 Subject: [PATCH 4/7] add 222 --- test/test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test.js b/test/test.js index 2a40230a..c1eb5c29 100644 --- a/test/test.js +++ b/test/test.js @@ -45,3 +45,4 @@ describe('jQuery', function () { }) }) +console.log('111111111', a) From 21f32f9bb599859b43589585e6bf8878ee19e5ef Mon Sep 17 00:00:00 2001 From: moling Date: Fri, 15 Mar 2019 16:50:51 +0800 Subject: [PATCH 5/7] 333 --- test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.js b/test/test.js index c1eb5c29..c9061fc6 100644 --- a/test/test.js +++ b/test/test.js @@ -45,4 +45,4 @@ describe('jQuery', function () { }) }) -console.log('111111111', a) +console.log('111111111') From 545cf19aec8bbea00cfc66d25b3feb8db4aec893 Mon Sep 17 00:00:00 2001 From: moling Date: Fri, 15 Mar 2019 17:14:47 +0800 Subject: [PATCH 6/7] 4444 --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e3a2c623..1be1b275 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,8 @@ node_js: install: - npm install - +before_install: + - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - + - sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' + - sudo apt-get update -qq + - sudo apt-get install -qq google-chrome-stable From 79354c380079a612c23dbe49eb77c66a21a530ac Mon Sep 17 00:00:00 2001 From: moling Date: Thu, 21 Mar 2019 11:14:25 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 9 ++++----- karma.conf.js | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1be1b275..db2eabc2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,9 @@ node_js: - '10' install: - - npm install + - npm install before_install: - - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - - - sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' - - sudo apt-get update -qq - - sudo apt-get install -qq google-chrome-stable + - export CHROME_BIN=chromium-browser + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start diff --git a/karma.conf.js b/karma.conf.js index df35b1ea..4c0b1003 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -62,7 +62,7 @@ module.exports = function(config) { // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits - singleRun: false, + singleRun: true, // Concurrency level // how many browser should be started simultaneous