From 7f32af6b0d950a88ceadc0dcc95d316df2e42114 Mon Sep 17 00:00:00 2001 From: Mrpaker Date: Tue, 12 Mar 2019 21:46:22 +0800 Subject: [PATCH 01/10] done --- karma.conf.js | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++ test/test.js | 7 ++++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 karma.conf.js diff --git a/karma.conf.js b/karma.conf.js new file mode 100644 index 00000000..2adc2359 --- /dev/null +++ b/karma.conf.js @@ -0,0 +1,71 @@ +// Karma configuration +// Generated on Tue Mar 12 2019 21:28:49 GMT+0800 (CST) + +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..7ee3f383 100644 --- a/test/test.js +++ b/test/test.js @@ -5,7 +5,7 @@ describe('jQuery', function () { } }) - it('should able to get a body', function () { + it('sohould able to get a bdy', function () { var $body = $('body') $body.length.should.equal(1) $body[0].should.equal(document.getElementsByTagName('body')[0]) @@ -31,6 +31,11 @@ describe('jQuery', function () { }) it('should able to request https://raw.githubusercontent.com/FE-star/exercise1/master/test/test.js', function (done) { + $.get('https://raw.githubusercontent.com/FE-star/exercise1/master/test/test.js', function(data){ + if(data) { + done() + } + }) // 使用 jQuery.ajax 请求 https://raw.githubusercontent.com/FE-star/exercise1/master/test/test.js,并验证是否拿到文件 }) }) \ No newline at end of file From e04c604e14ca4df2eb98457e2542e93f0596dd9a Mon Sep 17 00:00:00 2001 From: Mrpaker Date: Tue, 12 Mar 2019 22:17:10 +0800 Subject: [PATCH 02/10] Create .travis.yml --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..07196a3c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - "8.9.1" +before_inatall: + - npm install +script: + - npm run test \ No newline at end of file From 40ad34dd038940af6f183a3812bac8b9b054f45a Mon Sep 17 00:00:00 2001 From: Mrpaker Date: Tue, 12 Mar 2019 22:40:01 +0800 Subject: [PATCH 03/10] test --- .travis.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 07196a3c..573d5cf6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,17 @@ +addons: + apt: + sources: + - google-chrome + packages: + - google-chrome-stable language: node_js node_js: - "8.9.1" -before_inatall: +before_install: + - npm i -g npm@5.5.1 + +install: - npm install + - npm install -g karma script: - npm run test \ No newline at end of file From 911f704f1cfb0fd670c1a1c0ac4985cf223b65ca Mon Sep 17 00:00:00 2001 From: Mrpaker Date: Tue, 12 Mar 2019 22:48:19 +0800 Subject: [PATCH 04/10] test --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 573d5cf6..7ccee4c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,5 @@ addons: - apt: - sources: - - google-chrome - packages: - - google-chrome-stable + chrome: stable language: node_js node_js: - "8.9.1" From 1bb0c4783a9860744b49fc34f949bde5c08f82e5 Mon Sep 17 00:00:00 2001 From: yangwei Date: Wed, 13 Mar 2019 14:02:00 +0800 Subject: [PATCH 05/10] Update .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7ccee4c7..8c987d7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ language: node_js node_js: - "8.9.1" before_install: + - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & - npm i -g npm@5.5.1 install: From 43f59e7ec16067cdbb0f71f64e6723b3d3b3ad34 Mon Sep 17 00:00:00 2001 From: yangwei Date: Wed, 13 Mar 2019 15:24:22 +0800 Subject: [PATCH 06/10] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8c987d7f..e48e5b8c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ language: node_js node_js: - "8.9.1" before_install: - - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & + - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9876 http://localhost & - npm i -g npm@5.5.1 install: From aa3d9f6810a0bea7321b1de1441b9f3d745f9d52 Mon Sep 17 00:00:00 2001 From: yangwei Date: Wed, 13 Mar 2019 15:35:45 +0800 Subject: [PATCH 07/10] test --- .travis.yml | 3 +-- karma.conf.js | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e48e5b8c..4bf90c86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,10 @@ language: node_js node_js: - "8.9.1" before_install: - - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9876 http://localhost & + - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & - npm i -g npm@5.5.1 install: - npm install - - npm install -g karma script: - npm run test \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js index 2adc2359..ef7e5824 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -57,7 +57,14 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['Chrome'], + browsers: ['Chrome', 'ChromeHeadless', 'ChromeHeadlessNoSandbox'],// ['Chrome'], + + customLaunchers: { + ChromeHeadlessNoSandbox: { + base: 'ChromeHeadless', + flags: ['--no-sandbox'] + } + }, // Continuous Integration mode From 59a7cc6f2c6b402fbc46fac4455206d42d5ca52a Mon Sep 17 00:00:00 2001 From: yangwei Date: Wed, 13 Mar 2019 15:40:08 +0800 Subject: [PATCH 08/10] Update karma.conf.js --- karma.conf.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/karma.conf.js b/karma.conf.js index ef7e5824..2adc2359 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -57,14 +57,7 @@ module.exports = function(config) { // start these browsers // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['Chrome', 'ChromeHeadless', 'ChromeHeadlessNoSandbox'],// ['Chrome'], - - customLaunchers: { - ChromeHeadlessNoSandbox: { - base: 'ChromeHeadless', - flags: ['--no-sandbox'] - } - }, + browsers: ['Chrome'], // Continuous Integration mode From d90eb54539e472039f50b9029dfe7c00aecaa9f3 Mon Sep 17 00:00:00 2001 From: yangwei Date: Wed, 13 Mar 2019 16:20:03 +0800 Subject: [PATCH 09/10] Update .travis.yml --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4bf90c86..4f63af93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,10 +4,15 @@ language: node_js node_js: - "8.9.1" before_install: - - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & + + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start + - sleep 3 # give xvfb some time to start + # - google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost & - npm i -g npm@5.5.1 install: - npm install + script: - npm run test \ No newline at end of file From 6b78a7c6525d195c2b7483784bc1f2eca0f2d8e5 Mon Sep 17 00:00:00 2001 From: yangwei Date: Thu, 14 Mar 2019 13:25:13 +0800 Subject: [PATCH 10/10] Update karma.conf.js --- karma.conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/karma.conf.js b/karma.conf.js index 2adc2359..4a5b5813 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