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 470 additions and 343 deletions

View File

@ -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': [

View File

@ -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",

View File

@ -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;

View File

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

View File

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

767
yarn.lock

File diff suppressed because it is too large Load Diff