@backstage/test-utils 1.5.8-next.1 → 1.5.9-next.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 CHANGED
@@ -1,5 +1,32 @@
1
1
  # @backstage/test-utils
2
2
 
3
+ ## 1.5.9-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/core-app-api@1.14.1-next.0
9
+ - @backstage/config@1.2.0
10
+ - @backstage/core-plugin-api@1.9.3
11
+ - @backstage/theme@0.5.6
12
+ - @backstage/types@1.1.1
13
+ - @backstage/plugin-permission-common@0.8.0
14
+ - @backstage/plugin-permission-react@0.4.24
15
+
16
+ ## 1.5.8
17
+
18
+ ### Patch Changes
19
+
20
+ - 95a3a0b: Rename frontend and backend `setupRequestMockHandlers` methods to `registerMswTestHooks`.
21
+ - Updated dependencies
22
+ - @backstage/plugin-permission-common@0.8.0
23
+ - @backstage/core-app-api@1.14.0
24
+ - @backstage/plugin-permission-react@0.4.24
25
+ - @backstage/config@1.2.0
26
+ - @backstage/core-plugin-api@1.9.3
27
+ - @backstage/theme@0.5.6
28
+ - @backstage/types@1.1.1
29
+
3
30
  ## 1.5.8-next.1
4
31
 
