Skip to content

Commit

Permalink
fix: types for ClassNames and .babelrc for jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olzzon committed Mar 17, 2021
1 parent b58da35 commit f9e4d16
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 71 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"@babel/preset-typescript"
]
}
3 changes: 1 addition & 2 deletions client/components/Channel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react'
//@ts-ignore
import * as ClassNames from 'classnames'
import ClassNames from 'classnames'
import { connect } from 'react-redux'
import VuMeter from './VuMeter'
import { Store, compose } from 'redux'
Expand Down
3 changes: 1 addition & 2 deletions client/components/ChannelMonitorOptions.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { ChangeEvent } from 'react'
//@ts-ignore
import * as ClassNames from 'classnames'
import ClassNames from 'classnames'

import '../assets/css/ChannelMonitorOptions.css'
import { Store } from 'redux'
Expand Down
3 changes: 1 addition & 2 deletions client/components/ChannelRouteSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
//@ts-ignore
import * as ClassNames from 'classnames'
import ClassNames from 'classnames'

import '../assets/css/ChannelRouteSettings.css'
import { Store } from 'redux'
Expand Down
3 changes: 1 addition & 2 deletions client/components/Channels.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react'
import { connect } from 'react-redux'
//@ts-ignore
import * as ClassNames from 'classnames'
import ClassNames from 'classnames'

import Channel from './Channel'
import '../assets/css/Channels.css'
Expand Down
3 changes: 1 addition & 2 deletions client/components/MiniChannel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react'
//@ts-ignore
import * as ClassNames from 'classnames'
import ClassNames from 'classnames'
import { connect } from 'react-redux'
import { Store } from 'redux'
import '../assets/css/NoUiSlider.css'
Expand Down
3 changes: 1 addition & 2 deletions client/components/PagesSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { ChangeEvent } from 'react'
//@ts-ignore
import * as ClassNames from 'classnames'
import ClassNames from 'classnames'

