Skip to content

Commit

Permalink
Merge pull request #294 from xg-wang/dep
Browse files Browse the repository at this point in the history
Upgrade devDependencies and CI
  • Loading branch information
xg-wang authored Feb 26, 2020
2 parents 50017f6 + 4af5a86 commit 6497376
Show file tree
Hide file tree
Showing 7 changed files with 1,051 additions and 1,963 deletions.
18 changes: 4 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
sudo: false
language: node_js
node_js:
- "12"

before_install:
- "npm config set spin false"
# if npm version is less than 3.0.0, upgrade to 3
- if [[ $(npm -v | cut -d '.' -f 1) -lt 3 ]]; then npm i -g npm@^3; fi
- "npm config set spin false"

script: npm run test-ci
install:
- node --version
- npm --version
- git --version
- npm install
addons:
chrome: stable

script: yarn run test-ci

after_script:
- find ./coverage/Phantom* -name "lcov.info" -exec cat {} \; | coveralls
- find ./coverage/HeadlessChrome* -name "lcov.info" -exec cat {} \; | coveralls
2 changes: 0 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@
"route-recognizer": "^0.2.3"
},
"devDependencies": {
"jquery": "~2.1.0",
"jquery-1": "https://code.jquery.com/jquery-1.11.3.min.js"
}
}
23 changes: 11 additions & 12 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,23 @@ module.exports = function(config) {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

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

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['qunit', 'sinon'],

frameworks: ['qunit', 'sinon', 'jquery-3.4.0'],

// list of files / patterns to load in the browser
files: [
'node_modules/fake-xml-http-request/fake_xml_http_request.js',
'node_modules/route-recognizer/dist/route-recognizer.js',
'bower_components/jquery-1/index.js',
'bower_components/jquery/dist/jquery.js',
'node_modules/es6-promise/dist/es6-promise.auto.js',
'node_modules/abortcontroller-polyfill/dist/abortcontroller-polyfill-only.js',
'node_modules/whatwg-fetch/dist/fetch.umd.js',
'dist/pretender.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: {
Expand Down Expand Up @@ -69,8 +61,15 @@ module.exports = function(config) {

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome', 'PhantomJS'],

browsers: ['Chrome', 'ChromeHeadless', 'ChromeHeadlessNoSandbox'],

// you can define custom flags
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
Expand Down
27 changes: 12 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
"scripts": {
"release": "release-it",
"prepublishOnly": "npm run build && npm run tests-only",
"pretest": "bower install",
"build": "rollup --config",
"test": "npm run lint && npm run eslint && npm run tests-only",
"test-ci": "npm run pretest && npm run build && npm run lint && npm run eslint && npm run tests-only-ci",
"test-ci": "npm run build && npm run lint && npm run eslint && npm run tests-only-ci",
"tests-only": "karma start --single-run",
"tests-only-ci": "karma start --single-run --browsers PhantomJS",
"tests-only-ci": "karma start --single-run --browsers ChromeHeadlessNoSandbox",
"lint": "jshint test",
"eslint": "eslint src/**/*.ts test",
"test:server": "karma start --no-single-run"
Expand All @@ -27,28 +26,26 @@
"registry": "https://registry.npmjs.org/"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"rollup-plugin-typescript": "^1.0.0",
"abortcontroller-polyfill": "^1.1.9",
"bower": "^1.8.2",
"coveralls": "^2.11.3",
"coveralls": "^3.0.9",
"es6-promise": "^4.0.5",
"eslint": "^5.12.0",
"jshint": "^2.8.0",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
"karma-phantomjs-launcher": "^1.0.4",
"karma-qunit": "^2.1.0",
"karma": "^4.4.1",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.0.1",
"karma-jquery": "^0.2.4",
"karma-qunit": "^4.0.0",
"karma-sinon": "^1.0.5",
"phantomjs": "^2.1.7",
"qunit": "^2.6.1",
"release-it": "^12.4.3",
"release-it-lerna-changelog": "^1.0.3",
"rollup": "^1.1.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-multi-entry": "^2.1.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-typescript": "^1.0.0",
"sinon": "^3.2.1",
"sinon": "^9.0.0",
"tslib": "^1.9.3",
"typescript": "~3.1.1",
"typescript-eslint-parser": "^21.0.2",
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const commonjs = require('rollup-plugin-commonjs');
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const resolve = require('@rollup/plugin-node-resolve');
const typescript = require('rollup-plugin-typescript');
const pkg = require('./package.json');
const fs = require('fs');
Expand Down
29 changes: 5 additions & 24 deletions test/passthrough_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,6 @@ describe('passthrough requests', function(config) {
});
});

it('passthrough request calls jQuery v1 handler', function(assert) {
var pretender = this.pretender;
var done = assert.async();

var jQuery2 = jQuery.noConflict(true);
pretender.get('/some/:route', pretender.passthrough);

assert.ok(/^1/.test(jQuery.fn.jquery));
jQuery.ajax({
url: '/some/path',
error: function(xhr) {
assert.equal(xhr.status, 404);
var _jQuery = jQuery2;
assert.ok(/^2/.test(_jQuery.fn.jquery));
done();
},
});
});

it(
'asynchronous request with pass-through has timeout,' +
'withCredentials and onprogress event',
Expand Down Expand Up @@ -343,7 +324,7 @@ describe('passthrough requests', function(config) {
describe('the `.passthrough()` property', function () {
it('allows a passthrough on an unhandledRequest', function(assert) {
var done = assert.async();

this.pretender.unhandledRequest = function(_verb, _path, request) {
request.passthrough();
};
Expand Down Expand Up @@ -377,18 +358,18 @@ describe('passthrough requests', function(config) {
};
}
pretender._nativeXMLHttpRequest = testXHR;

var xhr = new window.XMLHttpRequest();
xhr.open('GET', '/some/path');

this.pretender.unhandledRequest = function(_verb, _path, request) {
var referencedXhr = request.passthrough();
assert.ok(referencedXhr instanceof testXHR);
done();
};

xhr.send();
});

});
});
Loading

0 comments on commit 6497376

Please sign in to comment.