From 33e282253914ed8853346ae9b7ddd3a74c520f32 Mon Sep 17 00:00:00 2001 From: Sune Broendum Woeller Date: Wed, 19 Sep 2018 22:23:25 +0200 Subject: [PATCH] It seems sinon is used by the docs, and need to be runable in the browser. Revert "Move installation and config of sinon from bower+requirejs to karma-sinon. Sinon is a testing tool and don't belong in our main module requirements. Keep all dev-dependencies in package.json" This reverts commit 22099dc49aed9773b696b9e5d0104b8401b6a990. --- bower.json | 3 +- mockup/.jshintrc | 3 +- mockup/js/config.js | 2 + mockup/js/grunt.js | 10 +---- mockup/tests/fakeserver.js | 3 +- mockup/tests/i18n-test.js | 5 ++- mockup/tests/pattern-contentloader-test.js | 5 ++- mockup/tests/pattern-cookietrigger-test.js | 9 ++-- mockup/tests/pattern-filemanager-test.js | 3 +- mockup/tests/pattern-inlinevalidation-test.js | 3 +- mockup/tests/pattern-livesearch-test.js | 5 ++- mockup/tests/pattern-modal-test.js | 3 +- mockup/tests/pattern-pickadate-test.js | 3 +- mockup/tests/pattern-relateditems-test.js | 3 +- mockup/tests/pattern-resourceregistry-test.js | 5 ++- mockup/tests/pattern-select2-test.js | 3 +- mockup/tests/pattern-structure-test.js | 3 +- mockup/tests/pattern-thememapper-test.js | 3 +- mockup/tests/pattern-tinymce-test.js | 3 +- mockup/tests/pattern-toggle-test.js | 5 ++- mockup/tests/utils-test.js | 2 +- package-lock.json | 42 ------------------- package.json | 3 +- 23 files changed, 49 insertions(+), 80 deletions(-) diff --git a/bower.json b/bower.json index 4819a2de9..07da0f87e 100644 --- a/bower.json +++ b/bower.json @@ -50,7 +50,8 @@ "cs-jqtree-contextmenu": "^0.1.0" }, "devDependencies": { - "expect": "0.3.1" + "expect": "0.3.1", + "sinonjs": "1.17.1" }, "resolutions": { "bootstrap": "3.3.6", diff --git a/mockup/.jshintrc b/mockup/.jshintrc index df08f23fc..86ea3b803 100644 --- a/mockup/.jshintrc +++ b/mockup/.jshintrc @@ -26,7 +26,6 @@ "require": false, "requirejs": true, "tinymce": true, - "window": false, - "sinon": true + "window": false } } diff --git a/mockup/js/config.js b/mockup/js/config.js index 86252d617..c71ef8dba 100644 --- a/mockup/js/config.js +++ b/mockup/js/config.js @@ -134,6 +134,7 @@ 'picker.time': 'bower_components/pickadate/lib/picker.time', 'react': 'bower_components/react/react', 'select2': 'bower_components/select2/select2', + 'sinon': 'bower_components/sinonjs/sinon', 'text': 'bower_components/requirejs-text/text', 'tinymce': 'bower_components/tinymce-builded/js/tinymce/tinymce', 'tinymce-modern-theme': 'bower_components/tinymce-builded/js/tinymce/themes/modern/theme', @@ -167,6 +168,7 @@ 'jquery.event.drop': { deps: ['jquery'], exports: '$.drop' }, 'picker.date': { deps: [ 'picker' ] }, 'picker.time': { deps: [ 'picker' ] }, + 'sinon': { exports: 'window.sinon' }, 'tinymce': { exports: 'window.tinyMCE', init: function () { diff --git a/mockup/js/grunt.js b/mockup/js/grunt.js index e8a56ccf9..e72012f91 100644 --- a/mockup/js/grunt.js +++ b/mockup/js/grunt.js @@ -437,7 +437,7 @@ karma: { options: { basePath: './', - frameworks: ['mocha', 'sinon'], + frameworks: ['mocha'], files: this.files.concat([ { pattern: @@ -461,7 +461,6 @@ browsers: ['PhantomJS'], plugins: [ 'karma-mocha', - 'karma-sinon', 'karma-requirejs', 'karma-phantomjs-launcher', 'karma-spec-reporter' @@ -479,7 +478,6 @@ browsers: ['PhantomJS'], plugins: [ 'karma-mocha', - 'karma-sinon', 'karma-coverage', 'karma-requirejs', 'karma-phantomjs-launcher', @@ -498,7 +496,6 @@ }, plugins: [ 'karma-mocha', - 'karma-sinon', 'karma-requirejs', 'karma-phantomjs-launcher', 'karma-junit-reporter', @@ -517,7 +514,6 @@ // }, plugins: [ 'karma-mocha', - 'karma-sinon', 'karma-requirejs', 'karma-chrome-launcher', 'karma-spec-reporter' @@ -535,7 +531,6 @@ // }, plugins: [ 'karma-mocha', - 'karma-sinon', 'karma-requirejs', 'karma-firefox-launcher', 'karma-spec-reporter' @@ -543,7 +538,7 @@ }, testServe: { reporters: ['dots', 'progress'], - plugins: ['karma-mocha', 'karma-sinon', 'karma-requirejs'] + plugins: ['karma-mocha', 'karma-requirejs'] }, testCI: { singleRun: true, @@ -557,7 +552,6 @@ browsers: BROWSERS, plugins: [ 'karma-mocha', - 'karma-sinon', 'karma-coverage', 'karma-requirejs', 'karma-sauce-launcher', diff --git a/mockup/tests/fakeserver.js b/mockup/tests/fakeserver.js index b26f926da..296e575fd 100644 --- a/mockup/tests/fakeserver.js +++ b/mockup/tests/fakeserver.js @@ -1,7 +1,8 @@ define([ + 'sinon', 'jquery', 'underscore' -], function($, _) { +], function(sinon, $, _) { 'use strict'; function getQueryVariable(url, variable) { diff --git a/mockup/tests/i18n-test.js b/mockup/tests/i18n-test.js index 365842a58..392e6a40e 100644 --- a/mockup/tests/i18n-test.js +++ b/mockup/tests/i18n-test.js @@ -1,8 +1,9 @@ define([ 'expect', 'jquery', - 'mockup-i18n' -], function(expect, $, I18n) { + 'mockup-i18n', + 'sinon' +], function(expect, $, I18n, sinon) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-contentloader-test.js b/mockup/tests/pattern-contentloader-test.js index fd66e36b7..0c38eab6a 100644 --- a/mockup/tests/pattern-contentloader-test.js +++ b/mockup/tests/pattern-contentloader-test.js @@ -1,16 +1,17 @@ define([ 'expect', 'jquery', + 'sinon', 'pat-registry', 'mockup-patterns-contentloader' -], function(expect, $, registry, ContentLoader) { +], function(expect, $, sinon, registry, ContentLoader) { 'use strict'; window.mocha.setup('bdd'); $.fx.off = true; /* ========================== - TEST: Livesearch + TEST: Livesearch ========================== */ describe('Livesearch', function() { diff --git a/mockup/tests/pattern-cookietrigger-test.js b/mockup/tests/pattern-cookietrigger-test.js index 5d3952fb8..3c7d5eb13 100644 --- a/mockup/tests/pattern-cookietrigger-test.js +++ b/mockup/tests/pattern-cookietrigger-test.js @@ -1,16 +1,17 @@ define([ 'expect', 'jquery', + 'sinon', 'pat-registry', 'mockup-patterns-cookietrigger' -], function(expect, $, registry, Pattern) { +], function(expect, $, sinon, registry, Pattern) { 'use strict'; window.mocha.setup('bdd'); $.fx.off = true; /* ==================== - TEST: Cookie Trigger + TEST: Cookie Trigger ==================== */ describe('Cookie Trigger', function () { @@ -19,7 +20,7 @@ define([ }); it('The .pat-cookietrigger DOM element is shown if cookies are disabled', function() { - var widget = + var widget = '
' + ' Cookies are not enabled. You must enable cookies before you can log in.' + '
'; @@ -32,7 +33,7 @@ define([ }); it('The .pat-cookietrigger DOM element is hidden if cookies are enabled', function() { - var widget = + var widget = '
' + ' Cookies are not enabled. You must enable cookies before you can log in.' + '
'; diff --git a/mockup/tests/pattern-filemanager-test.js b/mockup/tests/pattern-filemanager-test.js index 1bf3fb3ea..ee5d3ded4 100644 --- a/mockup/tests/pattern-filemanager-test.js +++ b/mockup/tests/pattern-filemanager-test.js @@ -1,9 +1,10 @@ define([ + 'sinon', 'expect', 'jquery', 'pat-registry', 'mockup-patterns-filemanager' -], function(expect, $, registry, Tree) { +], function(sinon, expect, $, registry, Tree) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-inlinevalidation-test.js b/mockup/tests/pattern-inlinevalidation-test.js index 79433236c..c4f425c96 100644 --- a/mockup/tests/pattern-inlinevalidation-test.js +++ b/mockup/tests/pattern-inlinevalidation-test.js @@ -1,9 +1,10 @@ define([ 'expect', 'jquery', + 'sinon', 'pat-registry', 'mockup-patterns-inlinevalidation' -], function(expect, $, registry, Pattern) { +], function(expect, $, sinon, registry, Pattern) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-livesearch-test.js b/mockup/tests/pattern-livesearch-test.js index 4a82e60fa..0a69950b2 100644 --- a/mockup/tests/pattern-livesearch-test.js +++ b/mockup/tests/pattern-livesearch-test.js @@ -1,16 +1,17 @@ define([ 'expect', 'jquery', + 'sinon', 'pat-registry', 'mockup-patterns-livesearch' -], function(expect, $, registry, Livesearch) { +], function(expect, $, sinon, registry, Livesearch) { 'use strict'; window.mocha.setup('bdd'); $.fx.off = true; /* ========================== - TEST: Livesearch + TEST: Livesearch ========================== */ describe('Livesearch', function() { diff --git a/mockup/tests/pattern-modal-test.js b/mockup/tests/pattern-modal-test.js index ec42bd603..c14c53c8f 100644 --- a/mockup/tests/pattern-modal-test.js +++ b/mockup/tests/pattern-modal-test.js @@ -1,9 +1,10 @@ define([ 'expect', 'jquery', + 'sinon', 'pat-registry', 'mockup-patterns-modal' -], function(expect, $, registry, Modal) { +], function(expect, $, sinon, registry, Modal) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-pickadate-test.js b/mockup/tests/pattern-pickadate-test.js index 17ba1302a..1b35b0c4f 100644 --- a/mockup/tests/pattern-pickadate-test.js +++ b/mockup/tests/pattern-pickadate-test.js @@ -2,10 +2,11 @@ define([ 'expect', 'jquery', + 'sinon', 'pat-registry', 'mockup-patterns-pickadate', 'mockup-patterns-select2' -], function(expect, $, registry, PickADate) { +], function(expect, $, sinon, registry, PickADate) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-relateditems-test.js b/mockup/tests/pattern-relateditems-test.js index 9ec5ca462..1563b029c 100644 --- a/mockup/tests/pattern-relateditems-test.js +++ b/mockup/tests/pattern-relateditems-test.js @@ -2,9 +2,10 @@ define([ 'expect', 'jquery', 'underscore', + 'sinon', 'pat-registry', 'mockup-patterns-relateditems' -], function(expect, $, _, registry, RelatedItems) { +], function(expect, $, _, sinon, registry, RelatedItems) { 'use strict'; window.mocha.setup('bdd').globals(['jQuery*']); diff --git a/mockup/tests/pattern-resourceregistry-test.js b/mockup/tests/pattern-resourceregistry-test.js index 9eb0e002a..6c99c51d9 100644 --- a/mockup/tests/pattern-resourceregistry-test.js +++ b/mockup/tests/pattern-resourceregistry-test.js @@ -1,9 +1,10 @@ define([ + 'sinon', 'expect', 'jquery', 'pat-registry', 'mockup-patterns-resourceregistry' -], function(expect, $, registry, ResourceRegistry) { +], function(sinon, expect, $, registry, ResourceRegistry) { 'use strict'; window.mocha.setup('bdd'); @@ -139,4 +140,4 @@ define([ }); -}); +}); \ No newline at end of file diff --git a/mockup/tests/pattern-select2-test.js b/mockup/tests/pattern-select2-test.js index 7a846ed20..730ce32e2 100644 --- a/mockup/tests/pattern-select2-test.js +++ b/mockup/tests/pattern-select2-test.js @@ -1,9 +1,10 @@ define([ 'expect', 'jquery', + 'sinon', 'pat-registry', 'mockup-patterns-select2' -], function(expect, $, registry, Select2) { +], function(expect, $, sinon, registry, Select2) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-structure-test.js b/mockup/tests/pattern-structure-test.js index 3076b0130..8fb103f2c 100644 --- a/mockup/tests/pattern-structure-test.js +++ b/mockup/tests/pattern-structure-test.js @@ -13,9 +13,10 @@ define([ 'mockup-patterns-structure-url/js/views/generic-popover', 'mockup-patterns-structure-url/js/collections/result', 'mockup-utils', + 'sinon', 'moment' ], function(expect, $, _, registry, ButtonView, Structure, ActionMenuView, AppView, Result, - TableView, TableRowView, PropertiesView, ResultCollection, utils, moment) { + TableView, TableRowView, PropertiesView, ResultCollection, utils, sinon, moment) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-thememapper-test.js b/mockup/tests/pattern-thememapper-test.js index 84d70801f..f7362f7c4 100644 --- a/mockup/tests/pattern-thememapper-test.js +++ b/mockup/tests/pattern-thememapper-test.js @@ -1,9 +1,10 @@ define([ 'expect', + 'sinon', 'jquery', 'pat-registry', 'mockup-patterns-thememapper', -], function(expect, $, registry, RuleBuilderView ) { +], function(expect, sinon, $, registry, RuleBuilderView ) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-tinymce-test.js b/mockup/tests/pattern-tinymce-test.js index f8ae4eec2..7a7ebc43d 100644 --- a/mockup/tests/pattern-tinymce-test.js +++ b/mockup/tests/pattern-tinymce-test.js @@ -1,10 +1,11 @@ define([ 'expect', 'jquery', + 'sinon', 'pat-registry', 'tinymce', 'mockup-patterns-tinymce' -], function(expect, $, registry, tinymce, TinyMCE) { +], function(expect, $, sinon, registry, tinymce, TinyMCE) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/pattern-toggle-test.js b/mockup/tests/pattern-toggle-test.js index a09123110..ef0b50b91 100644 --- a/mockup/tests/pattern-toggle-test.js +++ b/mockup/tests/pattern-toggle-test.js @@ -3,8 +3,9 @@ define([ 'jquery', 'pat-registry', 'pat-logger', - 'mockup-patterns-toggle' -], function(expect, $, registry, logger, Toggle) { + 'mockup-patterns-toggle', + 'sinon', +], function(expect, $, registry, logger, Toggle, sinon) { 'use strict'; window.mocha.setup('bdd'); diff --git a/mockup/tests/utils-test.js b/mockup/tests/utils-test.js index e04b23445..0c3ed7611 100644 --- a/mockup/tests/utils-test.js +++ b/mockup/tests/utils-test.js @@ -97,7 +97,7 @@ define([ expect(utils.bool(13)).to.be.equal(true); expect(utils.bool('foo')).to.be.equal(true); }); - + it('returns false for falsy values', function() { expect(utils.bool('false')).to.be.equal(false); expect(utils.bool(' false ')).to.be.equal(false); diff --git a/package-lock.json b/package-lock.json index 0dfcaac8f..15ac959de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2163,15 +2163,6 @@ "mime-types": "^2.1.12" } }, - "formatio": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/formatio/-/formatio-1.1.1.tgz", - "integrity": "sha1-XtPM1jZVEJc4NGXZlhmRAOhhYek=", - "dev": true, - "requires": { - "samsam": "~1.1" - } - }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -4937,12 +4928,6 @@ } } }, - "lolex": { - "version": "1.3.2", - "resolved": "http://registry.npmjs.org/lolex/-/lolex-1.3.2.tgz", - "integrity": "sha1-fD2mL/yzDw9agKJWbKJORdigHzE=", - "dev": true - }, "loud-rejection": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", @@ -6425,12 +6410,6 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, - "samsam": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/samsam/-/samsam-1.1.2.tgz", - "integrity": "sha1-vsEf3IOp/aBjQBIQ5AF2wwJNFWc=", - "dev": true - }, "sauce-connect-launcher": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sauce-connect-launcher/-/sauce-connect-launcher-1.2.4.tgz", @@ -6506,18 +6485,6 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, - "sinon": { - "version": "1.17.1", - "resolved": "http://registry.npmjs.org/sinon/-/sinon-1.17.1.tgz", - "integrity": "sha1-zfg3SFyQFN4XYmj0beYb0kYCw90=", - "dev": true, - "requires": { - "formatio": "1.1.1", - "lolex": "1.3.2", - "samsam": "1.1.2", - "util": ">=0.10.3 <1" - } - }, "snapdragon": { "version": "0.8.2", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", @@ -7506,15 +7473,6 @@ } } }, - "util": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/util/-/util-0.11.0.tgz", - "integrity": "sha512-5n12uMzKCjvB2HPFHnbQSjaqAa98L5iIXmHrZCLavuZVe0qe/SJGbDGWlpaHk5lnBkWRDO+dRu1/PgmUYKPPTw==", - "dev": true, - "requires": { - "inherits": "2.0.3" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index 1cce30b47..0c57747af 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,7 @@ "minimatch": "^3.0.4", "mocha": "~3.5.3", "phantomjs-prebuilt": "~2.1.16", - "requirejs": "~2.2.0", - "sinon": "1.17.1" + "requirejs": "~2.2.0" }, "maintainers": [ {