Browse Source

code coverage for unit tests and playwright

modify uploaded artifact names

awk install

runner instance awk fix

test

fix coverage report

fix kill process

log

remove skipped tests
codecov_istanbul
starbirdtech383 2 years ago
parent
commit
92cd7b1247
  1. 12
      .github/workflows/ci-cd.yml
  2. 26
      .github/workflows/playwright-test-workflow.yml
  3. 1075
      packages/nocodb/package-lock.json
  4. 18
      packages/nocodb/package.json

12
.github/workflows/ci-cd.yml

@ -63,6 +63,12 @@ jobs:
- name: run unit tests
working-directory: ./packages/nocodb
run: npm run test:unit
- uses: actions/upload-artifact@v3
if: always()
with:
name: coverage-unit-tests
path: ./packages/nocodb/coverage
retention-days: 2
unit-tests-pg:
runs-on: ubuntu-20.04
timeout-minutes: 40
@ -104,6 +110,12 @@ jobs:
- name: run unit tests
working-directory: ./packages/nocodb
run: npm run test:unit:pg
- uses: actions/upload-artifact@v3
if: always()
with:
name: coverage-unit-tests-pg
path: ./packages/nocodb/coverage
retention-days: 2
playwright-mysql-1:
if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'trigger-CI') || !github.event.pull_request.draft }}
uses: ./.github/workflows/playwright-test-workflow.yml

26
.github/workflows/playwright-test-workflow.yml

@ -28,6 +28,7 @@ jobs:
sudo chmod 600 $SWAP_FILE
sudo mkswap $SWAP_FILE
sudo swapon $SWAP_FILE
sudo apt-get install gawk
- name: Setup Node
uses: actions/setup-node@v3
with:
@ -128,6 +129,25 @@ jobs:
sleep 2
done
PLAYWRIGHT_HTML_REPORT=playwright-report-quick npm run test:quick
- name: Stop Server and Generate Coverage Report
if: always()
working-directory: ./packages/nocodb
run: |
echo "Running process id :"
ps -ef | grep -e "nodemon" -e "ts-node" | grep -v grep
ps -ef | grep -e "nodemon" -e "ts-node" | grep -v grep | awk '{print $2}'
process_id=$(ps -ef | grep -e "nodemon" -e "ts-node" | grep -v grep | awk '{print $2}')
if [[ ${process_id} ]]; then
echo "Killing process ${process_id}"
kill -2 ${process_id}
sleep 3
ls -ltr .nyc_output/*
ps -ef | grep -e "nodemon" -e "ts-node" | grep -v grep | awk '{print $2}'
npm run gen-coverage-report
else
echo "process_id : ${process_id} could not found"
fi
- uses: actions/upload-artifact@v3
if: ${{ inputs.db == 'sqlite' }}
with:
@ -159,3 +179,9 @@ jobs:
name: backend-logs-${{ inputs.db }}-${{ inputs.shard }}
path: ./packages/nocodb/${{ inputs.db }}_${{ inputs.shard }}_test_backend.log
retention-days: 2
- uses: actions/upload-artifact@v3
if: always()
with:
name: coverage-${{ inputs.db }}-${{ inputs.shard }}
path: ./packages/nocodb/coverage
retention-days: 2

1075
packages/nocodb/package-lock.json generated

File diff suppressed because it is too large Load Diff

18
packages/nocodb/package.json

@ -31,15 +31,16 @@
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json",
"watch:run": "cross-env NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/docker --log-error --project tsconfig.json\"",
"watch:run:mysql": "cross-env NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunMysql --log-error --project tsconfig.json\"",
"watch:run": "cross-env NC_DISABLE_TELE=true EE=true nyc --reporter=html nodemon -e ts,js -w ./src -x \"ts-node src/run/docker --log-error --project tsconfig.json\"",
"watch:run:mysql": "cross-env NC_DISABLE_TELE=true EE=true nyc --reporter=html nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunMysql --log-error --project tsconfig.json\"",
"watch:run:pg": "cross-env NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunPG --log-error --project tsconfig.json\"",
"watch:run:playwright": "rm -f ./test_noco.db; cross-env DATABASE_URL=sqlite:./test_noco.db PLAYWRIGHT_TEST=true NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/testDocker --log-error --project tsconfig.json\"",
"watch:run:playwright:quick": "rm -f ./test_noco.db; cp ../../tests/playwright/fixtures/noco_0_91_7.db ./test_noco.db; cross-env DATABASE_URL=sqlite:./test_noco.db NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/docker --log-error --project tsconfig.json\"",
"watch:run:playwright:pg:cyquick": "rm -f ./test_noco.db; cp ../../tests/playwright/fixtures/noco_0_91_7.db ./test_noco.db; cross-env NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunPG_CyQuick.ts --log-error --project tsconfig.json\"",
"test:unit": "cross-env TS_NODE_PROJECT=./tests/unit/tsconfig.json mocha -r ts-node/register tests/unit/index.test.ts --recursive --timeout 300000 --exit --delay",
"test:unit:pg": "cp tests/unit/.pg.env tests/unit/.env; cross-env TS_NODE_PROJECT=./tests/unit/tsconfig.json mocha -r ts-node/register tests/unit/index.test.ts --recursive --timeout 300000 --exit --delay",
"docker:build": "EE=\"true-xc-test\" webpack --config docker/webpack.config.js"
"watch:run:playwright": "rm -rf .nyc_output coverage ./test_noco.db; cross-env DATABASE_URL=sqlite:./test_noco.db PLAYWRIGHT_TEST=true NC_DISABLE_TELE=true EE=true nyc --reporter=html nodemon -e ts,js -w ./src -x \"ts-node src/run/testDocker --log-error --project tsconfig.json\"",
"watch:run:playwright:quick": "rm -f ./test_noco.db; cp ../../tests/playwright/fixtures/noco_0_91_7.db ./test_noco.db; cross-env DATABASE_URL=sqlite:./test_noco.db NC_DISABLE_TELE=true EE=true nyc --reporter=html nodemon -e ts,js -w ./src -x \"ts-node src/run/docker --log-error --project tsconfig.json\"",
"watch:run:playwright:pg:cyquick": "rm -f ./test_noco.db; cp ../../tests/playwright/fixtures/noco_0_91_7.db ./test_noco.db; cross-env NC_DISABLE_TELE=true EE=true nyc --reporter=html nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunPG_CyQuick.ts --log-error --project tsconfig.json\"",
"test:unit": "cross-env TS_NODE_PROJECT=./tests/unit/tsconfig.json nyc --reporter=html mocha -r ts-node/register tests/unit/index.test.ts --recursive --timeout 300000 --exit --delay",
"test:unit:pg": "cp tests/unit/.pg.env tests/unit/.env; cross-env TS_NODE_PROJECT=./tests/unit/tsconfig.json nyc --reporter=html mocha -r ts-node/register tests/unit/index.test.ts --recursive --timeout 300000 --exit --delay",
"docker:build": "EE=\"true-xc-test\" webpack --config docker/webpack.config.js",
"gen-coverage-report": "rm -rf coverage ; nyc report --temp-dir=.nyc_output --reporter=html"
},
"dependencies": {
"@google-cloud/storage": "^5.7.2",
@ -176,6 +177,7 @@
"jest": "29.5.0",
"mocha": "^10.1.0",
"nodemon": "^2.0.22",
"nyc": "^15.1.0",
"prettier": "^2.7.1",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",

Loading…
Cancel
Save