1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-02-21 07:29:37 +01:00

build: update jest dependencies

This commit is contained in:
Juan Picado @jotadeveloper 2018-01-15 23:03:43 +01:00 committed by juanpicado
parent 8b6b98a56a
commit ccb14a54df
6 changed files with 23 additions and 23 deletions

@ -8,6 +8,7 @@ module.exports = {
'node_modules', 'node_modules',
'fixtures' 'fixtures'
], ],
'testEnvironment': 'jest-environment-jsdom-global',
'testRegex': '(/test/unit.*\\.spec|test/functional.*\\.func|/test/webui/.*\\.spec)\\.js', 'testRegex': '(/test/unit.*\\.spec|test/functional.*\\.func|/test/webui/.*\\.spec)\\.js',
// 'testRegex': '(test/functional.*\\.func)\\.js' // 'testRegex': '(test/functional.*\\.func)\\.js'
'setupFiles': [ 'setupFiles': [

@ -48,12 +48,12 @@
"unix-crypt-td-js": "^1.0.0" "unix-crypt-td-js": "^1.0.0"
}, },
"devDependencies": { "devDependencies": {
"@verdaccio/types": "0.1.3", "@verdaccio/types": "^0.2.0",
"axios": "0.17.1", "axios": "0.17.1",
"babel-cli": "6.26.0", "babel-cli": "6.26.0",
"babel-core": "6.26.0", "babel-core": "6.26.0",
"babel-eslint": "8.2.1", "babel-eslint": "8.2.1",
"babel-jest": "^21.2.0", "babel-jest": "^22.0.6",
"babel-loader": "7.1.2", "babel-loader": "7.1.2",
"babel-plugin-flow-runtime": "0.15.0", "babel-plugin-flow-runtime": "0.15.0",
"babel-plugin-transform-async-to-generator": "^6.24.1", "babel-plugin-transform-async-to-generator": "^6.24.1",
@ -96,7 +96,8 @@
"html-webpack-plugin": "2.30.1", "html-webpack-plugin": "2.30.1",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"in-publish": "2.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", "localstorage-memory": "1.0.2",
"node-sass": "4.7.2", "node-sass": "4.7.2",
"normalize.css": "7.0.0", "normalize.css": "7.0.0",
@ -104,7 +105,7 @@
"prop-types": "15.6.0", "prop-types": "15.6.0",
"react": "16.2.0", "react": "16.2.0",
"react-dom": "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-router-dom": "4.2.2",
"react-syntax-highlighter": "5.8.0", "react-syntax-highlighter": "5.8.0",
"rimraf": "2.6.2", "rimraf": "2.6.2",

@ -34,6 +34,11 @@ import type {
IPackageStorage, IPackageStorage,
} from '@verdaccio/local-storage'; } from '@verdaccio/local-storage';
import type {
IUploadTarball,
IReadTarball,
} from '@verdaccio/streams';
/** /**
* Implements Storage interface (same for storage.js, local-storage.js, up-storage.js). * Implements Storage interface (same for storage.js, local-storage.js, up-storage.js).
*/ */
@ -403,7 +408,7 @@ class LocalStorage implements IStorage {
let length = 0; let length = 0;
const shaOneHash = Crypto.createHash('sha1'); const shaOneHash = Crypto.createHash('sha1');
const uploadStream = new UploadTarball(); const uploadStream: IUploadTarball = new UploadTarball();
const _transform = uploadStream._transform; const _transform = uploadStream._transform;
const storage = this._getLocalStorage(name); const storage = this._getLocalStorage(name);
@ -431,7 +436,7 @@ class LocalStorage implements IStorage {
return uploadStream; return uploadStream;
} }
const writeStream = storage.writeTarball(filename); const writeStream: IUploadTarball = storage.writeTarball(filename);
writeStream.on('error', (err) => { writeStream.on('error', (err) => {
if (err.code === fileExist) { if (err.code === fileExist) {
@ -512,7 +517,7 @@ class LocalStorage implements IStorage {
* @return {ReadTarball} * @return {ReadTarball}
*/ */
_createFailureStreamResponse() { _createFailureStreamResponse() {
const stream = new ReadTarball(); const stream: IReadTarball = new ReadTarball();
process.nextTick(() => { process.nextTick(() => {
stream.emit('error', this._getFileNotAvailable()); stream.emit('error', this._getFileNotAvailable());
@ -528,7 +533,7 @@ class LocalStorage implements IStorage {
* @return {ReadTarball} * @return {ReadTarball}
*/ */
_streamSuccessReadTarBall(storage: any, filename: string) { _streamSuccessReadTarBall(storage: any, filename: string) {
const stream = new ReadTarball(); const stream: IReadTarball = new ReadTarball();
const readTarballStream = storage.readTarball(filename); const readTarballStream = storage.readTarball(filename);
const e404 = Utils.ErrorCode.get404; const e404 = Utils.ErrorCode.get404;

@ -7,6 +7,9 @@
"mocha": true, "mocha": true,
"es6": true "es6": true
}, },
"globals": {
"jsdom": true
},
"rules": { "rules": {
"valid-jsdoc": 0, "valid-jsdoc": 0,
"no-redeclare": 1, "no-redeclare": 1,

@ -7,19 +7,10 @@ import SyntaxHighlighter from 'react-syntax-highlighter/dist/light';
import Help from '../../../src/webui/src/components/Help'; import Help from '../../../src/webui/src/components/Help';
describe('<Help /> component', () => { describe('<Help /> 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', () => { it('should set html from props with / base path', () => {
Object.defineProperty(window.location, 'pathname', { jsdom.reconfigure({
writable: true, url: "http://example.com/"
value: '/'
}); });
const wrapper = shallow(<Help />); const wrapper = shallow(<Help />);
expect( expect(
@ -33,9 +24,8 @@ describe('<Help /> component', () => {
}); });
it('should set html from props with someOtherPath', () => { it('should set html from props with someOtherPath', () => {
Object.defineProperty(window.location, 'pathname', { jsdom.reconfigure({
writable: true, url: "http://example.com/someOtherPath"
value: '/someOtherPath'
}); });
const wrapper = shallow(<Help />); const wrapper = shallow(<Help />);
expect( expect(

BIN
yarn.lock

Binary file not shown.