Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recover coverage report for e2e test #1161

Merged
merged 3 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
env:
NO_MINIMIZE: true
CI: true
REACT_APP_MIXPANEL_TOKEN: ""
E2E_TEST: true
- name: Wait TiUP Playground
run: |
chmod u+x scripts/wait_tiup_playground.sh
Expand Down Expand Up @@ -159,10 +159,10 @@ jobs:
cat ui/start_tiup.log
echo "==============="
cat ui/wait_tiup.log
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v2
# with:
# files: ./ui/.nyc_output/out.json
# fail_ci_if_error: true
# flags: e2e_test
# verbose: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
files: ./ui/.nyc_output/out.json
fail_ci_if_error: true
flags: e2e_test
verbose: true
1 change: 0 additions & 1 deletion .github/workflows/upload-e2e-snapshots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ jobs:
env:
NO_MINIMIZE: true
CI: true
REACT_APP_MIXPANEL_TOKEN: ""
- name: Wait TiUP Playground
run: |
chmod u+x scripts/wait_tiup_playground.sh
Expand Down
16 changes: 15 additions & 1 deletion ui/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ const { createProxyMiddleware } = require('http-proxy-middleware')
const { watch } = require('chokidar')
const { build } = require('esbuild')
const postCssPlugin = require('@baurine/esbuild-plugin-postcss3')
const { yamlPlugin } = require('esbuild-plugin-yaml')
const autoprefixer = require('autoprefixer')
const { yamlPlugin } = require('esbuild-plugin-yaml')
const babelPlugin = require('@baurine/esbuild-plugin-babel')

const isDev = process.env.NODE_ENV !== 'production'
const isE2E = process.env.E2E_TEST === 'true'

// handle .env
if (isDev) {
Expand Down Expand Up @@ -146,6 +148,18 @@ const esbuildParams = {
define: genDefine(),
inject: ['./process-shim.js'], // fix runtime crash
}
if (isE2E) {
// use babel and istanbul to report test coverage for e2e test
esbuildParams.plugins.push(
babelPlugin({
filter: /\.tsx?/,
config: {
presets: ['@babel/preset-react', '@babel/preset-typescript'],
plugins: ['istanbul'],
},
})
)
}

function buildHtml(inputFilename, outputFilename) {
let result = fs.readFileSync(inputFilename).toString()
Expand Down
3 changes: 2 additions & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"ahooks": "^2.9.2",
"antd": "^4.16.13",
"axios": "^0.21.4",
"babel-plugin-istanbul": "^6.1.1",
"bulma": "^0.9.0",
"classnames": "^2.2.6",
"d3": "^5.16.0",
Expand Down Expand Up @@ -89,6 +88,7 @@
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.10.5",
"@baurine/esbuild-plugin-babel": "^0.3.0",
"@baurine/esbuild-plugin-postcss3": "^0.2.3",
"@cypress/code-coverage": "^3.9.12",
"@openapitools/openapi-generator-cli": "^1.0.15-4.3.1",
Expand All @@ -107,6 +107,7 @@
"@types/webpack-env": "^1.15.2",
"babel-plugin-dynamic-import-node": "^2.3.0",
"babel-plugin-import": "^1.13.0",
"babel-plugin-istanbul": "^6.1.1",
"browserslist-useragent-regexp": "^2.1.0",
"chokidar": "^3.5.2",
"customize-cra": "^1.0.0",
Expand Down
5 changes: 5 additions & 0 deletions ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2871,6 +2871,11 @@
"@babel/helper-validator-identifier" "^7.16.7"
to-fast-properties "^2.0.0"

"@baurine/esbuild-plugin-babel@^0.3.0":
version "0.3.0"
resolved "https://registry.yarnpkg.com/@baurine/esbuild-plugin-babel/-/esbuild-plugin-babel-0.3.0.tgz#b7409eb2a388fb03a5dacbf333154ae3604abcc7"
integrity sha512-AKa/svOQUhHE7HNa8vU3qEXL+U1ln211Sl5mCBX+AQIldEEcvA80udzVENGh6VEztUtbpsXRsPdP9VI8tyX96w==

"@baurine/esbuild-plugin-postcss3@^0.2.3":
version "0.2.3"
resolved "https://registry.yarnpkg.com/@baurine/esbuild-plugin-postcss3/-/esbuild-plugin-postcss3-0.2.3.tgz#c5bf3bbec4c5696cb23b854b6c82cbd7e5837efb"
Expand Down