Skip to content

Commit 6497376

Browse files
authored
Merge pull request #294 from xg-wang/dep
Upgrade devDependencies and CI
2 parents 50017f6 + 4af5a86 commit 6497376

File tree

7 files changed

+1051
-1963
lines changed

7 files changed

+1051
-1963
lines changed

.travis.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
sudo: false
21
language: node_js
32
node_js:
43
- "12"
54

6-
before_install:
7-
- "npm config set spin false"
8-
# if npm version is less than 3.0.0, upgrade to 3
9-
- if [[ $(npm -v | cut -d '.' -f 1) -lt 3 ]]; then npm i -g npm@^3; fi
10-
- "npm config set spin false"
11-
12-
script: npm run test-ci
13-
install:
14-
- node --version
15-
- npm --version
16-
- git --version
17-
- npm install
5+
addons:
6+
chrome: stable
187

8+
script: yarn run test-ci
199

2010
after_script:
21-
- find ./coverage/Phantom* -name "lcov.info" -exec cat {} \; | coveralls
11+
- find ./coverage/HeadlessChrome* -name "lcov.info" -exec cat {} \; | coveralls

bower.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,5 @@
2020
"route-recognizer": "^0.2.3"
2121
},
2222
"devDependencies": {
23-
"jquery": "~2.1.0",
24-
"jquery-1": "https://code.jquery.com/jquery-1.11.3.min.js"
2523
}
2624
}

