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

Chore/autumn clean #1005

Merged
merged 2 commits into from
Dec 3, 2024
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
21 changes: 0 additions & 21 deletions .release-it.js

This file was deleted.

730 changes: 0 additions & 730 deletions CHANGELOG_DEPRECATED.md

This file was deleted.

11 changes: 0 additions & 11 deletions __mocks__/@grafana/faro-web-sdk.ts

This file was deleted.

42 changes: 0 additions & 42 deletions __mocks__/@grafana/ui.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions __mocks__/components/SimpleMap/index.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions __mocks__/grafana/app/core/app_events.ts

This file was deleted.

5 changes: 0 additions & 5 deletions cspell.config.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll bring it back in the near future 😄

This file was deleted.

1 change: 0 additions & 1 deletion dummy.scss

This file was deleted.

9 changes: 5 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ module.exports = {
...config.moduleNameMapper,
'^lodash-es$': 'lodash',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|md)$':
'<rootDir>/src/test/fileMock.js',
'^!raw-loader!*': '<rootDir>/src/test/rawLoaderMock.js',
'^(.+)\\?raw$': '<rootDir>/src/test/rawLoaderMock.js',
'<rootDir>/src/test/mocks/unsupported_file.js',
'^!raw-loader!*': '<rootDir>/src/test/mocks/rawLoader.js',
'^(.+)\\?raw$': '<rootDir>/src/test/mocks/rawLoader.js',
'^grafana/app/core/core$': '<rootDir>/src/test/mocks/grafana/app/core/core.js',
'^grafana/app/core/app_events$': '<rootDir>/src/test/mocks/grafana/app/core/app_events.js',
},
testTimeout: 30000,
// Inform jest to only transform specific node_module packages.
transform: {
...config.transform,
'^.+\\.mjs$': ['@swc/jest'],
'assets/snippets/.+\\.js$': '<rootDir>/src/test/rawLoaderMock.js',
'assets/snippets/.+\\.js$': '<rootDir>/src/test/mocks/rawLoader.js',
},
transformIgnorePatterns: [
nodeModulesToTransform([
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"release:test": "release-it --dry-run --ci --no-git.requireCleanWorkingDir",
"server": "docker compose up --build",
"sign": "npx --yes @grafana/sign-plugin@latest",
"spellcheck": "cspell -c cspell.config.json \"**/*.{ts,tsx,js,go,md,mdx,yml,yaml,json,scss,css}\"",
"test": "jest --all",
"test:changed": "jest --watch --onlyChanged",
"typecheck": "tsc --noEmit",
Expand Down
11 changes: 0 additions & 11 deletions src/__mocks__/MockFormWrapper.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/__mocks__/raw-loader.js

This file was deleted.

43 changes: 0 additions & 43 deletions src/components/Autosizer.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions src/components/__mocks__/Autosizer.tsx

This file was deleted.

6 changes: 6 additions & 0 deletions src/test/jest-setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ global.IntersectionObserver = jest.fn(() => ({
}));

import 'test/mocks/@grafana/runtime';
import 'test/mocks/@grafana/ui';
import 'test/mocks/components/SimpleMap';

// note there are some other mocks set up in jest.config.js
// for example the rawLoader, unsupported_file, grafana/app/core/core
// and grafana/app/core/app_events
30 changes: 30 additions & 0 deletions src/test/mocks/@grafana/ui.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { forwardRef } from 'react';

jest.mock('@grafana/ui', () => {
const actual = jest.requireActual('@grafana/ui');

const Icon = forwardRef((props, ref) => <svg {...props} />);
Icon.displayName = 'Icon';

// Monaco does not render with jest and is stuck at "Loading..."
// There doesn't seem to be a solution to this at this point,
// mocking it instead. Related github issue:
// https://github.com/suren-atoyan/monaco-react/issues/88
const CodeEditor = React.forwardRef((props: any, ref: any) => {
return <textarea ref={ref} data-testid="code-editor" onChange={props.onChange} value={props.value} />;
});
CodeEditor.displayName = 'CodeEditor';

return {
...actual,
Icon,
BigValue: ({ value }: { value: { numeric: number; text?: string; title?: string } }) => (
<div>
{/* {value.numeric} */}
{value.text && <span>{value.text}</span>}
{value.title && <label>{value.title}</label>}
</div>
),
CodeEditor,
};
});
5 changes: 5 additions & 0 deletions src/test/mocks/components/SimpleMap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';

jest.mock(`components/SimpleMap`, () => ({
SimpleMap: () => <div>A pretty map</div>,
}));
3 changes: 3 additions & 0 deletions src/test/mocks/grafana/app/core/app_events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
emit: () => {},
};
File renamed without changes.
File renamed without changes.