Skip to content

Commit

Permalink
jsthemis: Downgrade mocha to ^7 for Centos7 (#1003)
Browse files Browse the repository at this point in the history
* jsthemis: Downgrade mocha to ^7

This version and all its transitive dependencies support node v8
which is the only version we can run on centos 7. It seems like other
OS work fine, at least on buildbot.

Another option is to fix our scripts on buildbot just for centos 7 so
they patch the versions before testing. This may save us from future
problems. However, downgrading dev dependency is not that scary, so
maybe this approach is okay.

* jsthemis: Downgrade mocha on centos 7

Add a separate script for that. It will be caled during make test.

* Revert "jsthemis: Downgrade mocha to ^7"

This reverts commit 0e7df2e.

---------

Co-authored-by: Lagovas <[email protected]>
  • Loading branch information
G1gg1L3s and Lagovas committed Jun 9, 2023
1 parent 542fd9a commit 67e054c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/wrappers/themis/jsthemis/install_centos7_specific_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
#
# centos:7 has pretty old Node (v8) which is not supported by many packages,
# including mocha - test framework that we use. Therefore, we need to downgrade
# it for testing. The addon itself works fine, we just cannot test it without
# this patch.


set -e -o pipefail

OS=$(cat /etc/*-release | grep '^NAME' | tr -d 'NAME="' || true)
VERSION=$(cat /etc/*-release | grep '^VERSION_ID' | tr -d 'VERSION_ID="' || true)

if [[ "$OS" == "CentOS Linux" && "$VERSION" == "7" ]]; then
npm install mocha@7 --save-dev
fi
3 changes: 2 additions & 1 deletion src/wrappers/themis/jsthemis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "build/Release/jsthemis.node",
"scripts": {
"test": "mocha",
"preuninstall": "rm -rf build/*"
"preuninstall": "rm -rf build/*",
"install_centos7_specific_deps": "./install_centos7_specific_deps.sh"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion tests/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ ifdef NPM_VERSION
@echo "Running jsthemis tests."
@echo "In case of errors, see https://docs.cossacklabs.com/themis/languages/nodejs/"
@echo "------------------------------------------------------------"
cd $(JSTHEMIS_SRC) && npm install && npm test
cd $(JSTHEMIS_SRC) && npm run install_centos7_specific_deps && npm install && npm test
@echo "------------------------------------------------------------"
endif

Expand Down

0 comments on commit 67e054c

Please sign in to comment.