karma.conf.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,23 @@ module.exports = function(config) {
77
// base path that will be used to resolve all patterns (eg. files, exclude)
88
basePath: '',
99

10+
plugins: ['karma-jquery', 'karma-qunit', 'karma-coverage', 'karma-sinon', 'karma-chrome-launcher'],
1011

1112
// frameworks to use
1213
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13-
frameworks: ['qunit', 'sinon'],
14-
14+
frameworks: ['qunit', 'sinon', 'jquery-3.4.0'],
1515

1616
// list of files / patterns to load in the browser
1717
files: [
1818
'node_modules/fake-xml-http-request/fake_xml_http_request.js',
1919
'node_modules/route-recognizer/dist/route-recognizer.js',
20-
'bower_components/jquery-1/index.js',
21-
'bower_components/jquery/dist/jquery.js',
2220
'node_modules/es6-promise/dist/es6-promise.auto.js',
2321
'node_modules/abortcontroller-polyfill/dist/abortcontroller-polyfill-only.js',
2422
'node_modules/whatwg-fetch/dist/fetch.umd.js',
2523
'dist/pretender.js',
2624
'test/**/*.js'
2725
],
2826

29-
// list of files to exclude
30-
exclude: [
31-
32-
],
33-
34-
3527
// preprocess matching files before serving them to the browser
3628
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
3729
preprocessors: {
@@ -69,8 +61,15 @@ module.exports = function(config) {
6961

7062
// start these browsers
7163
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
72-
browsers: ['Chrome', 'PhantomJS'],
73-
64+
browsers: ['Chrome', 'ChromeHeadless', 'ChromeHeadlessNoSandbox'],
65+
66+
// you can define custom flags
67+
customLaunchers: {
68+
ChromeHeadlessNoSandbox: {
69+
base: 'ChromeHeadless',
70+
flags: ['--no-sandbox']
71+
}
72+
},
7473

7574
// Continuous Integration mode
7675
// if true, Karma captures browsers, runs the tests and exits

package.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
"scripts": {
1010
"release": "release-it",
1111
"prepublishOnly": "npm run build && npm run tests-only",
12-
"pretest": "bower install",
1312
"build": "rollup --config",
1413
"test": "npm run lint && npm run eslint && npm run tests-only",
15-
"test-ci": "npm run pretest && npm run build && npm run lint && npm run eslint && npm run tests-only-ci",
14+
"test-ci": "npm run build && npm run lint && npm run eslint && npm run tests-only-ci",
1615
"tests-only": "karma start --single-run",
17-
"tests-only-ci": "karma start --single-run --browsers PhantomJS",
16+
"tests-only-ci": "karma start --single-run --browsers ChromeHeadlessNoSandbox",
1817
"lint": "jshint test",
1918
"eslint": "eslint src/**/*.ts test",
2019
"test:server": "karma start --no-single-run"
@@ -27,28 +26,26 @@
2726
"registry": "https://registry.npmjs.org/"
2827
},
2928
"devDependencies": {
29+
"@rollup/plugin-commonjs": "^11.0.2",
30+
"@rollup/plugin-node-resolve": "^7.1.1",
31+
"rollup-plugin-typescript": "^1.0.0",
3032
"abortcontroller-polyfill": "^1.1.9",
31-
"bower": "^1.8.2",
32-
"coveralls": "^2.11.3",
33+
"coveralls": "^3.0.9",
3334
"es6-promise": "^4.0.5",
3435
"eslint": "^5.12.0",
3536
"jshint": "^2.8.0",
36-
"karma": "^1.7.0",
37-
"karma-chrome-launcher": "^2.2.0",
38-
"karma-coverage": "^1.1.1",
39-
"karma-phantomjs-launcher": "^1.0.4",
40-
"karma-qunit": "^2.1.0",
37+
"karma": "^4.4.1",
38+
"karma-chrome-launcher": "^3.1.0",
39+
"karma-coverage": "^2.0.1",
40+
"karma-jquery": "^0.2.4",
41+
"karma-qunit": "^4.0.0",
4142
"karma-sinon": "^1.0.5",
4243
"phantomjs": "^2.1.7",
4344
"qunit": "^2.6.1",
4445
"release-it": "^12.4.3",
4546
"release-it-lerna-changelog": "^1.0.3",
4647
"rollup": "^1.1.2",
47-
"rollup-plugin-commonjs": "^9.2.0",
48-
"rollup-plugin-multi-entry": "^2.1.0",
49-
"rollup-plugin-node-resolve": "^4.0.0",
50-
"rollup-plugin-typescript": "^1.0.0",
51-
"sinon": "^3.2.1",
48+
"sinon": "^9.0.0",
5249
"tslib": "^1.9.3",
5350
"typescript": "~3.1.1",
5451
"typescript-eslint-parser": "^21.0.2",

rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const commonjs = require('rollup-plugin-commonjs');
2-
const resolve = require('rollup-plugin-node-resolve');
1+
const commonjs = require('@rollup/plugin-commonjs');
2+
const resolve = require('@rollup/plugin-node-resolve');
33
const typescript = require('rollup-plugin-typescript');
44
const pkg = require('./package.json');
55
const fs = require('fs');

test/passthrough_test.js

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,6 @@ describe('passthrough requests', function(config) {
4444
});
4545
});
4646

47-
it('passthrough request calls jQuery v1 handler', function(assert) {
48-
var pretender = this.pretender;
49-
var done = assert.async();
50-
51-
var jQuery2 = jQuery.noConflict(true);
52-
pretender.get('/some/:route', pretender.passthrough);
53-
54-
assert.ok(/^1/.test(jQuery.fn.jquery));
55-
jQuery.ajax({
56-
url: '/some/path',
57-
error: function(xhr) {
58-
assert.equal(xhr.status, 404);
59-
var _jQuery = jQuery2;
60-
assert.ok(/^2/.test(_jQuery.fn.jquery));
61-
done();
62-
},
63-
});
64-
});
65-
6647
it(
6748
'asynchronous request with pass-through has timeout,' +
6849
'withCredentials and onprogress event',
@@ -343,7 +324,7 @@ describe('passthrough requests', function(config) {
343324
describe('the `.passthrough()` property', function () {
344325
it('allows a passthrough on an unhandledRequest', function(assert) {
345326
var done = assert.async();
346-
327+
347328
this.pretender.unhandledRequest = function(_verb, _path, request) {
348329
request.passthrough();
349330
};
@@ -377,18 +358,18 @@ describe('passthrough requests', function(config) {
377358
};
378359
}
379360
pretender._nativeXMLHttpRequest = testXHR;
380-
361+
381362
var xhr = new window.XMLHttpRequest();
382363
xhr.open('GET', '/some/path');
383-
364+
384365
this.pretender.unhandledRequest = function(_verb, _path, request) {
385366
var referencedXhr = request.passthrough();
386367
assert.ok(referencedXhr instanceof testXHR);
387368
done();
388369
};
389-
370+
390371
xhr.send();
391372
});
392-
373+
393374
});
394375
});

0 commit comments

Comments
 (0)