Skip to content

Commit 2683d98

Browse files
Add ability to use typescript in tests (#2731)
## Which problem is this PR solving? Better DX, Find References in VS Code doesn't work correctly when functions are used in test.js files ## Description of the changes Allow using TS in tests Docs which describe how to setup jest with TS https://jestjs.io/docs/getting-started#type-definitions --------- Signed-off-by: Damian Maslanka <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
1 parent 01c42e0 commit 2683d98

File tree

5 files changed

+45
-3
lines changed

5 files changed

+45
-3
lines changed

package-lock.json

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/jaeger-ui/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@testing-library/react": "^15.0.7",
2020
"@testing-library/user-event": "^14.6.1",
2121
"@types/deep-freeze": "^0.1.1",
22+
"@types/jest": "^29.5.14",
2223
"@types/lodash": "^4.17.0",
2324
"@types/object-hash": "^3.0.2",
2425
"@types/react": "^18.3.11",

packages/jaeger-ui/src/components/TracePage/TraceStatistics/generateDropdownValue.test.js renamed to packages/jaeger-ui/src/components/TracePage/TraceStatistics/generateDropdownValue.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import transformTraceData from '../../../model/transform-trace-data';
1717

1818
import testTrace from './tableValuesTestTrace/testTrace.json';
1919

20-
const transformedTrace = transformTraceData(testTrace);
20+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
21+
const transformedTrace = transformTraceData(testTrace as any)!;
2122

2223
describe(' generateDropdownValue', () => {
2324
it('check generateDropdownValue', () => {

packages/jaeger-ui/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
// limitations under the License.
1414
{
1515
"extends": "../../tsconfig",
16-
"include": ["src/**/*.tsx", "typings"]
16+
"include": ["src/**/*.tsx", "src/**/*.ts", "src/**/*.json", "typings"]
1717
}

scripts/generateDepcheckrcJaegerUI.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const packageNames = [
2828
...babelConfiguration.plugins,
2929
];
3030

31-
const otherPackages = ['jest-environment-jsdom'];
31+
const otherPackages = ['jest-environment-jsdom', '@types/jest'];
3232

3333
// Use the selected targetPackage for generating depcheckrcContent
3434
const depcheckrcContent = {

0 commit comments

Comments
 (0)