@grafana/create-plugin 6.1.13-canary.2250.19497387794.0 → 6.1.13-canary.2313.19498365291.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,6 +33,7 @@
33
33
  "@types/react": "^18.3.0",
34
34
  "@types/react-dom": "^18.3.0",{{#if isAppType}}{{#unless useReactRouterV6}}
35
35
  "@types/react-router-dom": "^{{ reactRouterVersion }}",{{/unless}}{{/if}}
36
+ "@types/testing-library__jest-dom": "5.14.8",
36
37
  "@typescript-eslint/eslint-plugin": "^8.3.0",
37
38
  "@typescript-eslint/parser": "^8.3.0",{{#unless useExperimentalRspack}}
38
39
  "copy-webpack-plugin": "^11.0.0",{{/unless}}
@@ -1,25 +0,0 @@
1
- import { isVersionGreater, removeDependenciesFromPackageJson } from '../utils.js';
2
-
3
- function migrate(context) {
4
- if (context.doesFileExist("package.json")) {
5
- const packageJson = JSON.parse(context.getFile("package.json") || "{}");
6
- if (isVersionGreater(packageJson.devDependencies["@testing-library/jest-dom"], "6.0.0", true)) {
7
- if (context.doesFileExist("./.config/types/setupTests.d.ts")) {
8
- const setupTestsContent = context.getFile("./.config/types/setupTests.d.ts");
9
- if (!setupTestsContent?.includes("@testing-library/jest-dom")) {
10
- context.updateFile(
11
- "./.config/types/setupTests.d.ts",
12
- `import '@testing-library/jest-dom';
13
- ${setupTestsContent}`
14
- );
15
- }
16
- } else {
17
- context.addFile("./.config/types/setupTests.d.ts", "import '@testing-library/jest-dom';\n");
18
- }
19
- removeDependenciesFromPackageJson(context, [], ["@types/testing-library__jest-dom"]);
20
- }
21
- }
22
- return context;
23
- }
24
-
25
- export { migrate as default };
@@ -1,137 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import migrate from './007-remove-testing-library-types.js';
3
- import { Context } from '../context.js';
4
-
5
- describe('006-remove-testing-library-types', () => {
6
- it('should create setupTests.d.ts, remove types package, and add @testing-library/jest-dom when file does not exist', () => {
7
- const context = new Context('/virtual');
8
-
9
- context.addFile(
10
- 'package.json',
11
- JSON.stringify({
12
- devDependencies: {
13
- '@types/testing-library__jest-dom': '^6.0.0',
14
- '@testing-library/jest-dom': '6.0.0',
15
- '@testing-library/react': '14.0.0',
16
- },
17
- })
18
- );
19
-
20
- const result = migrate(context);
21
- const setupTestsContent = result.getFile('./.config/types/setupTests.d.ts');
22
- expect(setupTestsContent).toBe("import '@testing-library/jest-dom';\n");
23
-
24
- const packageJson = JSON.parse(result.getFile('package.json') || '{}');
25
- expect(packageJson.devDependencies).toEqual({
26
- '@testing-library/jest-dom': '6.0.0',
27
- '@testing-library/react': '14.0.0',
28
- });
29
- });
30
-
31
- it('should add import to existing setupTests.d.ts, remove types package, and add @testing-library/jest-dom if missing', () => {
32
- const context = new Context('/virtual');
33
-
34
- const existingContent = '// Some other type declarations\n';
35
- context.addFile('./.config/types/setupTests.d.ts', existingContent);
36
- context.addFile(
37
- 'package.json',
38
- JSON.stringify({
39
- devDependencies: {
40
- '@types/testing-library__jest-dom': '^6.0.0',
41
- '@testing-library/jest-dom': '6.1.4',
42
- '@testing-library/react': '14.0.0',
43
- },
44
- })
45
- );
46
-
47
- const result = migrate(context);
48
- const setupTestsContent = result.getFile('./.config/types/setupTests.d.ts');
49
- expect(setupTestsContent).toBe(`import '@testing-library/jest-dom';\n${existingContent}`);
50
-
51
- const packageJson = JSON.parse(result.getFile('package.json') || '{}');
52
- expect(packageJson.devDependencies).toEqual({
53
- '@testing-library/jest-dom': '6.1.4',
54
- '@testing-library/react': '14.0.0',
55
- });
56
- });
57
-
58
- it('should not modify setupTests.d.ts if import already exists', () => {
59
- const context = new Context('/virtual');
60
-
61
- const existingContent = "// Other content\nimport 'react';\nimport '@testing-library/jest-dom';\n";
62
- context.addFile('./.config/types/setupTests.d.ts', existingContent);
63
- context.addFile(
64
- 'package.json',
65
- JSON.stringify({
66
- devDependencies: {
67
- '@types/testing-library__jest-dom': '^6.0.0',
68
- '@testing-library/jest-dom': '6.1.4',
69
- '@testing-library/react': '14.0.0',
70
- },
71
- })
72
- );
73
-
74
- const result = migrate(context);
75
-
76
- const setupTestsContent = result.getFile('./.config/types/setupTests.d.ts');
77
- expect(setupTestsContent).toBe(existingContent);
78
-
79
- const packageJson = JSON.parse(result.getFile('package.json') || '{}');
80
- expect(packageJson.devDependencies).toEqual({
81
- '@testing-library/jest-dom': '6.1.4',
82
- '@testing-library/react': '14.0.0',
83
- });
84
- });
85
-
86
- it('should not modify anything if @testing-library/jest-dom is not greater than 6.0.0', () => {
87
- const context = new Context('/virtual');
88
- const packageJsonContent = JSON.stringify({
89
- devDependencies: { '@testing-library/jest-dom': '5.14.2' },
90
- });
91
- context.addFile('package.json', packageJsonContent);
92
-
93
- const result = migrate(context);
94
- expect(result.getFile('package.json')).toEqual(packageJsonContent);
95
- });
96
-
97
- it('should handle package.json without the types package', () => {
98
- const context = new Context('/virtual');
99
-
100
- context.addFile(
101
- 'package.json',
102
- JSON.stringify({
103
- devDependencies: {
104
- '@testing-library/react': '14.0.0',
105
- '@testing-library/jest-dom': '6.1.4',
106
- },
107
- })
108
- );
109
-
110
- const result = migrate(context);
111
- const setupTestsContent = result.getFile('./.config/types/setupTests.d.ts');
112
- expect(setupTestsContent).toBe("import '@testing-library/jest-dom';\n");
113
-
114
- const packageJson = JSON.parse(result.getFile('package.json') || '{}');
115
- expect(packageJson.devDependencies).toEqual({
116
- '@testing-library/jest-dom': '6.1.4',
117
- '@testing-library/react': '14.0.0',
118
- });
119
- });
120
-
121
- it('should be idempotent', async () => {
122
- const context = new Context('/virtual');
123
-
124
- context.addFile(
125
- 'package.json',
126
- JSON.stringify({
127
- devDependencies: {
128
- '@types/testing-library__jest-dom': '^6.0.0',
129
- '@testing-library/jest-dom': '6.1.4',
130
- '@testing-library/react': '14.0.0',
131
- },
132
- })
133
- );
134
-
135
- await expect(migrate).toBeIdempotent(context);
136
- });
137
- });
@@ -1,25 +0,0 @@
1
- import type { Context } from '../context.js';
2
- import { removeDependenciesFromPackageJson, isVersionGreater } from '../utils.js';
3
-
4
- export default function migrate(context: Context) {
5
- if (context.doesFileExist('package.json')) {
6
- const packageJson = JSON.parse(context.getFile('package.json') || '{}');
7
- if (isVersionGreater(packageJson.devDependencies['@testing-library/jest-dom'], '6.0.0', true)) {
8
- if (context.doesFileExist('./.config/types/setupTests.d.ts')) {
9
- const setupTestsContent = context.getFile('./.config/types/setupTests.d.ts');
10
- if (!setupTestsContent?.includes('@testing-library/jest-dom')) {
11
- context.updateFile(
12
- './.config/types/setupTests.d.ts',
13
- `import '@testing-library/jest-dom';\n${setupTestsContent}`
14
- );
15
- }
16
- } else {
17
- context.addFile('./.config/types/setupTests.d.ts', "import '@testing-library/jest-dom';\n");
18
- }
19
-
20
- removeDependenciesFromPackageJson(context, [], ['@types/testing-library__jest-dom']);
21
- }
22
- }
23
-
24
- return context;
25
- }
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';