From 84236c137a212b8445f44f20539be1e0d185b020 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 1 Nov 2024 11:21:44 +0100 Subject: [PATCH 1/6] ci: try test splitting --- .circleci/config.yml | 30 ++-- .circleci/config_continue.yml | 76 ++++++++++ .circleci/doTests.sh | 185 +++++++----------------- .circleci/generateConfig.sh | 9 ++ .circleci/markAsSuccess.sh | 46 ++++++ .circleci/markDevTagAsTestNotPassed.sh | 45 ++++++ .circleci/setupAndTestWithFreeCore.sh | 2 +- TestingApp/package-lock.json | 191 +++++++++++++++++++++---- TestingApp/package.json | 4 +- 9 files changed, 405 insertions(+), 183 deletions(-) create mode 100644 .circleci/config_continue.yml create mode 100755 .circleci/generateConfig.sh create mode 100755 .circleci/markAsSuccess.sh create mode 100755 .circleci/markDevTagAsTestNotPassed.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index cb983a5..c0a3959 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,5 +1,10 @@ version: 2.1 + +# this allows you to use CircleCI's dynamic configuration feature +setup: true + orbs: + continuation: circleci/continuation@0.1.2 slack: circleci/slack@3.4.2 jq: circleci/jq@2.2.0 jobs: @@ -16,27 +21,20 @@ jobs: ./publish.sh - slack/status test: - docker: - - image: rishabhpoddar/supertokens_website_sdk_testing + machine: + image: ubuntu-2204:2024.04.4 steps: - checkout - - run: update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk-15.0.1/bin/java" 2 - - run: update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk-15.0.1/bin/javac" 2 - - run: echo "127.0.0.1 localhost.org" >> /etc/hosts - - run: npm i -d - run: - name: Run tests - command: cd .circleci/ && ./doTests.sh - no_output_timeout: 30m - - store_artifacts: - path: ../supertokens-root/logs - destination: logfiles - - run: npm run size - - slack/status + name: Generate config + command: cd .circleci && ./generateConfig.sh + - continuation/continue: + configuration_path: .circleci/config_continue.yml update-docs: docker: - - image: rishabhpoddar/supertokens_website_sdk_testing + - image: rishabhpoddar/supertokens_website_sdk_testing_node_16 steps: + - run: git config --global url."https://github.com/".insteadOf ssh://git@github.com/ # This makes npm use http instead of ssh (required for node 16) - checkout - run: cd ../ && git clone git@github.com:supertokens/supertokens-backend-website.git - run: (cd .circleci && ./updateDocsInWebsite.sh) @@ -64,7 +62,7 @@ workflows: only: /test-cicd\/.*/ - update-docs: context: - - slack-notification + - slack-notification filters: branches: only: diff --git a/.circleci/config_continue.yml b/.circleci/config_continue.yml new file mode 100644 index 0000000..5e60166 --- /dev/null +++ b/.circleci/config_continue.yml @@ -0,0 +1,76 @@ +version: 2.1 +orbs: + continuation: circleci/continuation@0.1.2 + slack: circleci/slack@3.4.2 + jq: circleci/jq@2.2.0 +jobs: + test-dev-tag-as-not-passed: + docker: + - image: rishabhpoddar/supertokens_website_sdk_testing_node_16 + steps: + - run: git config --global url."https://github.com/".insteadOf ssh://git@github.com/ # This makes npm use http instead of ssh (required for node 16) + - checkout + - run: (cd .circleci/ && ./markDevTagAsTestNotPassed.sh) + test-unit: + docker: + - image: rishabhpoddar/supertokens_website_sdk_testing_node_16 + parameters: + fdi-version: + type: string + parallelism: 4 + steps: + - run: mkdir -p ~/reports/ + - run: git config --global url."https://github.com/".insteadOf ssh://git@github.com/ # This makes npm use http instead of ssh (required for node 16) + - checkout + - run: echo "127.0.0.1 localhost.org" >> /etc/hosts + - run: npm i -d + - run: + command: for i in $(seq 1 5); do (cd .circleci/ && ./doTests.sh << parameters.fdi-version >>) && s=0 && break || s=$? && sleep 10; done; (exit $s) # https://support.circleci.com/hc/en-us/articles/5728720104347-How-To-Retry-an-Intermittently-Failing-Step + environment: + JEST_JUNIT_OUTPUT_DIR: ~/reports/ + - run: npm run size + - run: npm run check-circular-dependencies + - store_test_results: + path: ~/reports/ + test-success: + docker: + - image: rishabhpoddar/supertokens_website_sdk_testing_node_16 + steps: + - run: git config --global url."https://github.com/".insteadOf ssh://git@github.com/ # This makes npm use http instead of ssh (required for node 16) + - checkout + - run: (cd .circleci/ && ./markAsSuccess.sh) + - slack/status + +workflows: + version: 2 + tagged-build: + jobs: + - test-dev-tag-as-not-passed: + filters: + tags: + only: /dev-v[0-9]+(\.[0-9]+)*/ + branches: + only: /test-cicd\/.*/ + - test-unit: + requires: + - test-dev-tag-as-not-passed + context: + - slack-notification + filters: + tags: + only: /dev-v[0-9]+(\.[0-9]+)*/ + branches: + only: /test-cicd\/.*/ + matrix: + parameters: + fdi-version: placeholder + - test-success: + requires: + - test-unit + context: + - slack-notification + filters: + tags: + only: /dev-v[0-9]+(\.[0-9]+)*/ + branches: + ignore: /.*/ \ No newline at end of file diff --git a/.circleci/doTests.sh b/.circleci/doTests.sh index 7801792..0b62162 100755 --- a/.circleci/doTests.sh +++ b/.circleci/doTests.sh @@ -1,146 +1,59 @@ -frontendDriverJson=`cat ../frontendDriverInterfaceSupported.json` -frontendDriverLength=`echo $frontendDriverJson | jq ".versions | length"` -frontendDriverArray=`echo $frontendDriverJson | jq ".versions"` -echo "got frontend driver relations" +echo "Starting tests for FDI $1"; -# get sdk version -version=`cat ../package.json | grep -e '"version":'` -while IFS='"' read -ra ADDR; do - counter=0 - for i in "${ADDR[@]}"; do - if [ $counter == 3 ] - then - version=$i - fi - counter=$(($counter+1)) - done -done <<< "$version" +if [ -z "$SUPERTOKENS_API_KEY" ]; then + echo "SUPERTOKENS_API_KEY not set" + exit 1 +fi +frontendDriverVersion=$1 -responseStatus=`curl -s -o /dev/null -w "%{http_code}" -X PUT \ - https://api.supertokens.io/0/frontend \ - -H 'Content-Type: application/json' \ - -H 'api-version: 0' \ - -d "{ - \"password\": \"$SUPERTOKENS_API_KEY\", - \"version\":\"$version\", - \"name\": \"react-native\", - \"frontendDriverInterfaces\": $frontendDriverArray -}"` -if [ $responseStatus -ne "200" ] +driverVersionXY=`curl -s -X GET \ +"https://api.supertokens.io/0/frontend-driver-interface/dependency/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendDriverVersion&driverName=node" \ +-H 'api-version: 0'` +if [[ `echo $driverVersionXY | jq .driver` == "null" ]] then - echo "failed core PUT API status code: $responseStatus. Exiting!" - exit 1 + echo "fetching latest X.Y version for driver given frontend-driver-interface X.Y version: $frontendDriverVersion gave response: $driverVersionXY. Please make sure all relevant drivers have been pushed." + exit 1 fi +driverVersionXY=$(echo $driverVersionXY | jq .driver | tr -d '"') -someTestsRan=false -i=0 -while [ $i -lt $frontendDriverLength ]; do - frontendDriverVersion=`echo $frontendDriverArray | jq ".[$i]"` - frontendDriverVersion=`echo $frontendDriverVersion | tr -d '"'` - i=$((i+1)) - - driverVersionXY=`curl -s -X GET \ - "https://api.supertokens.io/0/frontend-driver-interface/dependency/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendDriverVersion&driverName=node" \ - -H 'api-version: 0'` - if [[ `echo $driverVersionXY | jq .driver` == "null" ]] - then - echo "fetching latest X.Y version for driver given frontend-driver-interface X.Y version: $frontendDriverVersion gave response: $driverVersionXY. Please make sure all relevant drivers have been pushed." - exit 1 - fi - driverVersionXY=$(echo $driverVersionXY | jq .driver | tr -d '"') - - driverInfo=`curl -s -X GET \ - "https://api.supertokens.io/0/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$driverVersionXY&name=node" \ - -H 'api-version: 0'` - if [[ `echo $driverInfo | jq .tag` == "null" ]] - then - echo "fetching latest X.Y.Z version for driver, X.Y version: $driverVersionXY gave response: $driverInfo" - exit 1 - fi - driverTag=$(echo $driverInfo | jq .tag | tr -d '"') - driverVersion=$(echo $driverInfo | jq .version | tr -d '"') - - git clone git@github.com:supertokens/supertokens-node.git - cd supertokens-node - git checkout $driverTag - coreDriverJson=`cat ./coreDriverInterfaceSupported.json` - coreDriverLength=`echo $coreDriverJson | jq ".versions | length"` - coreDriverArray=`echo $coreDriverJson | jq ".versions"` - coreDriverVersion=`echo $coreDriverArray | jq ". | last"` - coreDriverVersion=`echo $coreDriverVersion | tr -d '"'` - cd ../ - rm -rf supertokens-node - - coreFree=`curl -s -X GET \ - "https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion" \ - -H 'api-version: 0'` - if [[ `echo $coreFree | jq .core` == "null" ]] - then - echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." - exit 1 - fi - coreFree=$(echo $coreFree | jq .core | tr -d '"') - - someTestsRan=true - tries=1 - - while [ $tries -le 3 ] - do - tries=$(( $tries + 1 )) - ./setupAndTestWithFreeCore.sh $coreFree $driverTag $version - - if [[ $? -ne 0 ]] - then - if [[ $tries -le 3 ]] - then - rm -rf ../../supertokens-root - rm -rf ../TestingApp/test/server/node_modules/supertokens-node - git checkout HEAD -- ../TestingApp/test/server/package.json - echo "test failed... retrying!" - else - echo "test failed... exiting!" - exit 1 - fi - else - rm -rf ../../supertokens-root - rm -rf ../TestingApp/test/server/node_modules/supertokens-node - git checkout HEAD -- ../TestingApp/test/server/package.json - break - fi - done -done - -# get git branch name----------- -branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || -branch_name="(unnamed branch)" # detached HEAD - -branch_name=${branch_name##refs/heads/} - -if [[ $branch_name =~ ^test-cicd/.*$ ]] +driverInfo=`curl -s -X GET \ +"https://api.supertokens.io/0/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$driverVersionXY&name=node" \ +-H 'api-version: 0'` +if [[ `echo $driverInfo | jq .tag` == "null" ]] +then + echo "fetching latest X.Y.Z version for driver, X.Y version: $driverVersionXY gave response: $driverInfo" + exit 1 +fi +driverTag=$(echo $driverInfo | jq .tag | tr -d '"') +driverVersion=$(echo $driverInfo | jq .version | tr -d '"') + +git clone git@github.com:supertokens/supertokens-node.git +cd supertokens-node +git checkout $driverTag +coreDriverJson=`cat ./coreDriverInterfaceSupported.json` +coreDriverLength=`echo $coreDriverJson | jq ".versions | length"` +coreDriverArray=`echo $coreDriverJson | jq ".versions"` +coreDriverVersion=`echo $coreDriverArray | jq ". | last"` +coreDriverVersion=`echo $coreDriverVersion | tr -d '"'` +cd ../ +rm -rf supertokens-node + +coreFree=`curl -s -X GET \ + "https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion" \ +-H 'api-version: 0'` +if [[ `echo $coreFree | jq .core` == "null" ]] then - echo "This is a ci testing branch ($branch_name), exiting early" - exit 0 + echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." + exit 1 fi +coreFree=$(echo $coreFree | jq .core | tr -d '"') -if [[ $someTestsRan = "true" ]] +./setupAndTestWithFreeCore.sh $coreFree $driverTag $version +if [[ $? -ne 0 ]] then - echo "calling /frontend PATCH to make testing passed" - responseStatus=`curl -s -o /dev/null -w "%{http_code}" -X PATCH \ - https://api.supertokens.io/0/frontend \ - -H 'Content-Type: application/json' \ - -H 'api-version: 0' \ - -d "{ - \"password\": \"$SUPERTOKENS_API_KEY\", - \"version\":\"$version\", - \"name\": \"react-native\", - \"testPassed\": true - }"` - if [ $responseStatus -ne "200" ] - then - echo "patch api failed" - exit 1 - fi -else - echo "no test ran" + echo "test failed... exiting!" exit 1 -fi \ No newline at end of file +fi +rm -rf ../../supertokens-root +rm -rf ../test/server/node_modules/supertokens-node +git checkout HEAD -- ../test/server/package.json \ No newline at end of file diff --git a/.circleci/generateConfig.sh b/.circleci/generateConfig.sh new file mode 100755 index 0000000..2cbcc28 --- /dev/null +++ b/.circleci/generateConfig.sh @@ -0,0 +1,9 @@ +frontendDriverJson=`cat ../frontendDriverInterfaceSupported.json` +frontendDriverArray=`echo $frontendDriverJson | jq ".versions"` + +if [ -z "$SUPERTOKENS_API_KEY" ]; then + echo "SUPERTOKENS_API_KEY missing" + exit 1; +fi + +sed -i -e 's/fdi-version: placeholder/fdi-version: '`printf "%q" $frontendDriverArray`'/' config_continue.yml diff --git a/.circleci/markAsSuccess.sh b/.circleci/markAsSuccess.sh new file mode 100755 index 0000000..fe3a715 --- /dev/null +++ b/.circleci/markAsSuccess.sh @@ -0,0 +1,46 @@ +# get git branch name----------- +branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || +branch_name="(unnamed branch)" # detached HEAD + +branch_name=${branch_name##refs/heads/} + +if [[ $branch_name =~ ^test-cicd/.*$ ]] +then + echo "This is a ci testing branch ($branch_name), exiting early" + exit 0 +fi + +frontendDriverJson=`cat ../frontendDriverInterfaceSupported.json` +frontendDriverLength=`echo $frontendDriverJson | jq ".versions | length"` +frontendDriverArray=`echo $frontendDriverJson | jq ".versions"` +echo "got frontend driver relations" + +# get sdk version +version=`cat ../package.json | grep -e '"version":'` +while IFS='"' read -ra ADDR; do + counter=0 + for i in "${ADDR[@]}"; do + if [ $counter == 3 ] + then + version=$i + fi + counter=$(($counter+1)) + done +done <<< "$version" + +echo "calling /frontend PATCH to make testing passed" +responseStatus=`curl -s -o /dev/null -w "%{http_code}" -X PATCH \ + https://api.supertokens.io/0/frontend \ + -H 'Content-Type: application/json' \ + -H 'api-version: 0' \ + -d "{ + \"password\": \"$SUPERTOKENS_API_KEY\", + \"version\":\"$version\", + \"name\": \"react-native\", + \"testPassed\": true + }"` +if [ $responseStatus -ne "200" ] +then + echo "patch api failed" + exit 1 +fi \ No newline at end of file diff --git a/.circleci/markDevTagAsTestNotPassed.sh b/.circleci/markDevTagAsTestNotPassed.sh new file mode 100755 index 0000000..701bd55 --- /dev/null +++ b/.circleci/markDevTagAsTestNotPassed.sh @@ -0,0 +1,45 @@ +# get git branch name----------- +branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || +branch_name="(unnamed branch)" # detached HEAD + +branch_name=${branch_name##refs/heads/} + +if [[ $branch_name =~ ^test-cicd/.*$ ]] +then + echo "This is a ci testing branch ($branch_name), exiting early" + exit 0 +fi + +frontendDriverJson=`cat ../frontendDriverInterfaceSupported.json` +frontendDriverLength=`echo $frontendDriverJson | jq ".versions | length"` +frontendDriverArray=`echo $frontendDriverJson | jq ".versions"` +echo "got frontend driver relations" + +# get sdk version +version=`cat ../package.json | grep -e '"version":'` +while IFS='"' read -ra ADDR; do + counter=0 + for i in "${ADDR[@]}"; do + if [ $counter == 3 ] + then + version=$i + fi + counter=$(($counter+1)) + done +done <<< "$version" + +responseStatus=`curl -s -o /dev/null -w "%{http_code}" -X PUT \ + https://api.supertokens.io/0/frontend \ + -H 'Content-Type: application/json' \ + -H 'api-version: 0' \ + -d "{ + \"password\": \"$SUPERTOKENS_API_KEY\", + \"version\":\"$version\", + \"name\": \"react-native\", + \"frontendDriverInterfaces\": $frontendDriverArray +}"` +if [ $responseStatus -ne "200" ] +then + echo "failed core PUT API status code: $responseStatus. Exiting!" + exit 1 +fi \ No newline at end of file diff --git a/.circleci/setupAndTestWithFreeCore.sh b/.circleci/setupAndTestWithFreeCore.sh index a65185a..17b8faf 100755 --- a/.circleci/setupAndTestWithFreeCore.sh +++ b/.circleci/setupAndTestWithFreeCore.sh @@ -51,7 +51,7 @@ cd ../../ npm i -d cp -r ./test/tough-cookie ./node_modules/ npm i git+https://github.com:supertokens/supertokens-react-native.git#dev-v$3 -SUPERTOKENS_CORE_TAG=$coreTag INSTALL_PATH=../../supertokens-root npm test +SUPERTOKENS_CORE_TAG=$coreTag INSTALL_PATH=../../supertokens-root npm run test-ci if [[ $? -ne 0 ]] then echo "test failed... exiting!" diff --git a/TestingApp/package-lock.json b/TestingApp/package-lock.json index f7ea891..4eef779 100644 --- a/TestingApp/package-lock.json +++ b/TestingApp/package-lock.json @@ -25,10 +25,11 @@ "fetch-cookie": "0.8.0", "isomorphic-fetch": "^3.0.0", "jest": "^26.6.3", + "jest-junit": "^16.0.0", "metro-react-native-babel-preset": "^0.66.2", "node-fetch": "2.6.0", "react-test-renderer": "17.0.2", - "ts-jest": "25.3.0" + "ts-jest": "^26.5.6" } }, "..": { @@ -8265,6 +8266,63 @@ "@types/yargs-parser": "*" } }, + "node_modules/jest-junit": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-16.0.0.tgz", + "integrity": "sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==", + "dev": true, + "dependencies": { + "mkdirp": "^1.0.4", + "strip-ansi": "^6.0.1", + "uuid": "^8.3.2", + "xml": "^1.0.1" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/jest-junit/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-junit/node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true, + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-junit/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-junit/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/jest-leak-detector": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-26.6.2.tgz", @@ -9392,12 +9450,6 @@ "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" }, - "node_modules/lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", - "dev": true - }, "node_modules/lodash.throttle": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", @@ -12906,30 +12958,31 @@ "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, "node_modules/ts-jest": { - "version": "25.3.0", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.3.0.tgz", - "integrity": "sha512-qH/uhaC+AFDU9JfAueSr0epIFJkGMvUPog4FxSEVAtPOur1Oni5WBJMiQIkfHvc7PviVRsnlVLLY2I6221CQew==", + "version": "26.5.6", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-26.5.6.tgz", + "integrity": "sha512-rua+rCP8DxpA8b4DQD/6X2HQS8Zy/xzViVYfEs2OQu68tkCuKLV0Md8pmX55+W24uRIyAsf/BajRfxOs+R2MKA==", "dev": true, "dependencies": { "bs-logger": "0.x", "buffer-from": "1.x", "fast-json-stable-stringify": "2.x", + "jest-util": "^26.1.0", "json5": "2.x", - "lodash.memoize": "4.x", + "lodash": "4.x", "make-error": "1.x", "mkdirp": "1.x", - "resolve": "1.x", - "semver": "6.x", - "yargs-parser": "^18.1.1" + "semver": "7.x", + "yargs-parser": "20.x" }, "bin": { "ts-jest": "cli.js" }, "engines": { - "node": ">= 8" + "node": ">= 10" }, "peerDependencies": { - "jest": ">=25 <26" + "jest": ">=26 <27", + "typescript": ">=3.8 <5.0" } }, "node_modules/ts-jest/node_modules/mkdirp": { @@ -12944,6 +12997,27 @@ "node": ">=10" } }, + "node_modules/ts-jest/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-jest/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/tslib": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", @@ -13603,6 +13677,12 @@ "node": ">=6.0.0" } }, + "node_modules/xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", + "dev": true + }, "node_modules/xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", @@ -19997,6 +20077,47 @@ } } }, + "jest-junit": { + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/jest-junit/-/jest-junit-16.0.0.tgz", + "integrity": "sha512-A94mmw6NfJab4Fg/BlvVOUXzXgF0XIH6EmTgJ5NDPp4xoKq0Kr7sErb+4Xs9nZvu58pJojz5RFGpqnZYJTrRfQ==", + "dev": true, + "requires": { + "mkdirp": "^1.0.4", + "strip-ansi": "^6.0.1", + "uuid": "^8.3.2", + "xml": "^1.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true + } + } + }, "jest-leak-detector": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-26.6.2.tgz", @@ -20878,12 +20999,6 @@ "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=" }, - "lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", - "dev": true - }, "lodash.throttle": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz", @@ -23687,21 +23802,21 @@ "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, "ts-jest": { - "version": "25.3.0", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-25.3.0.tgz", - "integrity": "sha512-qH/uhaC+AFDU9JfAueSr0epIFJkGMvUPog4FxSEVAtPOur1Oni5WBJMiQIkfHvc7PviVRsnlVLLY2I6221CQew==", + "version": "26.5.6", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-26.5.6.tgz", + "integrity": "sha512-rua+rCP8DxpA8b4DQD/6X2HQS8Zy/xzViVYfEs2OQu68tkCuKLV0Md8pmX55+W24uRIyAsf/BajRfxOs+R2MKA==", "dev": true, "requires": { "bs-logger": "0.x", "buffer-from": "1.x", "fast-json-stable-stringify": "2.x", + "jest-util": "^26.1.0", "json5": "2.x", - "lodash.memoize": "4.x", + "lodash": "4.x", "make-error": "1.x", "mkdirp": "1.x", - "resolve": "1.x", - "semver": "6.x", - "yargs-parser": "^18.1.1" + "semver": "7.x", + "yargs-parser": "20.x" }, "dependencies": { "mkdirp": { @@ -23709,6 +23824,18 @@ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "dev": true + }, + "semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true } } }, @@ -24232,6 +24359,12 @@ "uuid": "^3.3.2" } }, + "xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", + "dev": true + }, "xml-name-validator": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", diff --git a/TestingApp/package.json b/TestingApp/package.json index 2f44570..9e0d579 100644 --- a/TestingApp/package.json +++ b/TestingApp/package.json @@ -7,6 +7,7 @@ "ios": "react-native run-ios", "start": "react-native start", "test": "npx jest test/*.spec.js --runInBand --silent=false", + "test-ci": "npx jest --listTests | circleci tests run --command=\"JEST_JUNIT_ADD_FILE_ATTRIBUTE=true xargs npx jest --config jest.config.js --runInBand --\" --verbose --split-by=timings", "lint": "eslint ." }, "dependencies": { @@ -27,10 +28,11 @@ "fetch-cookie": "0.8.0", "isomorphic-fetch": "^3.0.0", "jest": "^26.6.3", + "jest-junit": "^16.0.0", "metro-react-native-babel-preset": "^0.66.2", "node-fetch": "2.6.0", "react-test-renderer": "17.0.2", - "ts-jest": "25.3.0" + "ts-jest": "^26.5.6" }, "jest": { "preset": "react-native", From cff0a958847321fdc7bf47c087dc12ea86469fc3 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 1 Nov 2024 11:26:31 +0100 Subject: [PATCH 2/6] ci: fix typo in ci config --- .circleci/config_continue.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config_continue.yml b/.circleci/config_continue.yml index 5e60166..f28521d 100644 --- a/.circleci/config_continue.yml +++ b/.circleci/config_continue.yml @@ -24,10 +24,10 @@ jobs: - checkout - run: echo "127.0.0.1 localhost.org" >> /etc/hosts - run: npm i -d - - run: - command: for i in $(seq 1 5); do (cd .circleci/ && ./doTests.sh << parameters.fdi-version >>) && s=0 && break || s=$? && sleep 10; done; (exit $s) # https://support.circleci.com/hc/en-us/articles/5728720104347-How-To-Retry-an-Intermittently-Failing-Step - environment: - JEST_JUNIT_OUTPUT_DIR: ~/reports/ + - run: + command: for i in $(seq 1 5); do (cd .circleci/ && ./doTests.sh << parameters.fdi-version >>) && s=0 && break || s=$? && sleep 10; done; (exit $s) # https://support.circleci.com/hc/en-us/articles/5728720104347-How-To-Retry-an-Intermittently-Failing-Step + environment: + JEST_JUNIT_OUTPUT_DIR: ~/reports/ - run: npm run size - run: npm run check-circular-dependencies - store_test_results: From 59614f4da7bc90698b3a66e63bf8be0d8c878402 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 1 Nov 2024 11:31:36 +0100 Subject: [PATCH 3/6] ci: remove unused config param --- TestingApp/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TestingApp/package.json b/TestingApp/package.json index 9e0d579..ea32293 100644 --- a/TestingApp/package.json +++ b/TestingApp/package.json @@ -7,7 +7,7 @@ "ios": "react-native run-ios", "start": "react-native start", "test": "npx jest test/*.spec.js --runInBand --silent=false", - "test-ci": "npx jest --listTests | circleci tests run --command=\"JEST_JUNIT_ADD_FILE_ATTRIBUTE=true xargs npx jest --config jest.config.js --runInBand --\" --verbose --split-by=timings", + "test-ci": "npx jest --listTests | circleci tests run --command=\"JEST_JUNIT_ADD_FILE_ATTRIBUTE=true xargs npx jest --runInBand --\" --verbose --split-by=timings", "lint": "eslint ." }, "dependencies": { From 0365300f9e942424da6f7bd2f26c5fe47d0b3ed3 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 1 Nov 2024 11:42:32 +0100 Subject: [PATCH 4/6] ci: re-add accidentally removed code --- .circleci/doTests.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.circleci/doTests.sh b/.circleci/doTests.sh index 0b62162..b947f85 100755 --- a/.circleci/doTests.sh +++ b/.circleci/doTests.sh @@ -6,6 +6,19 @@ if [ -z "$SUPERTOKENS_API_KEY" ]; then fi frontendDriverVersion=$1 +# get sdk version +version=`cat ../package.json | grep -e '"version":'` +while IFS='"' read -ra ADDR; do + counter=0 + for i in "${ADDR[@]}"; do + if [ $counter == 3 ] + then + version=$i + fi + counter=$(($counter+1)) + done +done <<< "$version" + driverVersionXY=`curl -s -X GET \ "https://api.supertokens.io/0/frontend-driver-interface/dependency/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendDriverVersion&driverName=node" \ -H 'api-version: 0'` From 5160637c38baec850d13d071594a2d2a4b23bcfb Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 1 Nov 2024 11:57:35 +0100 Subject: [PATCH 5/6] ci: fixing after test splitting --- .circleci/doTests.sh | 4 ++-- TestingApp/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/doTests.sh b/.circleci/doTests.sh index b947f85..29d4ca7 100755 --- a/.circleci/doTests.sh +++ b/.circleci/doTests.sh @@ -68,5 +68,5 @@ then exit 1 fi rm -rf ../../supertokens-root -rm -rf ../test/server/node_modules/supertokens-node -git checkout HEAD -- ../test/server/package.json \ No newline at end of file +rm -rf ../TestingApp/test/server/node_modules/supertokens-node +git checkout HEAD -- ../TestingApp/test/server/package.json \ No newline at end of file diff --git a/TestingApp/package.json b/TestingApp/package.json index ea32293..98e2ef3 100644 --- a/TestingApp/package.json +++ b/TestingApp/package.json @@ -7,7 +7,7 @@ "ios": "react-native run-ios", "start": "react-native start", "test": "npx jest test/*.spec.js --runInBand --silent=false", - "test-ci": "npx jest --listTests | circleci tests run --command=\"JEST_JUNIT_ADD_FILE_ATTRIBUTE=true xargs npx jest --runInBand --\" --verbose --split-by=timings", + "test-ci": "npx jest --listTests test/*.spec.js | circleci tests run --command=\"JEST_JUNIT_ADD_FILE_ATTRIBUTE=true xargs npx jest --runInBand --\" --verbose --split-by=timings", "lint": "eslint ." }, "dependencies": { From 3a713691df73a9799f44ab8bb12b58f083123e32 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Fri, 1 Nov 2024 12:05:36 +0100 Subject: [PATCH 6/6] ci: fixing after test splitting --- .circleci/config_continue.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config_continue.yml b/.circleci/config_continue.yml index f28521d..ef421f0 100644 --- a/.circleci/config_continue.yml +++ b/.circleci/config_continue.yml @@ -29,7 +29,6 @@ jobs: environment: JEST_JUNIT_OUTPUT_DIR: ~/reports/ - run: npm run size - - run: npm run check-circular-dependencies - store_test_results: path: ~/reports/ test-success: