Use older Jest for Node.js 12

Why:

- Allow tests to run on oldest targeted ECMAScript version

This change addresses the need by:

- Add script to run tests against older JS versions
This commit is contained in:
Moritz Ulmer
2023-04-10 15:12:03 +02:00
parent 8eb76138d0
commit c3f0d587a5
3 changed files with 778 additions and 688 deletions

1445
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,6 +13,7 @@
"build": "grunt build",
"start": "nodemon utils/server.js",
"test": "jest",
"test:allVersions": "./utils/test.sh",
"prettier": "npx prettier --write src/**/*.* css/**/*.*",
"lint": "npx eslint src",
"lint:fix": "npx eslint --fix src"
@@ -33,7 +34,7 @@
},
"homepage": "https://github.com/jagenjo/litegraph.js#readme",
"devDependencies": {
"@types/jest": "^29.5.0",
"@types/jest": "^28.1.3",
"eslint": "^8.37.0 ",
"eslint-plugin-jest": "^27.2.1",
"express": "^4.17.1",
@@ -42,7 +43,7 @@
"grunt-cli": "^1.2.0",
"grunt-closure-tools": "^1.0.0",
"grunt-contrib-concat": "^1.0.1",
"jest": "^29.5.0",
"jest": "^28.1.3",
"nodemon": "^1.19.4",
"rimraf": "^2.7.1"
}

16
utils/test.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -eo pipefail
cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
export NVM_DIR=$HOME/.nvm
source "$NVM_DIR/nvm.sh"
# This are versions 12, 14, 16, 18
NODE_VERSIONS=("lts/erbium" "lts/fermium" "lts/gallium" "lts/hydrogen")
for NODE_VERSION in "${NODE_VERSIONS[@]}"; do
nvm install "$NODE_VERSION"
nvm exec "$NODE_VERSION" npm install
nvm exec "$NODE_VERSION" npm test
done