Skip to content
Snippets Groups Projects
Commit 22c70cd2 authored by Lucendio's avatar Lucendio
Browse files

Upgrade versions

* NodeJS: v16
* NPM: v8
* Jest: v27
* Mongoose: v6

And fix some small issues along the way
parent 9bc3b3ea
No related branches found
No related tags found
No related merge requests found
......@@ -36,9 +36,9 @@ It is NOT recommended to invoke `make` targets from the CI/CD, but rather to uti
The following software must be installed and available in your `${PATH}`:
* `node` ([NodeJS](https://nodejs.org/en/download)): latest v14
* `npm` ([npm](https://www.npmjs.com/get-npm)): latest v6
* `mongod` ([MongoDB](https://docs.mongodb.com/manual/installation/)): latest v4.2
* `node` ([NodeJS](https://nodejs.org/en/download)): latest v16
* `npm` ([npm](https://www.npmjs.com/get-npm)): latest v8
* `mongod` ([MongoDB](https://docs.mongodb.com/manual/installation/)): latest v4.4
*NOTE: the application in this repository has not been tested with versions newer than that*
......
This diff is collapsed.
......@@ -13,13 +13,13 @@
"devDependencies": {
"@babel/core": "7.9.0",
"@svgr/webpack": "4.3.3",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
"@testing-library/jest-dom": "^5.15.0",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.0.0",
"@typescript-eslint/eslint-plugin": "^2.10.0",
"@typescript-eslint/parser": "^2.10.0",
"babel-eslint": "10.1.0",
"babel-jest": "^24.9.0",
"babel-jest": "^27.3.1",
"babel-loader": "8.1.0",
"babel-plugin-named-asset-import": "^0.3.6",
"babel-preset-react-app": "^9.1.2",
......@@ -40,9 +40,9 @@
"fs-extra": "^8.1.0",
"html-webpack-plugin": "4.0.0-beta.11",
"identity-obj-proxy": "3.0.0",
"jest": "24.9.0",
"jest-environment-jsdom-fourteen": "1.0.1",
"jest-resolve": "24.9.0",
"jest": "27.3.1",
"jsdom": "^18.0.1",
"jest-resolve": "27.3.1",
"jest-watch-typeahead": "0.4.2",
"mini-css-extract-plugin": "0.9.0",
"optimize-css-assets-webpack-plugin": "5.0.3",
......@@ -52,7 +52,7 @@
"postcss-normalize": "8.0.1",
"postcss-preset-env": "6.7.0",
"postcss-safe-parser": "4.0.1",
"react-app-polyfill": "^1.0.6",
"react-app-polyfill": "^2.0.0",
"react-dev-utils": "^10.2.1",
"resolve": "1.15.0",
"resolve-url-loader": "3.1.1",
......@@ -87,8 +87,8 @@
]
},
"engines": {
"node": "^14.15.5",
"npm": "^7.24.0"
"node": "^16.13.0",
"npm": "^8.1.3"
},
"jest": {
"roots": [
......@@ -108,7 +108,7 @@
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
],
"testEnvironment": "jest-environment-jsdom-fourteen",
"testEnvironment": "jsdom",
"transform": {
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
......
......@@ -77,4 +77,4 @@ test('api interaction', async () => {
}));
apiMock.mockRestore();
});
\ No newline at end of file
});
This diff is collapsed.
......@@ -11,8 +11,8 @@
},
"devDependencies": {
"env-cmd": "^10.1.0",
"jest": "^26.6.3",
"nodemon": "^2.0.7"
"jest": "^27.3.1",
"nodemon": "^2.0.14"
},
"dependencies": {
"bcryptjs": "^2.4.3",
......@@ -21,11 +21,11 @@
"express": "^4.17.1",
"helmet": "^3.22.0",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.11.20",
"mongoose": "^6.0.12",
"validator": "^13.0.0"
},
"engines": {
"node": "^14.15.5",
"npm": "^7.24.0"
"node": "^16.13.0",
"npm": "^8.1.3"
}
}
......@@ -11,7 +11,7 @@ const CONNECTION_EVENTS = [
if( process.env.NODE_ENV === 'production' ){
CONNECTION_EVENTS.forEach(( eventName )=>{
return mongoose.connection.on( eventName, ()=>{
console.log( `Connection state changed to: ${ eventName }` );
console.log( `DB connection state changed to: ${ eventName }` );
});
});
}
......@@ -20,13 +20,9 @@ if( process.env.NODE_ENV === 'production' ){
const mongooseInstance_ = mongoose.connect(
process.env.MONGODB_URL,
{
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false,
useUnifiedTopology: true,
heartbeatFrequencyMS: 1000 * 5, // 1 sec * 5
serverSelectionTimeoutMS: 1000 * 10 // 1 sec * 10
keepAlive: true,
keepAliveInitialDelay: 300000, // 1 sec * 300 = 5 min
connectTimeoutMS: 1000 * 10 // 1 sec * 10
}
);
......@@ -36,6 +32,7 @@ mongooseInstance_
})
.catch(( err )=>{
console.error( `Cannot connect to database: ${ process.env.MONGODB_URL }` );
console.error( err );
});
......
......@@ -48,8 +48,8 @@ describe('Testing the authorization middleware', () => {
});
test('should sent a 401 status code, if the user could not be found', async () => {
spyOn(jwt, 'verify').mockReturnValue(token);
spyOn(Users, 'findOne').mockResolvedValue(undefined);
jest.spyOn(jwt, 'verify').mockReturnValue(token);
jest.spyOn(Users, 'findOne').mockResolvedValue(undefined);
await auth(mockRequest, mockResponse, nextFunction);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment