From f22d77100f5e843f89788b03144f5b0382cf0bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Bedi?= Date: Mon, 9 Nov 2020 15:14:04 +0100 Subject: [PATCH] Chore: use jest without grunt (#28558) * Chore: use jest without grunt * Run no-focus-convey-tests and no-only-tests as well * Update lib.star test-backend script with no-focus test to run first * Lets see a failing test * Revert "Lets see a failing test" This reverts commit cb6c6ed67dd5403a16d4418aea3260ea8a286107. * Update no-focus-convey test to a script * Update scripts/lib.star Co-authored-by: Arve Knudsen * Update drone.yml Co-authored-by: Arve Knudsen --- .drone.yml | 8 ++++++++ contribute/developer-guide.md | 2 +- package.json | 7 +++---- scripts/grunt/options/exec.js | 1 - scripts/lib.star | 4 +++- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.drone.yml b/.drone.yml index a0502caece5..4949a3f0aa6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -66,6 +66,7 @@ steps: - name: test-backend image: grafana/build-container:1.2.28 commands: + - "[ $(grep FocusConvey -R pkg | wc -l) -eq \"0\" ] || exit 1" - ./bin/grabpl test-backend - ./bin/grabpl integration-tests depends_on: @@ -313,6 +314,7 @@ steps: - name: test-backend image: grafana/build-container:1.2.28 commands: + - "[ $(grep FocusConvey -R pkg | wc -l) -eq \"0\" ] || exit 1" - ./bin/grabpl test-backend - ./bin/grabpl integration-tests depends_on: @@ -760,6 +762,7 @@ steps: - name: test-backend image: grafana/build-container:1.2.28 commands: + - "[ $(grep FocusConvey -R pkg | wc -l) -eq \"0\" ] || exit 1" - ./bin/grabpl test-backend - ./bin/grabpl integration-tests depends_on: @@ -1125,6 +1128,7 @@ steps: - name: test-backend image: grafana/build-container:1.2.28 commands: + - "[ $(grep FocusConvey -R pkg | wc -l) -eq \"0\" ] || exit 1" - ./bin/grabpl test-backend - ./bin/grabpl integration-tests depends_on: @@ -1532,6 +1536,7 @@ steps: - name: test-backend image: grafana/build-container:1.2.28 commands: + - "[ $(grep FocusConvey -R pkg | wc -l) -eq \"0\" ] || exit 1" - ./bin/grabpl test-backend - ./bin/grabpl integration-tests depends_on: @@ -1887,6 +1892,7 @@ steps: - name: test-backend image: grafana/build-container:1.2.28 commands: + - "[ $(grep FocusConvey -R pkg | wc -l) -eq \"0\" ] || exit 1" - ./bin/grabpl test-backend - ./bin/grabpl integration-tests depends_on: @@ -2296,6 +2302,7 @@ steps: - name: test-backend image: grafana/build-container:1.2.28 commands: + - "[ $(grep FocusConvey -R pkg | wc -l) -eq \"0\" ] || exit 1" - ./bin/grabpl test-backend - ./bin/grabpl integration-tests depends_on: @@ -2601,6 +2608,7 @@ steps: - name: test-backend image: grafana/build-container:1.2.28 commands: + - "[ $(grep FocusConvey -R pkg | wc -l) -eq \"0\" ] || exit 1" - ./bin/grabpl test-backend - ./bin/grabpl integration-tests depends_on: diff --git a/contribute/developer-guide.md b/contribute/developer-guide.md index d75a0bc0563..26ed45cacdf 100644 --- a/contribute/developer-guide.md +++ b/contribute/developer-guide.md @@ -90,7 +90,7 @@ The test suite consists of three types of tests: _Frontend tests_, _backend test We use [jest](https://jestjs.io/) for our frontend tests. Run them using Yarn: ``` -yarn jest +yarn test ``` ### Run backend tests diff --git a/package.json b/package.json index 08cbf7f06e8..ac8d3e317d0 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,9 @@ "e2e": "./e2e/start-and-run-suite", "e2e:debug": "./e2e/start-and-run-suite debug", "e2e:dev": "./e2e/start-and-run-suite dev", - "jest": "jest --notify --watch", + "test": "jest --notify --watch", "lint": "eslint . --ext .js,.tsx,.ts --cache", - "jest-ci": "mkdir -p reports/junit && export JEST_JUNIT_OUTPUT_DIR=reports/junit && jest --ci --reporters=default --reporters=jest-junit -w ${TEST_MAX_WORKERS:-100%}", + "test:ci": "mkdir -p reports/junit && export JEST_JUNIT_OUTPUT_DIR=reports/junit && jest --ci --reporters=default --reporters=jest-junit -w ${TEST_MAX_WORKERS:-100%}", "lint:fix": "yarn lint --fix", "packages:build": "lerna run clean && lerna run build --ignore @grafana-plugins/input-datasource", "packages:docsExtract": "rm -rf ./reports/docs && lerna run docsExtract", @@ -37,12 +37,11 @@ "stats": "webpack --mode production --config scripts/webpack/webpack.prod.js --profile --json > compilation-stats.json", "storybook": "cd packages/grafana-ui && yarn storybook --ci", "storybook:build": "cd packages/grafana-ui && yarn storybook:build", - "test": "grunt test", "themes:generate": "ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/generateSassVariableFiles.ts", "typecheck": "tsc --noEmit", "plugins:build-bundled": "grafana-toolkit plugin:bundle-managed", "watch": "yarn start -d watch,start core:start --watchTheme", - "ci:test-frontend": "yarn run prettier:check && yarn run packages:typecheck && yarn run typecheck && yarn run test" + "ci:test-frontend": "yarn run prettier:check && yarn run packages:typecheck && yarn run typecheck && yarn grunt no-only-tests && yarn run test:ci" }, "grafana": { "whatsNewUrl": "https://grafana.com/docs/grafana/latest/guides/whats-new-in-v7-3/", diff --git a/scripts/grunt/options/exec.js b/scripts/grunt/options/exec.js index 19d7f1d0c57..4a94b685b73 100644 --- a/scripts/grunt/options/exec.js +++ b/scripts/grunt/options/exec.js @@ -11,7 +11,6 @@ module.exports = function(config, grunt) { typecheckRoot: { command: 'yarn typecheck', }, - jest: 'yarn jest-ci', webpack: 'node ./node_modules/webpack/bin/webpack.js --config scripts/webpack/webpack.prod.js', }; }; diff --git a/scripts/lib.star b/scripts/lib.star index 10878432a36..9778943d84c 100644 --- a/scripts/lib.star +++ b/scripts/lib.star @@ -441,7 +441,9 @@ def test_backend_step(): 'lint-backend', ], 'commands': [ - # First execute non-integration tests in parallel, since it should be safe + # First make sure that there are no tests with FocusConvey + '[ $(grep FocusConvey -R pkg | wc -l) -eq "0" ] || exit 1', + # Then execute non-integration tests in parallel, since it should be safe './bin/grabpl test-backend', # Then execute integration tests in serial './bin/grabpl integration-tests',