import '../assets/css/PagesSettings.css'
import { Store } from 'redux'
Expand Down
60 changes: 26 additions & 34 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
module.exports = {
preset: 'ts-jest',
globals: {
'ts-jest': {
tsConfig: 'tsconfig-test.json',
babelConfig: '.babelrc'
}
},
testEnvironment: 'node',
testPathIgnorePatterns: [
"dist",
"integrationTests"
],
moduleFileExtensions: [
'js',
'ts'
],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
testMatch: [
'**/__tests__/**/*.spec.(ts|js)',
],
coverageThreshold: {
global: {
branches: 0,
functions: 0,
lines: 0,
statements: 0,
},
},
coverageDirectory: './coverage/',
collectCoverage: true,
}
module.exports = {
preset: 'ts-jest',
globals: {
'ts-jest': {
tsconfig: 'tsconfig-test.json',
babelConfig: '.babelrc',
},
},
testEnvironment: 'node',
testPathIgnorePatterns: ['dist', 'integrationTests'],
moduleFileExtensions: ['js', 'ts'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
testMatch: ['**/__tests__/**/*.spec.(ts|js)'],
coverageThreshold: {
global: {
branches: 0,
functions: 0,
lines: 0,
statements: 0,
},
},
coverageDirectory: './coverage/',
collectCoverage: true,
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@
"winston-elasticsearch": "^0.15.2"
},
"devDependencies": {
"@babel/preset-typescript": "^7.13.0",
"@types/classnames": "^2.2.11",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/jest": "^26.0.20",
"@types/jquery": "^3.5.5",
Expand Down
46 changes: 22 additions & 24 deletions tsconfig-test.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
{
"compilerOptions": {
// Target latest version of ECMAScript.
"target": "es5",
// Search under node_modules for non-relative imports.
"moduleResolution": "node",
// Process & infer types from .js files.
"allowJs": false,
// Don't emit; allow Babel to transform files.
"noEmit": false,
// Enable strictest settings like strictNullChecks & noImplicitAny.
"strict": false,
// Disallow features that require cross-file information for emit.
"isolatedModules": false,
// Import non-ES modules as default imports.
"esModuleInterop": true,
//Support for jsx.
"jsx": "react",
// Check for "any" while converting to TS this can be turned off.
"noImplicitAny": true,
"module": "commonjs",
"allowSyntheticDefaultImports": true
// Target latest version of ECMAScript.
"target": "es5",
// Search under node_modules for non-relative imports.
"moduleResolution": "node",
// Process & infer types from .js files.
"allowJs": false,
// Don't emit; allow Babel to transform files.
"noEmit": false,
// Enable strictest settings like strictNullChecks & noImplicitAny.
"strict": false,
// Disallow features that require cross-file information for emit.
"isolatedModules": false,
// Import non-ES modules as default imports.
"esModuleInterop": true,
//Support for jsx.
"jsx": "react",
// Check for "any" while converting to TS this can be turned off.
"noImplicitAny": false,
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"include": [
"src"
]
}
"include": ["src"]
}
43 changes: 42 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@
browserslist "^4.14.5"
semver "^6.3.0"

"@babel/helper-create-class-features-plugin@^7.13.0":
version "7.13.11"
resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.13.11.tgz#30d30a005bca2c953f5653fc25091a492177f4f6"
integrity sha512-ays0I7XYq9xbjCSvT+EvysLgfc3tOkwCULHjrnscGT3A9qD4sk3wXnJ3of0MAWsWGjdinFvajHU2smYuqXKMrw==
dependencies:
"@babel/helper-function-name" "^7.12.13"
"@babel/helper-member-expression-to-functions" "^7.13.0"
"@babel/helper-optimise-call-expression" "^7.12.13"
"@babel/helper-replace-supers" "^7.13.0"
"@babel/helper-split-export-declaration" "^7.12.13"

"@babel/helper-function-name@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.12.13.tgz#93ad656db3c3c2232559fd7b2c3dbdcbe0eb377a"
Expand Down Expand Up @@ -107,7 +118,7 @@
dependencies:
"@babel/types" "^7.12.13"

"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.8.0":
"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.8.0":
version "7.13.0"
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.13.0.tgz#806526ce125aed03373bc416a828321e3a6a33af"
integrity sha512-ZPafIPSwzUlAoWT8DKs1W2VyF2gOWthGd5NGFMsBcMMol+ZhK+EQY/e6V96poa6PA/Bh+C9plWN0hXO1uB8AfQ==
Expand Down Expand Up @@ -253,6 +264,31 @@
dependencies:
"@babel/helper-plugin-utils" "^7.12.13"

"@babel/plugin-syntax-typescript@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.12.13.tgz#9dff111ca64154cef0f4dc52cf843d9f12ce4474"
integrity sha512-cHP3u1JiUiG2LFDKbXnwVad81GvfyIOmCD6HIEId6ojrY0Drfy2q1jw7BwN7dE84+kTnBjLkXoL3IEy/3JPu2w==
dependencies:
"@babel/helper-plugin-utils" "^7.12.13"

"@babel/plugin-transform-typescript@^7.13.0":
version "7.13.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.13.0.tgz#4a498e1f3600342d2a9e61f60131018f55774853"
integrity sha512-elQEwluzaU8R8dbVuW2Q2Y8Nznf7hnjM7+DSCd14Lo5fF63C9qNLbwZYbmZrtV9/ySpSUpkRpQXvJb6xyu4hCQ==
dependencies:
"@babel/helper-create-class-features-plugin" "^7.13.0"
"@babel/helper-plugin-utils" "^7.13.0"
"@babel/plugin-syntax-typescript" "^7.12.13"

"@babel/preset-typescript@^7.13.0":
version "7.13.0"
resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.13.0.tgz#ab107e5f050609d806fbb039bec553b33462c60a"
integrity sha512-LXJwxrHy0N3f6gIJlYbLta1D9BDtHpQeqwzM0LIfjDlr6UE/D5Mc7W4iDiQzaE+ks0sTjT26ArcHWnJVt0QiHw==
dependencies:
"@babel/helper-plugin-utils" "^7.13.0"
"@babel/helper-validator-option" "^7.12.17"
"@babel/plugin-transform-typescript" "^7.13.0"

"@babel/runtime@^7.12.0", "@babel/runtime@^7.12.1", "@babel/runtime@^7.13.6", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.7":
version "7.13.10"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.10.tgz#47d42a57b6095f4468da440388fdbad8bebf0d7d"
Expand Down Expand Up @@ -630,6 +666,11 @@
dependencies:
"@babel/types" "^7.3.0"

"@types/classnames@^2.2.11":
version "2.2.11"
resolved "https://registry.yarnpkg.com/@types/classnames/-/classnames-2.2.11.tgz#2521cc86f69d15c5b90664e4829d84566052c1cf"
integrity sha512-2koNhpWm3DgWRp5tpkiJ8JGc1xTn2q0l+jUNUE7oMKXUf5NpI9AIdC4kbjGNFBdHtcxBD18LAksoudAVhFKCjw==

"@types/component-emitter@^1.2.10":
version "1.2.10"
resolved "https://registry.yarnpkg.com/@types/component-emitter/-/component-emitter-1.2.10.tgz#ef5b1589b9f16544642e473db5ea5639107ef3ea"
Expand Down

0 comments on commit f9e4d16

Please sign in to comment.