🌐 AI搜索 & 代理 主页
Skip to content

Commit ecee70a

Browse files
Merge branch 'canary'
2 parents 4a59443 + 7685484 commit ecee70a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2311
-2014
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ node_js:
33
- "iojs"
44
- "0.12"
55
- "0.10"
6-
- "0.8"
76

87
env:
98
global:
@@ -21,6 +20,7 @@ before_script:
2120
- sh -e /etc/init.d/xvfb start
2221
- npm install -g grunt-cli
2322
- rm -rf node_modules/karma
23+
- cd node_modules && ln -nsf ../ karma && cd ../
2424
- export $(openssl aes-256-cbc -pass env:CREDENTIALS_PASS -d -in credentials)
2525

2626
script:

Gruntfile.coffee

Lines changed: 0 additions & 113 deletions
This file was deleted.

client/karma.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ var stringify = require('./stringify')
22
var constant = require('./constants')
33
var util = require('./util')
44

5-
/* jshint unused: false */
65
var Karma = function (socket, iframe, opener, navigator, location) {
76
var hasError = false
87
var startEmitted = false
@@ -12,14 +11,17 @@ var Karma = function (socket, iframe, opener, navigator, location) {
1211
var queryParams = util.parseQueryParams(location.search)
1312
var browserId = queryParams.id || util.generateId('manual-')
1413
var returnUrl = queryParams['return_url' + ''] || null
15-
var currentTransport
1614

17-
var resultsBufferLimit = 1
15+
var resultsBufferLimit = 50
1816
var resultsBuffer = []
1917

2018
this.VERSION = constant.VERSION
2119
this.config = {}
2220

21+
// Expose for testing purposes as there is no global socket.io
22+
// registry anymore.
23+
this.socket = socket
24+
2325
var childWindow = null
2426
var navigateContextTo = function (url) {
2527
if (self.config.useIframe === false) {
@@ -111,7 +113,7 @@ var Karma = function (socket, iframe, opener, navigator, location) {
111113
// we are not going to execute at all
112114
this.error = function (msg, url, line) {
113115
hasError = true
114-
socket.emit('error', url ? msg + '\nat ' + url + (line ? ':' + line : '') : msg)
116+
socket.emit('karma_error', url ? msg + '\nat ' + url + (line ? ':' + line : '') : msg)
115117
this.complete()
116118
return false
117119
}
@@ -215,14 +217,9 @@ var Karma = function (socket, iframe, opener, navigator, location) {
215217

216218
// report browser name, id
217219
socket.on('connect', function () {
218-
currentTransport = socket.socket.transport.name
219-
220-
// TODO(vojta): make resultsBufferLimit configurable
221-
if (currentTransport === 'websocket' || currentTransport === 'flashsocket') {
220+
socket.io.engine.on('upgrade', function () {
222221
resultsBufferLimit = 1
223-
} else {
224-
resultsBufferLimit = 50
225-
}
222+
})
226223

227224
socket.emit('register', {
228225
name: navigator.userAgent,

client/main.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ var util = require('./util')
77

88
var KARMA_URL_ROOT = require('./constants').KARMA_URL_ROOT
99

10-
// connect socket.io
11-
// https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO
12-
var socket = io.connect(location.protocol + '//' + location.host, {
13-
'reconnection delay': 500,
14-
'reconnection limit': 2000,
15-
'resource': KARMA_URL_ROOT.substr(1) + 'socket.io',
16-
'sync disconnect on unload': true,
17-
'max reconnection attempts': Infinity
10+
// Connect to the server using socket.io http://socket.io
11+
var socket = io(location.host, {
12+
reconnectionDelay: 500,
13+
reconnectionDelayMax: Infinity,
14+
timeout: 2000,
15+
path: '/' + KARMA_URL_ROOT.substr(1) + 'socket.io',
16+
'sync disconnect on unload': true
1817
})
1918

2019
// instantiate the updater of the view

client/stringify.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var serialize = require('dom-serialize')
12
var instanceOf = require('./util').instanceOf
23

34
var stringify = function stringify (obj, depth) {
@@ -37,6 +38,8 @@ var stringify = function stringify (obj, depth) {
3738
return '<!--' + obj.nodeValue + '-->'
3839
} else if (obj.outerHTML) {
3940
return obj.outerHTML
41+
} else if (obj.tagName || obj.nodeName) {
42+
return serialize(obj)
4043
} else {
4144
var constructor = 'Object'
4245
if (obj.constructor && typeof obj.constructor === 'function') {

client/updater.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ var VERSION = require('./constants').VERSION
22

33
var StatusUpdater = function (socket, titleElement, bannerElement, browsersElement) {
44
var updateBrowsersInfo = function (browsers) {
5-
var items = [], status
5+
var items = []
6+
var status
67
for (var i = 0; i < browsers.length; i++) {
78
status = browsers[i].isReady ? 'idle' : 'executing'
89
items.push('<li class="' + status + '">' + browsers[i].name + ' is ' + status + '</li>')

docs/about/01-versioning.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
Karma uses [Semantic Versioning] with a little exception:
2-
- even versions (eg. `0.6.x`, `0.8.x`) are considered stable - no breaking changes or new features, only bug fixes will be pushed into this branch
3-
- odd versions (eg. `0.7.x`, `0.9.x`) are unstable - anything can happen ;-)
1+
Karma uses [Semantic Versioning]. We publish unstable versions as `rc` versions, e.g. the current stable could look like `0.12.36` and the unstable would be something like `0.13.0-rc.4`.
42

5-
Therefore, it is recommended that you rely on the latest stable (even) version, which will give you automatic bug fixes, but will not break your test setup:
3+
It is recommended that you rely on the latest stable version, which will give you automatic bug fixes, but will not break your test setup:
64
```javascript
75
{
86
"devDependencies": {
9-
"karma": "~0.10"
7+
"karma": "^0.12"
108
}
119
}
1210
```

docs/config/01-configuration-file.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,10 @@ on whether all tests passed or any tests failed.
351351
## transports
352352
**Type:** Array
353353

354-
**Default:** `['websocket', 'flashsocket', 'xhr-polling', 'jsonp-polling']`
354+
**Default:** `['polling', 'websocket']`
355355

356356
**Description:** An array of allowed transport methods between the browser and testing server. This configuration setting
357-
is handed off to [socket.io](https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO) (which manages the communication
357+
is handed off to [socket.io](http://socket.io/) (which manages the communication
358358
between browsers and the testing server).
359359

360360
## client.useIframe

docs/config/02-files.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ Each pattern is either a simple string or an object with four properties:
4141
* **Default.** `true`
4242
* **Description.** Should the files be served by Karma's webserver?
4343

44+
### `nocache`
45+
* **Type.** Boolean
46+
* **Default.** `false`
47+
* **Description.** Should the files be served from disk on each request by Karma's webserver?
48+
4449

4550
## Preprocessor transformations
4651
Depending on preprocessor configuration, be aware that files loaded may be transformed and no longer available in
@@ -66,7 +71,10 @@ files: [
6671
{pattern: 'compiled/index.html', watched: false},
6772

6873
// this file only gets watched and is otherwise ignored
69-
{pattern: 'app/index.html', included: false, served: false}
74+
{pattern: 'app/index.html', included: false, served: false},
75+
76+
// this file will be served on demand from disk and will be ignored by the watcher
77+
{pattern: 'compiled/app.js.map', included: false, served: true, watched: false, nocache: true}
7078
],
7179
```
7280

@@ -77,7 +85,7 @@ Example for loading images
7785

7886
```javascript
7987
files: [
80-
{pattern: "test/images/*.jpg", watched: false, included: false, served: true}
88+
{pattern: 'test/images/*.jpg', watched: false, included: false, served: true, nocache: false}
8189
],
8290
```
8391

0 commit comments

Comments
 (0)