5
32
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/test-utils__alpha",
3
- "version": "1.5.8-next.1",
3
+ "version": "1.5.9-next.0",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
@@ -0,0 +1,8 @@
1
+ import { registerMswTestHooks } from './testUtils/msw/registerMswTestHooks.esm.js';
2
+
3
+ function setupRequestMockHandlers(worker) {
4
+ registerMswTestHooks(worker);
5
+ }
6
+
7
+ export { setupRequestMockHandlers };
8
+ //# sourceMappingURL=deprecated.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated.esm.js","sources":["../src/deprecated.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { registerMswTestHooks } from './testUtils/msw';\n\n/**\n * @public\n * @deprecated Use `registerMswTestHooks` from `@backstage/test-utils` instead.\n */\nexport function setupRequestMockHandlers(worker: {\n listen: (t: any) => void;\n close: () => void;\n resetHandlers: () => void;\n}): void {\n registerMswTestHooks(worker);\n}\n"],"names":[],"mappings":";;AAsBO,SAAS,yBAAyB,MAIhC,EAAA;AACP,EAAA,oBAAA,CAAqB,MAAM,CAAA,CAAA;AAC7B;;;;"}
package/dist/index.d.ts CHANGED
@@ -7,6 +7,16 @@ import { EvaluatePermissionRequest, AuthorizeResult, EvaluatePermissionResponse
7
7
  import React, { ReactElement, ReactNode, ComponentType, PropsWithChildren } from 'react';
8
8
  import { RenderOptions, RenderResult, MatcherFunction } from '@testing-library/react';
9
9
 
10
+ /**
11
+ * @public
12
+ * @deprecated Use `registerMswTestHooks` from `@backstage/test-utils` instead.
13
+ */
14
+ declare function setupRequestMockHandlers(worker: {
15
+ listen: (t: any) => void;
16
+ close: () => void;
17
+ resetHandlers: () => void;
18
+ }): void;
19
+
10
20
  /**
11
21
  * Mock implementation of {@link core-plugin-api#AnalyticsApi} with helpers to ensure that events are sent correctly.
12
22
  * Use getEvents in tests to verify captured events.
@@ -338,7 +348,7 @@ declare const textContentMatcher: (text: string) => MatcherFunction;
338
348
  * @public
339
349
  * @param worker - service worker
340
350
  */
341
- declare function setupRequestMockHandlers(worker: {
351
+ declare function registerMswTestHooks(worker: {
342
352
  listen: (t: any) => void;
343
353
  close: () => void;
344
354
  resetHandlers: () => void;
@@ -485,4 +495,4 @@ declare class TestApiRegistry implements ApiHolder {
485
495
  */
486
496
  declare const TestApiProvider: <T extends any[]>(props: TestApiProviderProps<T>) => React.JSX.Element;
487
497
 
488
- export { type AsyncLogCollector, type CollectedLogs, type ErrorWithContext, type LegacyRootOption, type LogCollector, type LogFuncs, MockAnalyticsApi, MockConfigApi, MockErrorApi, type MockErrorApiOptions, MockFetchApi, type MockFetchApiOptions, MockPermissionApi, MockStorageApi, type MockStorageBucket, type SyncLogCollector, TestApiProvider, type TestApiProviderProps, TestApiRegistry, type TestAppOptions, createTestAppWrapper, mockBreakpoint, renderInTestApp, renderWithEffects, setupRequestMockHandlers, textContentMatcher, withLogCollector, wrapInTestApp };
498
+ export { type AsyncLogCollector, type CollectedLogs, type ErrorWithContext, type LegacyRootOption, type LogCollector, type LogFuncs, MockAnalyticsApi, MockConfigApi, MockErrorApi, type MockErrorApiOptions, MockFetchApi, type MockFetchApiOptions, MockPermissionApi, MockStorageApi, type MockStorageBucket, type SyncLogCollector, TestApiProvider, type TestApiProviderProps, TestApiRegistry, type TestAppOptions, createTestAppWrapper, mockBreakpoint, registerMswTestHooks, renderInTestApp, renderWithEffects, setupRequestMockHandlers, textContentMatcher, withLogCollector, wrapInTestApp };
package/dist/index.esm.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { setupRequestMockHandlers } from './deprecated.esm.js';
1
2
  export { MockAnalyticsApi } from './testUtils/apis/AnalyticsApi/MockAnalyticsApi.esm.js';
2
3
  export { MockConfigApi } from './testUtils/apis/ConfigApi/MockConfigApi.esm.js';
3
4
  export { MockErrorApi } from './testUtils/apis/ErrorApi/MockErrorApi.esm.js';
@@ -6,7 +7,7 @@ export { MockPermissionApi } from './testUtils/apis/PermissionApi/MockPermission
6
7
  export { MockStorageApi } from './testUtils/apis/StorageApi/MockStorageApi.esm.js';
7
8
  export { default as mockBreakpoint } from './testUtils/mockBreakpoint.esm.js';
8
9
  export { createTestAppWrapper, renderInTestApp, textContentMatcher, wrapInTestApp } from './testUtils/appWrappers.esm.js';
9
- export { setupRequestMockHandlers } from './testUtils/msw/setupRequestMockHandlers.esm.js';
10
+ export { registerMswTestHooks } from './testUtils/msw/registerMswTestHooks.esm.js';
10
11
  export { withLogCollector } from './testUtils/logCollector.esm.js';
11
12
  export { renderWithEffects } from './testUtils/testingLibrary.esm.js';
12
13
  export { TestApiProvider, TestApiRegistry } from './testUtils/TestApiProvider.esm.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -1,8 +1,8 @@
1
- function setupRequestMockHandlers(worker) {
1
+ function registerMswTestHooks(worker) {
2
2
  beforeAll(() => worker.listen({ onUnhandledRequest: "error" }));
3
3
  afterAll(() => worker.close());
4
4
  afterEach(() => worker.resetHandlers());
5
5
  }
6
6
 
7
- export { setupRequestMockHandlers };
8
- //# sourceMappingURL=setupRequestMockHandlers.esm.js.map
7
+ export { registerMswTestHooks };
8
+ //# sourceMappingURL=registerMswTestHooks.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registerMswTestHooks.esm.js","sources":["../../../src/testUtils/msw/registerMswTestHooks.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Sets up handlers for request mocking\n * @public\n * @param worker - service worker\n */\nexport function registerMswTestHooks(worker: {\n listen: (t: any) => void;\n close: () => void;\n resetHandlers: () => void;\n}) {\n beforeAll(() => worker.listen({ onUnhandledRequest: 'error' }));\n afterAll(() => worker.close());\n afterEach(() => worker.resetHandlers());\n}\n"],"names":[],"mappings":"AAqBO,SAAS,qBAAqB,MAIlC,EAAA;AACD,EAAA,SAAA,CAAU,MAAM,MAAO,CAAA,MAAA,CAAO,EAAE,kBAAoB,EAAA,OAAA,EAAS,CAAC,CAAA,CAAA;AAC9D,EAAS,QAAA,CAAA,MAAM,MAAO,CAAA,KAAA,EAAO,CAAA,CAAA;AAC7B,EAAU,SAAA,CAAA,MAAM,MAAO,CAAA,aAAA,EAAe,CAAA,CAAA;AACxC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/test-utils",
3
- "version": "1.5.8-next.1",
3
+ "version": "1.5.9-next.0",
4
4
  "description": "Utilities to test Backstage plugins and apps.",
5
5
  "backstage": {
6
6
  "role": "web-library"
@@ -49,10 +49,10 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@backstage/config": "^1.2.0",
52
- "@backstage/core-app-api": "^1.13.1-next.1",
52
+ "@backstage/core-app-api": "^1.14.1-next.0",
53
53
  "@backstage/core-plugin-api": "^1.9.3",
54
- "@backstage/plugin-permission-common": "^0.7.14",
55
- "@backstage/plugin-permission-react": "^0.4.23",
54
+ "@backstage/plugin-permission-common": "^0.8.0",
55
+ "@backstage/plugin-permission-react": "^0.4.24",
56
56
  "@backstage/theme": "^0.5.6",
57
57
  "@backstage/types": "^1.1.1",
58
58
  "@material-ui/core": "^4.12.2",
@@ -63,7 +63,7 @@
63
63
  "zen-observable": "^0.10.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@backstage/cli": "^0.26.11-next.1",
66
+ "@backstage/cli": "^0.27.0-next.0",
67
67
  "@testing-library/jest-dom": "^6.0.0",
68
68
  "msw": "^1.0.0"
69
69
  },
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupRequestMockHandlers.esm.js","sources":["../../../src/testUtils/msw/setupRequestMockHandlers.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Sets up handlers for request mocking\n * @public\n * @param worker - service worker\n */\nexport function setupRequestMockHandlers(worker: {\n listen: (t: any) => void;\n close: () => void;\n resetHandlers: () => void;\n}) {\n beforeAll(() => worker.listen({ onUnhandledRequest: 'error' }));\n afterAll(() => worker.close());\n afterEach(() => worker.resetHandlers());\n}\n"],"names":[],"mappings":"AAqBO,SAAS,yBAAyB,MAItC,EAAA;AACD,EAAA,SAAA,CAAU,MAAM,MAAO,CAAA,MAAA,CAAO,EAAE,kBAAoB,EAAA,OAAA,EAAS,CAAC,CAAA,CAAA;AAC9D,EAAS,QAAA,CAAA,MAAM,MAAO,CAAA,KAAA,EAAO,CAAA,CAAA;AAC7B,EAAU,SAAA,CAAA,MAAM,MAAO,CAAA,aAAA,EAAe,CAAA,CAAA;AACxC;;;;"}