fix(ui): repair configuration for tests to start

pull/5991/head
Pavel Zavora 2022-07-22 10:42:35 +02:00
parent f1aa45ff71
commit 299764cbcd
6 changed files with 440 additions and 511 deletions

View File

@ -24,6 +24,7 @@
},
"license": "MIT",
"devDependencies": {
"@parcel/core": "^2.6.2",
"@parcel/transformer-sass": "^2.6.2",
"assert": "^2.0.0",
"events": "^3.3.0",

24
ui/.babelrc.jest Normal file
View File

@ -0,0 +1,24 @@
{
"plugins": [
"@babel/plugin-transform-runtime",
"@babel/plugin-proposal-class-properties",
"babel-plugin-lodash",
[
"babel-plugin-module-resolver",
{
"root": ["./src"],
"alias": {
"src": "./src",
"shared": "./src/shared",
"style": "./src/style",
"utils": "./src/utils"
}
}
]
],
"presets": [
"@babel/preset-env",
"@babel/preset-typescript",
"@babel/preset-react"
]
}

View File

@ -1,6 +1,12 @@
module.exports = {
projects: [
{
globals: {
'ts-jest': {
babelConfig: './.babelrc.jest',
tsconfig: './tsconfig.test.json',
},
},
displayName: 'test',
testPathIgnorePatterns: [
'build',
@ -12,7 +18,7 @@ module.exports = {
setupFiles: ['<rootDir>/test/setup.js'],
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.js$': 'babel-jest',
'^.+\\.js$': ['babel-jest', {configFile: './.babelrc.jest'}],
},
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],

View File

@ -2,7 +2,7 @@
"name": "chronograf-ui",
"version": "1.9.4",
"private": true,
"license": "AGPL-3.0",
"license": "MIT",
"description": "",
"repository": {
"type": "git",
@ -53,6 +53,8 @@
"@babel/plugin-transform-runtime": "^7.1.0",
"@babel/preset-env": "^7.13.9",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.18.6",
"@parcel/core": "^2.6.2",
"@parcel/config-default": "^2.6.2",
"@parcel/transformer-typescript-tsc": "^2.6.2",
"@types/chroma-js": "^1.3.4",
@ -82,7 +84,7 @@
"autoprefixer": "^6.3.1",
"babel-core": "^7.0.0-bridge",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"babel-jest": "^26.6.3yarn",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-module-resolver": "^4.1.0",
"enzyme": "^3.6.0",
@ -101,7 +103,7 @@
"http-proxy-middleware": "^0.18.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.6.3",
"jest-runner-eslint": "^0.10.0",
"jest-runner-eslint": "^1.0.1",
"node-sass": "^7.0.0",
"parcel": "^2.0.0",
"prettier": "2.2.1",

42
ui/tsconfig.test.json Normal file
View File

@ -0,0 +1,42 @@
{
"compilerOptions": {
"types": [
"node",
"lodash",
"enzyme",
"react",
"prop-types",
"jest",
"react-router",
"text-encoding",
"react-dnd",
"react-dnd-html5-backend"
],
"target": "es6",
"module": "es2020",
"moduleResolution": "node",
"lib": ["es6", "es2017", "dom", "webworker","ES2020.Promise"],
"skipLibCheck": true,
"isolatedModules": false,
"esModuleInterop": true,
"jsx": "react",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noImplicitAny": false,
"noImplicitUseStrict": false,
"noUnusedParameters": true,
"noUnusedLocals": true,
"removeComments": true,
"noLib": false,
"preserveConstEnums": true,
"suppressImplicitAnyIndexErrors": true,
"allowSyntheticDefaultImports": true,
"allowJs": true,
"checkJs": false,
"sourceMap": true,
"baseUrl": "./",
"rootDir": "./",
"outDir": "./build"
},
"exclude": ["assets", "build", "node_modules", "cypress"]
}

868
yarn.lock

File diff suppressed because it is too large Load Diff