From ccb14a54dfb0feac349139da7356d1741966d25c Mon Sep 17 00:00:00 2001 From: "Juan Picado @jotadeveloper" Date: Mon, 15 Jan 2018 23:03:43 +0100 Subject: [PATCH] build: update jest dependencies --- jest.config.js | 1 + package.json | 9 +++++---- src/lib/local-storage.js | 13 +++++++++---- test/.eslintrc | 3 +++ test/webui/components/help.spec.js | 20 +++++--------------- yarn.lock | Bin 306595 -> 311282 bytes 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/jest.config.js b/jest.config.js index ccb35e9df..6405c2ddd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,6 +8,7 @@ module.exports = { 'node_modules', 'fixtures' ], + 'testEnvironment': 'jest-environment-jsdom-global', 'testRegex': '(/test/unit.*\\.spec|test/functional.*\\.func|/test/webui/.*\\.spec)\\.js', // 'testRegex': '(test/functional.*\\.func)\\.js' 'setupFiles': [ diff --git a/package.json b/package.json index af2be7af3..197fad7ea 100644 --- a/package.json +++ b/package.json @@ -48,12 +48,12 @@ "unix-crypt-td-js": "^1.0.0" }, "devDependencies": { - "@verdaccio/types": "0.1.3", + "@verdaccio/types": "^0.2.0", "axios": "0.17.1", "babel-cli": "6.26.0", "babel-core": "6.26.0", "babel-eslint": "8.2.1", - "babel-jest": "^21.2.0", + "babel-jest": "^22.0.6", "babel-loader": "7.1.2", "babel-plugin-flow-runtime": "0.15.0", "babel-plugin-transform-async-to-generator": "^6.24.1", @@ -96,7 +96,8 @@ "html-webpack-plugin": "2.30.1", "identity-obj-proxy": "^3.0.0", "in-publish": "2.0.0", - "jest": "^21.2.1", + "jest": "22.0.6", + "jest-environment-jsdom-global": "1.0.2", "localstorage-memory": "1.0.2", "node-sass": "4.7.2", "normalize.css": "7.0.0", @@ -104,7 +105,7 @@ "prop-types": "15.6.0", "react": "16.2.0", "react-dom": "16.2.0", - "react-hot-loader": "3.0.0-beta.7", + "react-hot-loader": "4.0.0-beta.14", "react-router-dom": "4.2.2", "react-syntax-highlighter": "5.8.0", "rimraf": "2.6.2", diff --git a/src/lib/local-storage.js b/src/lib/local-storage.js index f5917180d..ae79469ca 100644 --- a/src/lib/local-storage.js +++ b/src/lib/local-storage.js @@ -34,6 +34,11 @@ import type { IPackageStorage, } from '@verdaccio/local-storage'; +import type { + IUploadTarball, + IReadTarball, +} from '@verdaccio/streams'; + /** * Implements Storage interface (same for storage.js, local-storage.js, up-storage.js). */ @@ -403,7 +408,7 @@ class LocalStorage implements IStorage { let length = 0; const shaOneHash = Crypto.createHash('sha1'); - const uploadStream = new UploadTarball(); + const uploadStream: IUploadTarball = new UploadTarball(); const _transform = uploadStream._transform; const storage = this._getLocalStorage(name); @@ -431,7 +436,7 @@ class LocalStorage implements IStorage { return uploadStream; } - const writeStream = storage.writeTarball(filename); + const writeStream: IUploadTarball = storage.writeTarball(filename); writeStream.on('error', (err) => { if (err.code === fileExist) { @@ -512,7 +517,7 @@ class LocalStorage implements IStorage { * @return {ReadTarball} */ _createFailureStreamResponse() { - const stream = new ReadTarball(); + const stream: IReadTarball = new ReadTarball(); process.nextTick(() => { stream.emit('error', this._getFileNotAvailable()); @@ -528,7 +533,7 @@ class LocalStorage implements IStorage { * @return {ReadTarball} */ _streamSuccessReadTarBall(storage: any, filename: string) { - const stream = new ReadTarball(); + const stream: IReadTarball = new ReadTarball(); const readTarballStream = storage.readTarball(filename); const e404 = Utils.ErrorCode.get404; diff --git a/test/.eslintrc b/test/.eslintrc index 163cd741c..0cb9dbe6a 100644 --- a/test/.eslintrc +++ b/test/.eslintrc @@ -7,6 +7,9 @@ "mocha": true, "es6": true }, + "globals": { + "jsdom": true + }, "rules": { "valid-jsdoc": 0, "no-redeclare": 1, diff --git a/test/webui/components/help.spec.js b/test/webui/components/help.spec.js index 852273319..704c61132 100644 --- a/test/webui/components/help.spec.js +++ b/test/webui/components/help.spec.js @@ -7,19 +7,10 @@ import SyntaxHighlighter from 'react-syntax-highlighter/dist/light'; import Help from '../../../src/webui/src/components/Help'; describe(' component', () => { - beforeEach(() => { - /** - * @see https://github.com/facebook/jest/issues/890 - */ - Object.defineProperty(window.location, 'origin', { - writable: true, - value: 'http://example.com' - }); - }); + it('should set html from props with / base path', () => { - Object.defineProperty(window.location, 'pathname', { - writable: true, - value: '/' + jsdom.reconfigure({ + url: "http://example.com/" }); const wrapper = shallow(); expect( @@ -33,9 +24,8 @@ describe(' component', () => { }); it('should set html from props with someOtherPath', () => { - Object.defineProperty(window.location, 'pathname', { - writable: true, - value: '/someOtherPath' + jsdom.reconfigure({ + url: "http://example.com/someOtherPath" }); const wrapper = shallow(); expect( diff --git a/yarn.lock b/yarn.lock index d6ee9ce79196597f03737fbcbb4ebd5255908b04..306fb4478cfd597e1d7d6b4cbced2c84de066751 100644 GIT binary patch delta 9973 zcmb7K3v?aDc|JS4l59OKTef6bwj~2L2wiDs_Dz8L0TfPX$|He58spjBSz91WLigIn z1TcmGCJ_8s@Hi*Lj}Q`4($qwx+q5NthNL+sA>g#6IZb)Bp`{HChMcq~4?@4$y)yUu zfZZA&eDChwotc0B|NFoH`{$vb&VB2hxraAu3!{lxl#(gFQLJ3+4V%MeDHIhxY&mJC z(JNoMR2xh`)YP>5sZ&edaAp0Cr?8mQIJQC>I$oH>f_t79$C2gvapFZWWr?s&>d99c zv>s{xh_p;Q+RKevARqfRDWz*>&11o^g>lroEKXSv#oUW*;lv5E&A>C6%UnNTQD}#O z>)37_JJUO6wdzf4&0#idE=%7T{y=KBw4^V$%rS8xe^ZEoc@Ud%;#(}F%yN9kvuR|; z!nP92rHNJxl5@Y;#jfe(SW&TzygQGG)Vb}d(xd=dm|gBbeN{U@t2Z- zrcZf)DElY$2F;cIAJb2p{&Wy8U7^O`!|cJ^612P z|1u`2M~2h>s~c1Qs(CQl%xb-a3pa5cCrJ|FdBUeY_ao-Je&jhex0&r)Nh}XFYdz`V z&$gupuWG{zo%HZki*&qY`iEC-G1P_W3)l8(^WJx0bFwY{=Ht!j-(1s2-yJ-n43>>O z-}hqA`BLYW4eEA_O!X~$mJ&*rzySY@&1|xC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