@backstage/cli 0.30.1-next.0 → 0.31.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.
- package/CHANGELOG.md +55 -0
- package/config/eslint-factory.js +2 -2
- package/dist/commands/index.cjs.js +3 -28
- package/dist/commands/new/new.cjs.js +1 -2
- package/dist/modules/build/lib/packager/productionPack.cjs.js +9 -4
- package/dist/{commands → modules/lint/commands/package}/lint.cjs.js +2 -2
- package/dist/{commands → modules/lint/commands}/repo/lint.cjs.js +4 -4
- package/dist/modules/lint/index.cjs.js +40 -0
- package/dist/packages/backend-defaults/package.json.cjs.js +1 -1
- package/dist/packages/backend-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/backend-test-utils/package.json.cjs.js +1 -1
- package/dist/packages/cli/package.json.cjs.js +2 -2
- package/dist/packages/core-app-api/package.json.cjs.js +1 -1
- package/dist/packages/core-components/package.json.cjs.js +1 -1
- package/dist/packages/core-plugin-api/package.json.cjs.js +1 -1
- package/dist/packages/dev-utils/package.json.cjs.js +1 -1
- package/dist/packages/test-utils/package.json.cjs.js +1 -1
- package/dist/plugins/auth-backend/package.json.cjs.js +1 -1
- package/dist/plugins/auth-backend-module-guest-provider/package.json.cjs.js +1 -1
- package/dist/plugins/catalog-node/package.json.cjs.js +1 -1
- package/dist/plugins/scaffolder-node/package.json.cjs.js +1 -1
- package/dist/plugins/scaffolder-node-test-utils/package.json.cjs.js +1 -1
- package/package.json +28 -28
- package/templates/frontend-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.test.tsx.hbs +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# @backstage/cli
|
|
2
2
|
|
|
3
|
+
## 0.31.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5b70679: **BREAKING**: ESLint warnings no longer trigger system exit codes like errors do.
|
|
8
|
+
|
|
9
|
+
Set the max number of warnings to `-1` during linting to enable the gradual adoption of new ESLint rules. To restore the previous behavior, include the `--max-warnings 0` flag in the `backstage-cli <repo|package> lint` command.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0586d4c: Internal change to move the `migrate` and `version:*` commands into a new migrate module.
|
|
14
|
+
- e0b226b: build(deps): bump `esbuild` from 0.24.2 to 0.25.0
|
|
15
|
+
- 4d45498: Fixed the package prepack command so that it no longer produces unnecessary `index` entries in the `typesVersions` map, which could cause `/index` to be added when automatically adding imports.
|
|
16
|
+
- 485b3ba: Internal update to move `test` commands to a separate module.
|
|
17
|
+
- a76c482: Internal change to migrate `lint` to the new module system.
|
|
18
|
+
- 8df78bf: Internal update to move build commands to a CLI module.
|
|
19
|
+
- d0fc357: Internal update to move `info` commands to a separate module.
|
|
20
|
+
- f8bd342: Fix a bug in the translation of the deprecated `--scope` option for the `new` command that could cause plugins to have `backstage-backstage-plugin` in their name.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @backstage/config-loader@1.10.0
|
|
23
|
+
- @backstage/integration@1.16.2
|
|
24
|
+
- @backstage/catalog-model@1.7.3
|
|
25
|
+
- @backstage/cli-common@0.1.15
|
|
26
|
+
- @backstage/cli-node@0.2.13
|
|
27
|
+
- @backstage/config@1.3.2
|
|
28
|
+
- @backstage/errors@1.2.7
|
|
29
|
+
- @backstage/eslint-plugin@0.1.10
|
|
30
|
+
- @backstage/release-manifests@0.0.12
|
|
31
|
+
- @backstage/types@1.2.1
|
|
32
|
+
|
|
33
|
+
## 0.31.0-next.1
|
|
34
|
+
|
|
35
|
+
### Minor Changes
|
|
36
|
+
|
|
37
|
+
- 5b70679: **BREAKING**: ESLint warnings no longer trigger system exit codes like errors do.
|
|
38
|
+
|
|
39
|
+
Set the max number of warnings to `-1` during linting to enable the gradual adoption of new ESLint rules. To restore the previous behavior, include the `--max-warnings 0` flag in the `backstage-cli <repo|package> lint` command.
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- e0b226b: build(deps): bump `esbuild` from 0.24.2 to 0.25.0
|
|
44
|
+
- 4d45498: Fixed the package prepack command so that it no longer produces unnecessary `index` entries in the `typesVersions` map, which could cause `/index` to be added when automatically adding imports.
|
|
45
|
+
- f8bd342: Fix a bug in the translation of the deprecated `--scope` option for the `new` command that could cause plugins to have `backstage-backstage-plugin` in their name.
|
|
46
|
+
- Updated dependencies
|
|
47
|
+
- @backstage/config-loader@1.10.0-next.0
|
|
48
|
+
- @backstage/integration@1.16.2-next.0
|
|
49
|
+
- @backstage/catalog-model@1.7.3
|
|
50
|
+
- @backstage/cli-common@0.1.15
|
|
51
|
+
- @backstage/cli-node@0.2.13
|
|
52
|
+
- @backstage/config@1.3.2
|
|
53
|
+
- @backstage/errors@1.2.7
|
|
54
|
+
- @backstage/eslint-plugin@0.1.10
|
|
55
|
+
- @backstage/release-manifests@0.0.12
|
|
56
|
+
- @backstage/types@1.2.1
|
|
57
|
+
|
|
3
58
|
## 0.30.1-next.0
|
|
4
59
|
|
|
5
60
|
### Patch Changes
|
package/config/eslint-factory.js
CHANGED
|
@@ -95,7 +95,7 @@ function createConfig(dir, extraConfig = {}) {
|
|
|
95
95
|
'@typescript-eslint/no-unused-expressions': 'error',
|
|
96
96
|
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
97
97
|
'@typescript-eslint/no-unused-vars': [
|
|
98
|
-
'
|
|
98
|
+
'error',
|
|
99
99
|
{
|
|
100
100
|
vars: 'all',
|
|
101
101
|
args: 'after-used',
|
|
@@ -173,7 +173,7 @@ function createConfig(dir, extraConfig = {}) {
|
|
|
173
173
|
'no-unused-vars': 'off',
|
|
174
174
|
'unused-imports/no-unused-imports': 'error',
|
|
175
175
|
'unused-imports/no-unused-vars': [
|
|
176
|
-
'
|
|
176
|
+
'error',
|
|
177
177
|
{
|
|
178
178
|
vars: 'all',
|
|
179
179
|
varsIgnorePattern: '^_',
|
|
@@ -6,28 +6,13 @@ var index$2 = require('../modules/build/index.cjs.js');
|
|
|
6
6
|
var index$3 = require('../modules/info/index.cjs.js');
|
|
7
7
|
var index$1 = require('../modules/migrate/index.cjs.js');
|
|
8
8
|
var index$4 = require('../modules/test/index.cjs.js');
|
|
9
|
+
var index$5 = require('../modules/lint/index.cjs.js');
|
|
9
10
|
|
|
10
11
|
function registerRepoCommand(program) {
|
|
11
12
|
const command = program.command("repo [command]").description("Command that run across an entire Backstage project");
|
|
12
13
|
index$2.registerRepoCommands(command);
|
|
13
14
|
index$4.registerRepoCommands(command);
|
|
14
|
-
|
|
15
|
-
"--format <format>",
|
|
16
|
-
"Lint report output format",
|
|
17
|
-
"eslint-formatter-friendly"
|
|
18
|
-
).option(
|
|
19
|
-
"--output-file <path>",
|
|
20
|
-
"Write the lint report to a file instead of stdout"
|
|
21
|
-
).option(
|
|
22
|
-
"--since <ref>",
|
|
23
|
-
"Only lint packages that changed since the specified ref"
|
|
24
|
-
).option(
|
|
25
|
-
"--successCache",
|
|
26
|
-
"Enable success caching, which skips running tests for unchanged packages that were successful in the previous run"
|
|
27
|
-
).option(
|
|
28
|
-
"--successCacheDir <path>",
|
|
29
|
-
"Set the success cache location, (default: node_modules/.cache/backstage-cli)"
|
|
30
|
-
).option("--fix", "Attempt to automatically fix violations").action(lazy.lazy(() => import('./repo/lint.cjs.js'), "command"));
|
|
15
|
+
index$5.registerRepoCommands(command);
|
|
31
16
|
command.command("fix").description("Automatically fix packages in the project").option(
|
|
32
17
|
"--publish",
|
|
33
18
|
"Enable additional fixes that only apply when publishing packages"
|
|
@@ -46,17 +31,7 @@ function registerScriptCommand(program) {
|
|
|
46
31
|
).option("--require <path>", "Add a --require argument to the node process").option("--link <path>", "Link an external workspace for module resolution").action(lazy.lazy(() => import('./start/index.cjs.js'), "command"));
|
|
47
32
|
index$2.registerPackageCommands(command);
|
|
48
33
|
index$4.registerPackageCommands(command);
|
|
49
|
-
|
|
50
|
-
"--format <format>",
|
|
51
|
-
"Lint report output format",
|
|
52
|
-
"eslint-formatter-friendly"
|
|
53
|
-
).option(
|
|
54
|
-
"--output-file <path>",
|
|
55
|
-
"Write the lint report to a file instead of stdout"
|
|
56
|
-
).option("--fix", "Attempt to automatically fix violations").option(
|
|
57
|
-
"--max-warnings <number>",
|
|
58
|
-
"Fail if more than this number of warnings. -1 allows warnings. (default: 0)"
|
|
59
|
-
).description("Lint a package").action(lazy.lazy(() => import('./lint.cjs.js'), "default"));
|
|
34
|
+
index$5.registerPackageCommands(command);
|
|
60
35
|
command.command("clean").description("Delete cache directories").action(lazy.lazy(() => import('./clean/clean.cjs.js'), "default"));
|
|
61
36
|
command.command("prepack").description("Prepares a package for packaging before publishing").action(lazy.lazy(() => import('./pack.cjs.js'), "pre"));
|
|
62
37
|
command.command("postpack").description("Restores the changes made by the prepack command").action(lazy.lazy(() => import('./pack.cjs.js'), "post"));
|
|
@@ -17,8 +17,7 @@ var _new = async (opts) => {
|
|
|
17
17
|
let pluginInfix = void 0;
|
|
18
18
|
let packagePrefix = void 0;
|
|
19
19
|
if (scope) {
|
|
20
|
-
|
|
21
|
-
packagePrefix = scope.includes("/") ? `@${scope}${backstagePrefix}` : `@${scope}/${backstagePrefix}`;
|
|
20
|
+
packagePrefix = scope.includes("/") ? `@${scope}` : `@${scope}/`;
|
|
22
21
|
pluginInfix = scope.includes("backstage") ? "plugin-" : "backstage-plugin-";
|
|
23
22
|
}
|
|
24
23
|
if (isPrivate === false || // set to false with --no-private flag
|
|
@@ -88,7 +88,7 @@ async function rewriteEntryPoints(pkg, packageDir, featureDetectionProject) {
|
|
|
88
88
|
const outputExports = {};
|
|
89
89
|
const entryPoints$1 = entryPoints.readEntryPoints(pkg);
|
|
90
90
|
if (pkg.typesVersions) {
|
|
91
|
-
pkg.typesVersions =
|
|
91
|
+
pkg.typesVersions = void 0;
|
|
92
92
|
}
|
|
93
93
|
for (const entryPoint of entryPoints$1) {
|
|
94
94
|
if (!SCRIPT_EXTS.includes(entryPoint.ext)) {
|
|
@@ -106,9 +106,8 @@ async function rewriteEntryPoints(pkg, packageDir, featureDetectionProject) {
|
|
|
106
106
|
if (!pkg.typesVersions) {
|
|
107
107
|
pkg.typesVersions = { "*": {} };
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
];
|
|
109
|
+
const mount = entryPoint.name === "index" ? "*" : entryPoint.name;
|
|
110
|
+
pkg.typesVersions["*"][mount] = [`dist/${entryPoint.name}.d.ts`];
|
|
112
111
|
}
|
|
113
112
|
exp.default = exp.require ?? exp.import;
|
|
114
113
|
if (exp.types && featureDetectionProject) {
|
|
@@ -140,6 +139,12 @@ async function rewriteEntryPoints(pkg, packageDir, featureDetectionProject) {
|
|
|
140
139
|
outputExports[entryPoint.mount] = exp;
|
|
141
140
|
}
|
|
142
141
|
}
|
|
142
|
+
if (pkg.typesVersions?.["*"]) {
|
|
143
|
+
const keys = Object.keys(pkg.typesVersions["*"]);
|
|
144
|
+
if (keys.length === 1 && keys[0] === "*") {
|
|
145
|
+
delete pkg.typesVersions;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
143
148
|
if (pkg.exports) {
|
|
144
149
|
pkg.exports = outputExports;
|
|
145
150
|
pkg.exports["./package.json"] = "./package.json";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var fs = require('fs-extra');
|
|
6
|
-
var paths = require('
|
|
6
|
+
var paths = require('../../../../lib/paths.cjs.js');
|
|
7
7
|
var eslint = require('eslint');
|
|
8
8
|
|
|
9
9
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -19,7 +19,7 @@ var lint = async (directories, opts) => {
|
|
|
19
19
|
const results = await eslint$1.lintFiles(
|
|
20
20
|
directories.length ? directories : ["."]
|
|
21
21
|
);
|
|
22
|
-
const maxWarnings = opts.maxWarnings ??
|
|
22
|
+
const maxWarnings = opts.maxWarnings ?? -1;
|
|
23
23
|
const ignoreWarnings = +maxWarnings === -1;
|
|
24
24
|
const failed = results.some((r) => r.errorCount > 0) || !ignoreWarnings && results.reduce((current, next) => current + next.warningCount, 0) > maxWarnings;
|
|
25
25
|
if (opts.fix) {
|
|
@@ -5,10 +5,10 @@ var fs = require('fs-extra');
|
|
|
5
5
|
var crypto = require('crypto');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var cliNode = require('@backstage/cli-node');
|
|
8
|
-
var paths = require('
|
|
9
|
-
var parallel = require('
|
|
10
|
-
var optionsParser = require('
|
|
11
|
-
var SuccessCache = require('
|
|
8
|
+
var paths = require('../../../../lib/paths.cjs.js');
|
|
9
|
+
var parallel = require('../../../../lib/parallel.cjs.js');
|
|
10
|
+
var optionsParser = require('../../../../commands/repo/optionsParser.cjs.js');
|
|
11
|
+
var SuccessCache = require('../../../../lib/cache/SuccessCache.cjs.js');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
14
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var lazy = require('../../lib/lazy.cjs.js');
|
|
4
|
+
|
|
5
|
+
function registerPackageCommands(command) {
|
|
6
|
+
command.command("lint [directories...]").option(
|
|
7
|
+
"--format <format>",
|
|
8
|
+
"Lint report output format",
|
|
9
|
+
"eslint-formatter-friendly"
|
|
10
|
+
).option(
|
|
11
|
+
"--output-file <path>",
|
|
12
|
+
"Write the lint report to a file instead of stdout"
|
|
13
|
+
).option("--fix", "Attempt to automatically fix violations").option(
|
|
14
|
+
"--max-warnings <number>",
|
|
15
|
+
"Fail if more than this number of warnings. -1 allows warnings. (default: 0)"
|
|
16
|
+
).description("Lint a package").action(lazy.lazy(() => import('./commands/package/lint.cjs.js'), "default"));
|
|
17
|
+
}
|
|
18
|
+
function registerRepoCommands(command) {
|
|
19
|
+
command.command("lint").description("Lint all packages in the project").option(
|
|
20
|
+
"--format <format>",
|
|
21
|
+
"Lint report output format",
|
|
22
|
+
"eslint-formatter-friendly"
|
|
23
|
+
).option(
|
|
24
|
+
"--output-file <path>",
|
|
25
|
+
"Write the lint report to a file instead of stdout"
|
|
26
|
+
).option(
|
|
27
|
+
"--since <ref>",
|
|
28
|
+
"Only lint packages that changed since the specified ref"
|
|
29
|
+
).option(
|
|
30
|
+
"--successCache",
|
|
31
|
+
"Enable success caching, which skips running tests for unchanged packages that were successful in the previous run"
|
|
32
|
+
).option(
|
|
33
|
+
"--successCacheDir <path>",
|
|
34
|
+
"Set the success cache location, (default: node_modules/.cache/backstage-cli)"
|
|
35
|
+
).option("--fix", "Attempt to automatically fix violations").action(lazy.lazy(() => import('./commands/repo/lint.cjs.js'), "command"));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
exports.registerPackageCommands = registerPackageCommands;
|
|
39
|
+
exports.registerRepoCommands = registerRepoCommands;
|
|
40
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var version = "0.
|
|
3
|
+
var version = "0.31.0";
|
|
4
4
|
var dependencies = {
|
|
5
5
|
"@backstage/catalog-model": "workspace:^",
|
|
6
6
|
"@backstage/cli-common": "workspace:^",
|
|
@@ -50,7 +50,7 @@ var dependencies = {
|
|
|
50
50
|
"cross-spawn": "^7.0.3",
|
|
51
51
|
"css-loader": "^6.5.1",
|
|
52
52
|
"ctrlc-windows": "^2.1.0",
|
|
53
|
-
esbuild: "^0.
|
|
53
|
+
esbuild: "^0.25.0",
|
|
54
54
|
"esbuild-loader": "^4.0.0",
|
|
55
55
|
eslint: "^8.6.0",
|
|
56
56
|
"eslint-config-prettier": "^9.0.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "CLI for developing Backstage plugins and apps",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "cli"
|
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@backstage/catalog-model": "1.7.3",
|
|
51
|
-
"@backstage/cli-common": "0.1.15",
|
|
52
|
-
"@backstage/cli-node": "0.2.13",
|
|
53
|
-
"@backstage/config": "1.3.2",
|
|
54
|
-
"@backstage/config-loader": "1.
|
|
55
|
-
"@backstage/errors": "1.2.7",
|
|
56
|
-
"@backstage/eslint-plugin": "0.1.10",
|
|
57
|
-
"@backstage/integration": "1.16.
|
|
58
|
-
"@backstage/release-manifests": "0.0.12",
|
|
59
|
-
"@backstage/types": "1.2.1",
|
|
50
|
+
"@backstage/catalog-model": "^1.7.3",
|
|
51
|
+
"@backstage/cli-common": "^0.1.15",
|
|
52
|
+
"@backstage/cli-node": "^0.2.13",
|
|
53
|
+
"@backstage/config": "^1.3.2",
|
|
54
|
+
"@backstage/config-loader": "^1.10.0",
|
|
55
|
+
"@backstage/errors": "^1.2.7",
|
|
56
|
+
"@backstage/eslint-plugin": "^0.1.10",
|
|
57
|
+
"@backstage/integration": "^1.16.2",
|
|
58
|
+
"@backstage/release-manifests": "^0.0.12",
|
|
59
|
+
"@backstage/types": "^1.2.1",
|
|
60
60
|
"@manypkg/get-packages": "^1.1.3",
|
|
61
61
|
"@module-federation/enhanced": "^0.8.0",
|
|
62
62
|
"@octokit/graphql": "^5.0.0",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"cross-spawn": "^7.0.3",
|
|
96
96
|
"css-loader": "^6.5.1",
|
|
97
97
|
"ctrlc-windows": "^2.1.0",
|
|
98
|
-
"esbuild": "^0.
|
|
98
|
+
"esbuild": "^0.25.0",
|
|
99
99
|
"esbuild-loader": "^4.0.0",
|
|
100
100
|
"eslint": "^8.6.0",
|
|
101
101
|
"eslint-config-prettier": "^9.0.0",
|
|
@@ -163,22 +163,22 @@
|
|
|
163
163
|
"zod-validation-error": "^3.4.0"
|
|
164
164
|
},
|
|
165
165
|
"devDependencies": {
|
|
166
|
-
"@backstage/backend-plugin-api": "1.2.1
|
|
167
|
-
"@backstage/backend-test-utils": "1.3.1
|
|
168
|
-
"@backstage/catalog-client": "1.9.1",
|
|
169
|
-
"@backstage/config": "1.3.2",
|
|
170
|
-
"@backstage/core-app-api": "1.
|
|
171
|
-
"@backstage/core-components": "0.
|
|
172
|
-
"@backstage/core-plugin-api": "1.10.
|
|
173
|
-
"@backstage/dev-utils": "1.1.8
|
|
174
|
-
"@backstage/errors": "1.2.7",
|
|
175
|
-
"@backstage/plugin-auth-backend": "0.24.4
|
|
176
|
-
"@backstage/plugin-auth-backend-module-guest-provider": "0.2.6
|
|
177
|
-
"@backstage/plugin-catalog-node": "1.16.1
|
|
178
|
-
"@backstage/plugin-scaffolder-node": "0.
|
|
179
|
-
"@backstage/plugin-scaffolder-node-test-utils": "0.
|
|
180
|
-
"@backstage/test-utils": "1.7.
|
|
181
|
-
"@backstage/theme": "0.6.4",
|
|
166
|
+
"@backstage/backend-plugin-api": "^1.2.1",
|
|
167
|
+
"@backstage/backend-test-utils": "^1.3.1",
|
|
168
|
+
"@backstage/catalog-client": "^1.9.1",
|
|
169
|
+
"@backstage/config": "^1.3.2",
|
|
170
|
+
"@backstage/core-app-api": "^1.16.0",
|
|
171
|
+
"@backstage/core-components": "^0.17.0",
|
|
172
|
+
"@backstage/core-plugin-api": "^1.10.5",
|
|
173
|
+
"@backstage/dev-utils": "^1.1.8",
|
|
174
|
+
"@backstage/errors": "^1.2.7",
|
|
175
|
+
"@backstage/plugin-auth-backend": "^0.24.4",
|
|
176
|
+
"@backstage/plugin-auth-backend-module-guest-provider": "^0.2.6",
|
|
177
|
+
"@backstage/plugin-catalog-node": "^1.16.1",
|
|
178
|
+
"@backstage/plugin-scaffolder-node": "^0.8.0",
|
|
179
|
+
"@backstage/plugin-scaffolder-node-test-utils": "^0.2.0",
|
|
180
|
+
"@backstage/test-utils": "^1.7.6",
|
|
181
|
+
"@backstage/theme": "^0.6.4",
|
|
182
182
|
"@rspack/core": "^1.0.10",
|
|
183
183
|
"@rspack/dev-server": "^1.0.9",
|
|
184
184
|
"@rspack/plugin-react-refresh": "^1.0.0",
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { renderInTestApp } from '@backstage/test-utils';
|
|
3
3
|
import { ExampleFetchComponent } from './ExampleFetchComponent';
|
|
4
4
|
|
|
5
5
|
describe('ExampleFetchComponent', () => {
|
|
6
6
|
it('renders the user table', async () => {
|
|
7
|
-
|
|
7
|
+
const { getAllByText, getByAltText, getByText, findByRole } =
|
|
8
|
+
await renderInTestApp(<ExampleFetchComponent />);
|
|
8
9
|
|
|
9
10
|
// Wait for the table to render
|
|
10
|
-
const table = await
|
|
11
|
-
const nationality =
|
|
11
|
+
const table = await findByRole('table');
|
|
12
|
+
const nationality = getAllByText('GB');
|
|
12
13
|
// Assert that the table contains the expected user data
|
|
13
14
|
expect(table).toBeInTheDocument();
|
|
14
|
-
expect(
|
|
15
|
-
expect(
|
|
16
|
-
expect(
|
|
15
|
+
expect(getByAltText('Carolyn')).toBeInTheDocument();
|
|
16
|
+
expect(getByText('Carolyn Moore')).toBeInTheDocument();
|
|
17
|
+
expect(getByText('carolyn.moore@example.com')).toBeInTheDocument();
|
|
17
18
|
expect(nationality[0]).toBeInTheDocument();
|
|
18
19
|
});
|
|
19
20
|
});
|