Move sinon to karma framework
This frees us from manual imports, and makes things less magical as those aren't ES modules even if the code suggest that the are.
This commit is contained in:
parent
885363a373
commit
ae2e1ff7bd
|
@ -53,12 +53,10 @@ module.exports = (config) => {
|
||||||
|
|
||||||
// frameworks to use
|
// frameworks to use
|
||||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||||
frameworks: ['requirejs', 'mocha', 'chai'],
|
frameworks: ['requirejs', 'mocha', 'sinon-chai'],
|
||||||
|
|
||||||
// list of files / patterns to load in the browser (loaded in order)
|
// list of files / patterns to load in the browser (loaded in order)
|
||||||
files: [
|
files: [
|
||||||
{ pattern: 'vendor/sinon.js', included: false },
|
|
||||||
{ pattern: 'node_modules/sinon-chai/lib/sinon-chai.js', included: false },
|
|
||||||
{ pattern: 'app/localization.js', included: false },
|
{ pattern: 'app/localization.js', included: false },
|
||||||
{ pattern: 'app/webutil.js', included: false },
|
{ pattern: 'app/webutil.js', included: false },
|
||||||
{ pattern: 'core/**/*.js', included: false },
|
{ pattern: 'core/**/*.js', included: false },
|
||||||
|
|
|
@ -47,17 +47,18 @@
|
||||||
"jsdom": "*",
|
"jsdom": "*",
|
||||||
"karma": "^1.3.0",
|
"karma": "^1.3.0",
|
||||||
"karma-babel-preprocessor": "^6.0.1",
|
"karma-babel-preprocessor": "^6.0.1",
|
||||||
"karma-chai": "^0.1.0",
|
|
||||||
"karma-mocha": "^1.3.0",
|
"karma-mocha": "^1.3.0",
|
||||||
"karma-mocha-reporter": "^2.2.0",
|
"karma-mocha-reporter": "^2.2.0",
|
||||||
"karma-requirejs": "^1.1.0",
|
"karma-requirejs": "^1.1.0",
|
||||||
"karma-sauce-launcher": "^1.0.0",
|
"karma-sauce-launcher": "^1.0.0",
|
||||||
|
"karma-sinon-chai": "^2.0.0",
|
||||||
"mocha": "^3.1.2",
|
"mocha": "^3.1.2",
|
||||||
"node-getopt": "*",
|
"node-getopt": "*",
|
||||||
"po2json": "*",
|
"po2json": "*",
|
||||||
"requirejs": "^2.3.2",
|
"requirejs": "^2.3.2",
|
||||||
"rollup": "^0.41.4",
|
"rollup": "^0.41.4",
|
||||||
"rollup-plugin-node-resolve": "^2.0.0",
|
"rollup-plugin-node-resolve": "^2.0.0",
|
||||||
|
"sinon": "^4.0.0",
|
||||||
"sinon-chai": "^2.8.0"
|
"sinon-chai": "^2.8.0"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
"mocha": true
|
"mocha": true
|
||||||
},
|
},
|
||||||
"globals": {
|
"globals": {
|
||||||
"chai": true
|
"chai": false,
|
||||||
|
"sinon": false
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"prefer-arrow-callback": 0
|
"prefer-arrow-callback": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
// Assertions that make it easier to use sinon
|
|
||||||
import sinonChai from '../node_modules/sinon-chai/lib/sinon-chai.js';
|
|
||||||
chai.use(sinonChai);
|
|
||||||
|
|
||||||
// noVNC specific assertions
|
// noVNC specific assertions
|
||||||
chai.use(function (_chai, utils) {
|
chai.use(function (_chai, utils) {
|
||||||
_chai.Assertion.addMethod('displayed', function (target_data) {
|
_chai.Assertion.addMethod('displayed', function (target_data) {
|
||||||
|
|
|
@ -3,8 +3,6 @@ const expect = chai.expect;
|
||||||
import Base64 from '../core/base64.js';
|
import Base64 from '../core/base64.js';
|
||||||
import Display from '../core/display.js';
|
import Display from '../core/display.js';
|
||||||
|
|
||||||
import sinon from '../vendor/sinon.js';
|
|
||||||
|
|
||||||
describe('Display/Canvas Helper', function () {
|
describe('Display/Canvas Helper', function () {
|
||||||
const checked_data = new Uint8Array([
|
const checked_data = new Uint8Array([
|
||||||
0x00, 0x00, 0xff, 255, 0x00, 0x00, 0xff, 255, 0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255,
|
0x00, 0x00, 0xff, 255, 0x00, 0x00, 0xff, 255, 0x00, 0xff, 0x00, 255, 0x00, 0xff, 0x00, 255,
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|
||||||
import sinon from '../vendor/sinon.js';
|
|
||||||
|
|
||||||
import Keyboard from '../core/input/keyboard.js';
|
import Keyboard from '../core/input/keyboard.js';
|
||||||
import * as browser from '../core/util/browser.js';
|
import * as browser from '../core/util/browser.js';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|
||||||
import sinon from '../vendor/sinon.js';
|
|
||||||
|
|
||||||
import Mouse from '../core/input/mouse.js';
|
import Mouse from '../core/input/mouse.js';
|
||||||
import * as eventUtils from '../core/util/events.js';
|
import * as eventUtils from '../core/util/events.js';
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import Websock from '../core/websock.js';
|
||||||
import { encodings } from '../core/encodings.js';
|
import { encodings } from '../core/encodings.js';
|
||||||
|
|
||||||
import FakeWebSocket from './fake.websocket.js';
|
import FakeWebSocket from './fake.websocket.js';
|
||||||
import sinon from '../vendor/sinon.js';
|
|
||||||
|
|
||||||
/* UIEvent constructor polyfill for IE */
|
/* UIEvent constructor polyfill for IE */
|
||||||
(() => {
|
(() => {
|
||||||
|
|
|
@ -3,8 +3,6 @@ const expect = chai.expect;
|
||||||
|
|
||||||
import * as Log from '../core/util/logging.js';
|
import * as Log from '../core/util/logging.js';
|
||||||
|
|
||||||
import sinon from '../vendor/sinon.js';
|
|
||||||
|
|
||||||
describe('Utils', function() {
|
describe('Utils', function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@ const expect = chai.expect;
|
||||||
import Websock from '../core/websock.js';
|
import Websock from '../core/websock.js';
|
||||||
import FakeWebSocket from './fake.websocket.js';
|
import FakeWebSocket from './fake.websocket.js';
|
||||||
|
|
||||||
import sinon from '../vendor/sinon.js';
|
|
||||||
|
|
||||||
describe('Websock', function() {
|
describe('Websock', function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,6 @@ const expect = chai.expect;
|
||||||
|
|
||||||
import * as WebUtil from '../app/webutil.js';
|
import * as WebUtil from '../app/webutil.js';
|
||||||
|
|
||||||
import sinon from '../vendor/sinon.js';
|
|
||||||
|
|
||||||
describe('WebUtil', function() {
|
describe('WebUtil', function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue