packages fix + rewritten correct yarn.lock file

This commit is contained in:
Rares Mardare 2022-11-03 16:20:20 +02:00
parent c01068898a
commit 9cc700fd05
6 changed files with 1921 additions and 908 deletions

View file

@ -0,0 +1,15 @@
{
"presets": [
["@babel/preset-env", { "targets": { "node": "current" } }],
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-transform-destructuring", { "useBuiltIns": true }],
"@babel/plugin-transform-runtime",
"@babel/proposal-class-properties",
"@babel/transform-regenerator",
"@babel/plugin-transform-template-literals",
]
}

View file

@ -1,29 +1,19 @@
const esModules = ['react-colorful', 'uuid', 'ol'].join('|');
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
moduleDirectories: ['node_modules', 'src'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
moduleFileExtensions: ['ts', 'tsx', 'js'],
globals: {
'ts-jest': {
isolatedModules: true,
babelConfig: true
},
},
transform: {
'^.+\\.js?$': require.resolve('babel-jest'),
'^.+\\.jsx?$': require.resolve('babel-jest'),
'^.+\\.ts?$': require.resolve('ts-jest'),
'^.+\\.tsx?$': require.resolve('ts-jest'),
},
transformIgnorePatterns: [`/node_modules/(?!${esModules})`],
moduleNameMapper: {
"grafana/app/(.*)": '<rootDir>/src/jest/grafanaMock.ts',
"jest/outgoingWebhooksStub": '<rootDir>/src/jest/outgoingWebhooksStub.ts',
"^jest$": '<rootDir>/src/jest',
'grafana/app/(.*)': '<rootDir>/src/jest/grafanaMock.ts',
'jest/matchMedia': '<rootDir>/src/jest/matchMedia.ts',
'jest/outgoingWebhooksStub': '<rootDir>/src/jest/outgoingWebhooksStub.ts',
'^jest$': '<rootDir>/src/jest',
'^.+\\.(css|scss)$': '<rootDir>/src/jest/styleMock.ts',
"^lodash-es$": "lodash",
}
};
'^lodash-es$': 'lodash',
},
};

View file

@ -40,13 +40,15 @@
"license": "Apache-2.0",
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.18.10",
"@babel/plugin-proposal-decorators": "^7.20.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
"@babel/plugin-syntax-decorators": "^7.18.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-destructuring": "^7.20.0",
"@babel/plugin-transform-react-constant-elements": "^7.18.12",
"@babel/plugin-transform-runtime": "^7.19.6",
"@babel/plugin-transform-typescript": "^7.18.12",
"@babel/preset-env": "^7.18.10",
"@babel/preset-react": "^7.18.6",
@ -56,11 +58,11 @@
"@grafana/runtime": "^9.1.1",
"@grafana/toolkit": "^9.1.1",
"@grafana/ui": "^9.1.1",
"@jest/globals": "^27.5.1",
"@jest/globals": "29.2.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "12",
"@types/dompurify": "^2.3.4",
"@types/jest": "^27.5.1",
"@types/jest": "29.2.1",
"@types/lodash-es": "^4.17.6",
"@types/react-copy-to-clipboard": "^5.0.4",
"@types/react-dom": "^18.0.6",
@ -76,17 +78,19 @@
"eslint-plugin-react": "^7.31.10",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-rulesdir": "^0.2.1",
"jest": "^27.5.1",
"jest-environment-jsdom": "^27.5.1",
"jest": "29.2.2",
"jest-environment-jsdom": "^29.2.2",
"lint-staged": "^10.2.11",
"lodash-es": "^4.17.21",
"moment-timezone": "^0.5.35",
"plop": "^2.7.4",
"postcss-loader": "^7.0.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-test-renderer": "^17.0.2",
"stylelint-config-prettier": "^9.0.3",
"stylelint-prettier": "^2.0.0",
"ts-jest": "^27.1.3",
"ts-jest": "29.0.3",
"ts-loader": "^9.3.1",
"typescript": "4.6.4",
"webpack-bundle-analyzer": "^4.6.1"

View file

@ -1,4 +1,4 @@
import 'jest/matchMedia.ts';
import 'src/jest/matchMedia.ts';
import React from 'react';
import { describe, expect, test } from '@jest/globals';
@ -33,4 +33,4 @@ describe('CardButton', () => {
function getRootBlockEl(): HTMLElement {
return screen.queryByTestId<HTMLElement>('test__cardButton');
}
});
});

View file

@ -8,7 +8,7 @@ import outgoingWebhooksStub from 'jest/outgoingWebhooksStub';
import { OutgoingWebhook } from 'models/outgoing_webhook/outgoing_webhook.types';
import { OutgoingWebhooks } from './OutgoingWebhooks';
import { OutgoingWebhooks } from 'pages/outgoing_webhooks/OutgoingWebhooks';
const outgoingWebhooks = outgoingWebhooksStub as OutgoingWebhook[];
const outgoingWebhookStore = () => ({
@ -21,12 +21,21 @@ const outgoingWebhookStore = () => ({
}, {}),
});
jest.mock('@grafana/runtime', () => ({
config: {
featureToggles: {
topNav: false
},
},
}));
jest.mock('state/useStore', () => ({
useStore: () => ({
outgoingWebhookStore: outgoingWebhookStore(),
isUserActionAllowed: jest.fn().mockReturnValue(true),
}),
}));
jest.mock('@grafana/runtime', () => ({
getLocationSrv: jest.fn(),
}));
@ -71,4 +80,4 @@ describe('OutgoingWebhooks', () => {
function queryEditForm(): HTMLElement {
return screen.getByTestId<HTMLElement>('test__outgoingWebhookEditForm');
}
});
});

File diff suppressed because it is too large Load diff