@storybook/angular 8.0.0-alpha.1 → 8.0.0-alpha.11

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.
Files changed (55) hide show
  1. package/dist/builders/build-storybook/index.spec.js +47 -47
  2. package/dist/builders/start-storybook/index.js +0 -1
  3. package/dist/builders/start-storybook/index.spec.js +41 -41
  4. package/dist/builders/utils/run-compodoc.spec.js +38 -47
  5. package/dist/client/angular-beta/AbstractRenderer.d.ts +10 -6
  6. package/dist/client/angular-beta/AbstractRenderer.js +29 -62
  7. package/dist/client/angular-beta/CanvasRenderer.d.ts +0 -1
  8. package/dist/client/angular-beta/CanvasRenderer.js +0 -3
  9. package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +65 -66
  10. package/dist/client/angular-beta/DocsRenderer.d.ts +1 -1
  11. package/dist/client/angular-beta/DocsRenderer.js +4 -2
  12. package/dist/client/angular-beta/RendererFactory.test.js +100 -32
  13. package/dist/client/angular-beta/StorybookModule.test.js +36 -35
  14. package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +0 -1
  15. package/dist/client/angular-beta/StorybookWrapperComponent.js +11 -22
  16. package/dist/client/angular-beta/utils/BootstrapQueue.d.ts +14 -0
  17. package/dist/client/angular-beta/utils/BootstrapQueue.js +81 -0
  18. package/dist/client/angular-beta/utils/BootstrapQueue.test.d.ts +1 -0
  19. package/dist/client/angular-beta/utils/BootstrapQueue.test.js +143 -0
  20. package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +66 -65
  21. package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.js +8 -7
  22. package/dist/client/angular-beta/utils/PropertyExtractor.js +0 -1
  23. package/dist/client/angular-beta/utils/PropertyExtractor.test.js +44 -45
  24. package/dist/client/angular-beta/utils/StoryUID.d.ts +23 -0
  25. package/dist/client/angular-beta/utils/StoryUID.js +46 -0
  26. package/dist/client/argsToTemplate.test.js +20 -19
  27. package/dist/client/decorateStory.test.js +28 -27
  28. package/dist/client/decorators.test.js +16 -15
  29. package/dist/client/docs/__testfixtures__/doc-button/input.js +2 -3
  30. package/dist/client/docs/angular-properties.test.d.ts +1 -1
  31. package/dist/client/docs/angular-properties.test.js +6 -29
  32. package/dist/client/docs/compodoc.test.js +8 -7
  33. package/dist/client/index.d.ts +0 -1
  34. package/dist/client/index.js +0 -3
  35. package/dist/client/public-types.d.ts +8 -14
  36. package/dist/client/types.d.ts +0 -4
  37. package/dist/preset.js +0 -1
  38. package/dist/preset.mjs +0 -1
  39. package/dist/server/angular-cli-webpack.js +0 -1
  40. package/dist/server/framework-preset-angular-ivy.js +0 -1
  41. package/dist/test-setup.d.ts +1 -0
  42. package/dist/test-setup.js +7 -0
  43. package/dist/test-setup.mjs +5 -0
  44. package/package.json +16 -18
  45. package/template/cli/button.component.ts +2 -1
  46. package/template/cli/{Button.stories.ts → button.stories.ts} +7 -10
  47. package/template/cli/header.component.ts +8 -4
  48. package/template/cli/{Header.stories.ts → header.stories.ts} +4 -14
  49. package/template/cli/page.component.ts +7 -2
  50. package/template/cli/{Page.stories.ts → page.stories.ts} +5 -22
  51. package/template/cli/user.ts +3 -0
  52. package/dist/client/public-api.d.ts +0 -1
  53. package/dist/client/public-api.js +0 -17
  54. package/jest.config.js +0 -31
  55. package/template/cli/User.ts +0 -2
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- * @jest-environment node
3
+ * @vitest-environment node
4
4
  */
5
5
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
6
  if (k2 === undefined) k2 = k;
@@ -26,19 +26,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ // eslint-disable-next-line import/no-extraneous-dependencies
30
+ const vitest_1 = require("vitest");
29
31
  const architect_1 = require("@angular-devkit/architect");
30
32
  const testing_1 = require("@angular-devkit/architect/testing");
31
33
  const core_1 = require("@angular-devkit/core");
32
34
  const path = __importStar(require("path"));
33
- const buildDevStandaloneMock = jest.fn();
34
- const buildStaticStandaloneMock = jest.fn();
35
+ const buildDevStandaloneMock = vitest_1.vi.fn();
36
+ const buildStaticStandaloneMock = vitest_1.vi.fn();
35
37
  const buildMock = {
36
38
  buildDevStandalone: buildDevStandaloneMock,
37
39
  buildStaticStandalone: buildStaticStandaloneMock,
38
40
  withTelemetry: (name, options, fn) => fn(),
39
41
  };
40
- jest.doMock('@storybook/core-server', () => buildMock);
41
- jest.doMock('@storybook/cli', () => ({
42
+ vitest_1.vi.doMock('@storybook/core-server', () => buildMock);
43
+ vitest_1.vi.doMock('@storybook/cli', () => ({
42
44
  JsPackageManagerFactory: {
43
45
  getPackageManager: () => ({
44
46
  runPackageCommand: mockRunScript,
@@ -49,14 +51,13 @@ jest.doMock('@storybook/cli', () => ({
49
51
  storybook: 'x.x.x',
50
52
  },
51
53
  }));
52
- jest.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
53
- const mockRunScript = jest.fn();
54
+ vitest_1.vi.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
55
+ const mockRunScript = vitest_1.vi.fn();
54
56
  // Randomly fails on CI. TODO: investigate why
55
- // eslint-disable-next-line jest/no-disabled-tests
56
- describe.skip('Build Storybook Builder', () => {
57
+ vitest_1.describe.skip('Build Storybook Builder', () => {
57
58
  let architect;
58
59
  let architectHost;
59
- beforeEach(async () => {
60
+ (0, vitest_1.beforeEach)(async () => {
60
61
  const registry = new core_1.schema.CoreSchemaRegistry();
61
62
  registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
62
63
  architectHost = new testing_1.TestingArchitectHost();
@@ -78,59 +79,59 @@ describe.skip('Build Storybook Builder', () => {
78
79
  // for the package.json file.
79
80
  await architectHost.addBuilderFromPackage(path.join(__dirname, '../../..'));
80
81
  });
81
- beforeEach(() => {
82
+ (0, vitest_1.beforeEach)(() => {
82
83
  buildStaticStandaloneMock.mockImplementation((_options) => Promise.resolve(_options));
83
84
  });
84
- afterEach(() => {
85
- jest.clearAllMocks();
85
+ (0, vitest_1.afterEach)(() => {
86
+ vitest_1.vi.clearAllMocks();
86
87
  });
87
- it('should start storybook with angularBrowserTarget', async () => {
88
+ (0, vitest_1.it)('should start storybook with angularBrowserTarget', async () => {
88
89
  const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
89
90
  browserTarget: 'angular-cli:build-2',
90
91
  compodoc: false,
91
92
  });
92
93
  const output = await run.result;
93
94
  await run.stop();
94
- expect(output.success).toBeTruthy();
95
- expect(mockRunScript).not.toHaveBeenCalledWith();
96
- expect(buildStaticStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
95
+ (0, vitest_1.expect)(output.success).toBeTruthy();
96
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
97
+ (0, vitest_1.expect)(buildStaticStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
97
98
  angularBrowserTarget: 'angular-cli:build-2',
98
- angularBuilderContext: expect.any(Object),
99
+ angularBuilderContext: vitest_1.expect.any(Object),
99
100
  configDir: '.storybook',
100
101
  loglevel: undefined,
101
102
  quiet: false,
102
103
  disableTelemetry: undefined,
103
104
  outputDir: 'storybook-static',
104
- packageJson: expect.any(Object),
105
+ packageJson: vitest_1.expect.any(Object),
105
106
  mode: 'static',
106
107
  tsConfig: './storybook/tsconfig.ts',
107
108
  webpackStatsJson: false,
108
109
  }));
109
110
  });
110
- it('should start storybook with tsConfig', async () => {
111
+ (0, vitest_1.it)('should start storybook with tsConfig', async () => {
111
112
  const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
112
113
  tsConfig: 'path/to/tsConfig.json',
113
114
  compodoc: false,
114
115
  });
115
116
  const output = await run.result;
116
117
  await run.stop();
117
- expect(output.success).toBeTruthy();
118
- expect(mockRunScript).not.toHaveBeenCalledWith();
119
- expect(buildStaticStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
118
+ (0, vitest_1.expect)(output.success).toBeTruthy();
119
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
120
+ (0, vitest_1.expect)(buildStaticStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
120
121
  angularBrowserTarget: null,
121
- angularBuilderContext: expect.any(Object),
122
+ angularBuilderContext: vitest_1.expect.any(Object),
122
123
  configDir: '.storybook',
123
124
  loglevel: undefined,
124
125
  quiet: false,
125
126
  disableTelemetry: undefined,
126
127
  outputDir: 'storybook-static',
127
- packageJson: expect.any(Object),
128
+ packageJson: vitest_1.expect.any(Object),
128
129
  mode: 'static',
129
130
  tsConfig: 'path/to/tsConfig.json',
130
131
  webpackStatsJson: false,
131
132
  }));
132
133
  });
133
- it('should build storybook with webpack stats.json', async () => {
134
+ (0, vitest_1.it)('should build storybook with webpack stats.json', async () => {
134
135
  const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
135
136
  tsConfig: 'path/to/tsConfig.json',
136
137
  compodoc: false,
@@ -138,22 +139,22 @@ describe.skip('Build Storybook Builder', () => {
138
139
  });
139
140
  const output = await run.result;
140
141
  await run.stop();
141
- expect(output.success).toBeTruthy();
142
- expect(mockRunScript).not.toHaveBeenCalledWith();
143
- expect(buildStaticStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
142
+ (0, vitest_1.expect)(output.success).toBeTruthy();
143
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
144
+ (0, vitest_1.expect)(buildStaticStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
144
145
  angularBrowserTarget: null,
145
- angularBuilderContext: expect.any(Object),
146
+ angularBuilderContext: vitest_1.expect.any(Object),
146
147
  configDir: '.storybook',
147
148
  loglevel: undefined,
148
149
  quiet: false,
149
150
  outputDir: 'storybook-static',
150
- packageJson: expect.any(Object),
151
+ packageJson: vitest_1.expect.any(Object),
151
152
  mode: 'static',
152
153
  tsConfig: 'path/to/tsConfig.json',
153
154
  webpackStatsJson: true,
154
155
  }));
155
156
  });
156
- it('should throw error', async () => {
157
+ (0, vitest_1.it)('should throw error', async () => {
157
158
  buildStaticStandaloneMock.mockRejectedValue(true);
158
159
  const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
159
160
  browserTarget: 'angular-cli:build-2',
@@ -161,35 +162,34 @@ describe.skip('Build Storybook Builder', () => {
161
162
  });
162
163
  try {
163
164
  await run.result;
164
- expect(false).toEqual('Throw expected');
165
+ (0, vitest_1.expect)(false).toEqual('Throw expected');
165
166
  }
166
167
  catch (error) {
167
- // eslint-disable-next-line jest/no-try-expect, jest/no-conditional-expect
168
- expect(error).toEqual('Broken build, fix the error above.\nYou may need to refresh the browser.');
168
+ (0, vitest_1.expect)(error).toEqual('Broken build, fix the error above.\nYou may need to refresh the browser.');
169
169
  }
170
170
  });
171
- it('should run compodoc', async () => {
171
+ (0, vitest_1.it)('should run compodoc', async () => {
172
172
  const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
173
173
  browserTarget: 'angular-cli:build-2',
174
174
  });
175
175
  const output = await run.result;
176
176
  await run.stop();
177
- expect(output.success).toBeTruthy();
178
- expect(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', './storybook/tsconfig.ts', '-d', '.', '-e', 'json'], '');
179
- expect(buildStaticStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
177
+ (0, vitest_1.expect)(output.success).toBeTruthy();
178
+ (0, vitest_1.expect)(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', './storybook/tsconfig.ts', '-d', '.', '-e', 'json'], '');
179
+ (0, vitest_1.expect)(buildStaticStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
180
180
  angularBrowserTarget: 'angular-cli:build-2',
181
- angularBuilderContext: expect.any(Object),
181
+ angularBuilderContext: vitest_1.expect.any(Object),
182
182
  configDir: '.storybook',
183
183
  loglevel: undefined,
184
184
  quiet: false,
185
185
  outputDir: 'storybook-static',
186
- packageJson: expect.any(Object),
186
+ packageJson: vitest_1.expect.any(Object),
187
187
  mode: 'static',
188
188
  tsConfig: './storybook/tsconfig.ts',
189
189
  webpackStatsJson: false,
190
190
  }));
191
191
  });
192
- it('should start storybook with styles options', async () => {
192
+ (0, vitest_1.it)('should start storybook with styles options', async () => {
193
193
  const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
194
194
  tsConfig: 'path/to/tsConfig.json',
195
195
  compodoc: false,
@@ -197,17 +197,17 @@ describe.skip('Build Storybook Builder', () => {
197
197
  });
198
198
  const output = await run.result;
199
199
  await run.stop();
200
- expect(output.success).toBeTruthy();
201
- expect(mockRunScript).not.toHaveBeenCalledWith();
202
- expect(buildStaticStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
200
+ (0, vitest_1.expect)(output.success).toBeTruthy();
201
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
202
+ (0, vitest_1.expect)(buildStaticStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
203
203
  angularBrowserTarget: null,
204
- angularBuilderContext: expect.any(Object),
204
+ angularBuilderContext: vitest_1.expect.any(Object),
205
205
  angularBuilderOptions: { assets: [], styles: ['style.scss'] },
206
206
  configDir: '.storybook',
207
207
  loglevel: undefined,
208
208
  quiet: false,
209
209
  outputDir: 'storybook-static',
210
- packageJson: expect.any(Object),
210
+ packageJson: vitest_1.expect.any(Object),
211
211
  mode: 'static',
212
212
  tsConfig: 'path/to/tsConfig.json',
213
213
  webpackStatsJson: false,
@@ -28,7 +28,6 @@ const commandBuilder = (options, context) => {
28
28
  configDir: 'SBCONFIG_CONFIG_DIR',
29
29
  ci: 'CI',
30
30
  });
31
- // eslint-disable-next-line no-param-reassign
32
31
  options.port = parseInt(`${options.port}`, 10);
33
32
  const { browserTarget, stylePreprocessorOptions, styles, ci, configDir, docs, host, https, port, quiet, enableProdMode = false, smokeTest, sslCa, sslCert, sslKey, disableTelemetry, assets, initialPath, open, debugWebpack, loglevel, webpackStatsJson, previewUrl, sourceMap = false, } = options;
34
33
  const standaloneOptions = {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- * @jest-environment node
3
+ * @vitest-environment node
4
4
  */
5
5
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
6
  if (k2 === undefined) k2 = k;
@@ -26,21 +26,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ // eslint-disable-next-line import/no-extraneous-dependencies
30
+ const vitest_1 = require("vitest");
29
31
  const architect_1 = require("@angular-devkit/architect");
30
32
  const testing_1 = require("@angular-devkit/architect/testing");
31
33
  const core_1 = require("@angular-devkit/core");
32
34
  const path = __importStar(require("path"));
33
- const buildDevStandaloneMock = jest.fn();
34
- const buildStaticStandaloneMock = jest.fn();
35
+ const buildDevStandaloneMock = vitest_1.vi.fn();
36
+ const buildStaticStandaloneMock = vitest_1.vi.fn();
35
37
  const buildMock = {
36
38
  buildDevStandalone: buildDevStandaloneMock,
37
39
  buildStaticStandalone: buildStaticStandaloneMock,
38
40
  withTelemetry: (_, __, fn) => fn(),
39
41
  };
40
- jest.doMock('@storybook/core-server', () => buildMock);
41
- jest.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
42
- const mockRunScript = jest.fn();
43
- jest.mock('@storybook/cli', () => ({
42
+ vitest_1.vi.doMock('@storybook/core-server', () => buildMock);
43
+ vitest_1.vi.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
44
+ const mockRunScript = vitest_1.vi.fn();
45
+ vitest_1.vi.mock('@storybook/cli', () => ({
44
46
  getEnvConfig: (options) => options,
45
47
  versions: {
46
48
  storybook: 'x.x.x',
@@ -52,11 +54,10 @@ jest.mock('@storybook/cli', () => ({
52
54
  },
53
55
  }));
54
56
  // Randomly fails on CI. TODO: investigate why
55
- // eslint-disable-next-line jest/no-disabled-tests
56
- describe.skip('Start Storybook Builder', () => {
57
+ vitest_1.describe.skip('Start Storybook Builder', () => {
57
58
  let architect;
58
59
  let architectHost;
59
- beforeEach(async () => {
60
+ (0, vitest_1.beforeEach)(async () => {
60
61
  const registry = new core_1.schema.CoreSchemaRegistry();
61
62
  registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
62
63
  architectHost = new testing_1.TestingArchitectHost();
@@ -78,13 +79,13 @@ describe.skip('Start Storybook Builder', () => {
78
79
  // for the package.json file.
79
80
  await architectHost.addBuilderFromPackage(path.join(__dirname, '../../..'));
80
81
  });
81
- beforeEach(() => {
82
+ (0, vitest_1.beforeEach)(() => {
82
83
  buildDevStandaloneMock.mockImplementation((_options) => Promise.resolve(_options));
83
84
  });
84
- afterEach(() => {
85
- jest.clearAllMocks();
85
+ (0, vitest_1.afterEach)(() => {
86
+ vitest_1.vi.clearAllMocks();
86
87
  });
87
- it('should start storybook with angularBrowserTarget', async () => {
88
+ (0, vitest_1.it)('should start storybook with angularBrowserTarget', async () => {
88
89
  const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
89
90
  browserTarget: 'angular-cli:build-2',
90
91
  port: 4400,
@@ -92,17 +93,17 @@ describe.skip('Start Storybook Builder', () => {
92
93
  });
93
94
  const output = await run.result;
94
95
  await run.stop();
95
- expect(output.success).toBeTruthy();
96
- expect(mockRunScript).not.toHaveBeenCalledWith();
97
- expect(buildDevStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
96
+ (0, vitest_1.expect)(output.success).toBeTruthy();
97
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
98
+ (0, vitest_1.expect)(buildDevStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
98
99
  angularBrowserTarget: 'angular-cli:build-2',
99
- angularBuilderContext: expect.any(Object),
100
+ angularBuilderContext: vitest_1.expect.any(Object),
100
101
  ci: false,
101
102
  configDir: '.storybook',
102
103
  disableTelemetry: undefined,
103
104
  host: 'localhost',
104
105
  https: false,
105
- packageJson: expect.any(Object),
106
+ packageJson: vitest_1.expect.any(Object),
106
107
  port: 4400,
107
108
  quiet: false,
108
109
  smokeTest: false,
@@ -112,7 +113,7 @@ describe.skip('Start Storybook Builder', () => {
112
113
  tsConfig: './storybook/tsconfig.ts',
113
114
  }));
114
115
  });
115
- it('should start storybook with tsConfig', async () => {
116
+ (0, vitest_1.it)('should start storybook with tsConfig', async () => {
116
117
  const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
117
118
  tsConfig: 'path/to/tsConfig.json',
118
119
  port: 4400,
@@ -120,17 +121,17 @@ describe.skip('Start Storybook Builder', () => {
120
121
  });
121
122
  const output = await run.result;
122
123
  await run.stop();
123
- expect(output.success).toBeTruthy();
124
- expect(mockRunScript).not.toHaveBeenCalledWith();
125
- expect(buildDevStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
124
+ (0, vitest_1.expect)(output.success).toBeTruthy();
125
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
126
+ (0, vitest_1.expect)(buildDevStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
126
127
  angularBrowserTarget: null,
127
- angularBuilderContext: expect.any(Object),
128
+ angularBuilderContext: vitest_1.expect.any(Object),
128
129
  ci: false,
129
130
  configDir: '.storybook',
130
131
  disableTelemetry: undefined,
131
132
  host: 'localhost',
132
133
  https: false,
133
- packageJson: expect.any(Object),
134
+ packageJson: vitest_1.expect.any(Object),
134
135
  port: 4400,
135
136
  quiet: false,
136
137
  smokeTest: false,
@@ -140,7 +141,7 @@ describe.skip('Start Storybook Builder', () => {
140
141
  tsConfig: 'path/to/tsConfig.json',
141
142
  }));
142
143
  });
143
- it('should throw error', async () => {
144
+ (0, vitest_1.it)('should throw error', async () => {
144
145
  buildDevStandaloneMock.mockRejectedValue(true);
145
146
  const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
146
147
  browserTarget: 'angular-cli:build-2',
@@ -149,30 +150,29 @@ describe.skip('Start Storybook Builder', () => {
149
150
  });
150
151
  try {
151
152
  await run.result;
152
- expect(false).toEqual('Throw expected');
153
+ (0, vitest_1.expect)(false).toEqual('Throw expected');
153
154
  }
154
155
  catch (error) {
155
- // eslint-disable-next-line jest/no-try-expect, jest/no-conditional-expect
156
- expect(error).toEqual('Broken build, fix the error above.\nYou may need to refresh the browser.');
156
+ (0, vitest_1.expect)(error).toEqual('Broken build, fix the error above.\nYou may need to refresh the browser.');
157
157
  }
158
158
  });
159
- it('should run compodoc', async () => {
159
+ (0, vitest_1.it)('should run compodoc', async () => {
160
160
  const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
161
161
  browserTarget: 'angular-cli:build-2',
162
162
  });
163
163
  const output = await run.result;
164
164
  await run.stop();
165
- expect(output.success).toBeTruthy();
166
- expect(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', './storybook/tsconfig.ts', '-d', '.', '-e', 'json'], '');
167
- expect(buildDevStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
165
+ (0, vitest_1.expect)(output.success).toBeTruthy();
166
+ (0, vitest_1.expect)(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', './storybook/tsconfig.ts', '-d', '.', '-e', 'json'], '');
167
+ (0, vitest_1.expect)(buildDevStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
168
168
  angularBrowserTarget: 'angular-cli:build-2',
169
- angularBuilderContext: expect.any(Object),
169
+ angularBuilderContext: vitest_1.expect.any(Object),
170
170
  ci: false,
171
171
  disableTelemetry: undefined,
172
172
  configDir: '.storybook',
173
173
  host: 'localhost',
174
174
  https: false,
175
- packageJson: expect.any(Object),
175
+ packageJson: vitest_1.expect.any(Object),
176
176
  port: 9009,
177
177
  quiet: false,
178
178
  smokeTest: false,
@@ -182,7 +182,7 @@ describe.skip('Start Storybook Builder', () => {
182
182
  tsConfig: './storybook/tsconfig.ts',
183
183
  }));
184
184
  });
185
- it('should start storybook with styles options', async () => {
185
+ (0, vitest_1.it)('should start storybook with styles options', async () => {
186
186
  const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
187
187
  tsConfig: 'path/to/tsConfig.json',
188
188
  port: 4400,
@@ -191,11 +191,11 @@ describe.skip('Start Storybook Builder', () => {
191
191
  });
192
192
  const output = await run.result;
193
193
  await run.stop();
194
- expect(output.success).toBeTruthy();
195
- expect(mockRunScript).not.toHaveBeenCalledWith();
196
- expect(buildDevStandaloneMock).toHaveBeenCalledWith({
194
+ (0, vitest_1.expect)(output.success).toBeTruthy();
195
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
196
+ (0, vitest_1.expect)(buildDevStandaloneMock).toHaveBeenCalledWith({
197
197
  angularBrowserTarget: null,
198
- angularBuilderContext: expect.any(Object),
198
+ angularBuilderContext: vitest_1.expect.any(Object),
199
199
  angularBuilderOptions: { assets: [], styles: ['src/styles.css'] },
200
200
  disableTelemetry: undefined,
201
201
  ci: false,
@@ -203,7 +203,7 @@ describe.skip('Start Storybook Builder', () => {
203
203
  host: 'localhost',
204
204
  https: false,
205
205
  port: 4400,
206
- packageJson: expect.any(Object),
206
+ packageJson: vitest_1.expect.any(Object),
207
207
  quiet: false,
208
208
  smokeTest: false,
209
209
  sslCa: undefined,
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ // eslint-disable-next-line import/no-extraneous-dependencies
4
+ const vitest_1 = require("vitest");
3
5
  const operators_1 = require("rxjs/operators");
4
- const { runCompodoc } = require('./run-compodoc');
5
- const mockRunScript = jest.fn();
6
- jest.mock('@storybook/cli', () => ({
6
+ const run_compodoc_1 = require("./run-compodoc");
7
+ const mockRunScript = vitest_1.vi.fn();
8
+ vitest_1.vi.mock('@storybook/cli', () => ({
7
9
  JsPackageManagerFactory: {
8
10
  getPackageManager: () => ({
9
11
  runPackageCommandSync: mockRunScript,
@@ -11,76 +13,65 @@ jest.mock('@storybook/cli', () => ({
11
13
  },
12
14
  }));
13
15
  const builderContextLoggerMock = {
14
- createChild: jest.fn(),
15
- log: jest.fn(),
16
- debug: jest.fn(),
17
- info: jest.fn(),
18
- warn: jest.fn(),
19
- error: jest.fn(),
20
- fatal: jest.fn(),
16
+ createChild: vitest_1.vi.fn(),
17
+ log: vitest_1.vi.fn(),
18
+ debug: vitest_1.vi.fn(),
19
+ info: vitest_1.vi.fn(),
20
+ warn: vitest_1.vi.fn(),
21
+ error: vitest_1.vi.fn(),
22
+ fatal: vitest_1.vi.fn(),
21
23
  };
22
- describe('runCompodoc', () => {
23
- afterEach(() => {
24
+ (0, vitest_1.describe)('runCompodoc', () => {
25
+ (0, vitest_1.afterEach)(() => {
24
26
  mockRunScript.mockClear();
25
27
  });
26
- it('should run compodoc with tsconfig from context', async () => {
27
- runCompodoc({
28
+ const builderContextMock = {
29
+ workspaceRoot: 'path/to/project',
30
+ logger: builderContextLoggerMock,
31
+ };
32
+ (0, vitest_1.it)('should run compodoc with tsconfig from context', async () => {
33
+ (0, run_compodoc_1.runCompodoc)({
28
34
  compodocArgs: [],
29
35
  tsconfig: 'path/to/tsconfig.json',
30
- }, {
31
- workspaceRoot: 'path/to/project',
32
- logger: builderContextLoggerMock,
33
- })
36
+ }, builderContextMock)
34
37
  .pipe((0, operators_1.take)(1))
35
38
  .subscribe();
36
- expect(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', 'path/to/tsconfig.json', '-d', 'path/to/project'], 'path/to/project', 'inherit');
39
+ (0, vitest_1.expect)(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', 'path/to/tsconfig.json', '-d', 'path/to/project'], 'path/to/project', 'inherit');
37
40
  });
38
- it('should run compodoc with tsconfig from compodocArgs', async () => {
39
- runCompodoc({
41
+ (0, vitest_1.it)('should run compodoc with tsconfig from compodocArgs', async () => {
42
+ (0, run_compodoc_1.runCompodoc)({
40
43
  compodocArgs: ['-p', 'path/to/tsconfig.stories.json'],
41
44
  tsconfig: 'path/to/tsconfig.json',
42
- }, {
43
- workspaceRoot: 'path/to/project',
44
- logger: builderContextLoggerMock,
45
- })
45
+ }, builderContextMock)
46
46
  .pipe((0, operators_1.take)(1))
47
47
  .subscribe();
48
- expect(mockRunScript).toHaveBeenCalledWith('compodoc', ['-d', 'path/to/project', '-p', 'path/to/tsconfig.stories.json'], 'path/to/project', 'inherit');
48
+ (0, vitest_1.expect)(mockRunScript).toHaveBeenCalledWith('compodoc', ['-d', 'path/to/project', '-p', 'path/to/tsconfig.stories.json'], 'path/to/project', 'inherit');
49
49
  });
50
- it('should run compodoc with default output folder.', async () => {
51
- runCompodoc({
50
+ (0, vitest_1.it)('should run compodoc with default output folder.', async () => {
51
+ (0, run_compodoc_1.runCompodoc)({
52
52
  compodocArgs: [],
53
53
  tsconfig: 'path/to/tsconfig.json',
54
- }, {
55
- workspaceRoot: 'path/to/project',
56
- logger: builderContextLoggerMock,
57
- })
54
+ }, builderContextMock)
58
55
  .pipe((0, operators_1.take)(1))
59
56
  .subscribe();
60
- expect(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', 'path/to/tsconfig.json', '-d', 'path/to/project'], 'path/to/project', 'inherit');
57
+ (0, vitest_1.expect)(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', 'path/to/tsconfig.json', '-d', 'path/to/project'], 'path/to/project', 'inherit');
61
58
  });
62
- it('should run with custom output folder specified with --output compodocArgs', async () => {
63
- runCompodoc({
59
+ (0, vitest_1.it)('should run with custom output folder specified with --output compodocArgs', async () => {
60
+ (0, run_compodoc_1.runCompodoc)({
64
61
  compodocArgs: ['--output', 'path/to/customFolder'],
65
62
  tsconfig: 'path/to/tsconfig.json',
66
- }, {
67
- workspaceRoot: 'path/to/project',
68
- logger: builderContextLoggerMock,
69
- })
63
+ }, builderContextMock)
70
64
  .pipe((0, operators_1.take)(1))
71
65
  .subscribe();
72
- expect(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', 'path/to/tsconfig.json', '--output', 'path/to/customFolder'], 'path/to/project', 'inherit');
66
+ (0, vitest_1.expect)(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', 'path/to/tsconfig.json', '--output', 'path/to/customFolder'], 'path/to/project', 'inherit');
73
67
  });
74
- it('should run with custom output folder specified with -d compodocArgs', async () => {
75
- runCompodoc({
68
+ (0, vitest_1.it)('should run with custom output folder specified with -d compodocArgs', async () => {
69
+ (0, run_compodoc_1.runCompodoc)({
76
70
  compodocArgs: ['-d', 'path/to/customFolder'],
77
71
  tsconfig: 'path/to/tsconfig.json',
78
- }, {
79
- workspaceRoot: 'path/to/project',
80
- logger: builderContextLoggerMock,
81
- })
72
+ }, builderContextMock)
82
73
  .pipe((0, operators_1.take)(1))
83
74
  .subscribe();
84
- expect(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', 'path/to/tsconfig.json', '-d', 'path/to/customFolder'], 'path/to/project', 'inherit');
75
+ (0, vitest_1.expect)(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', 'path/to/tsconfig.json', '-d', 'path/to/customFolder'], 'path/to/project', 'inherit');
85
76
  });
86
77
  });
@@ -4,21 +4,22 @@ type StoryRenderInfo = {
4
4
  storyFnAngular: StoryFnAngularReturnType;
5
5
  moduleMetadataSnapshot: string;
6
6
  };
7
+ /**
8
+ * Attribute name for the story UID that may be written to the targetDOMNode.
9
+ *
10
+ * If a target DOM node has a story UID attribute, it will be used as part of
11
+ * the selector for the Angular component.
12
+ */
13
+ export declare const STORY_UID_ATTRIBUTE = "data-sb-story-uid";
7
14
  export declare abstract class AbstractRenderer {
8
15
  /**
9
16
  * Wait and destroy the platform
10
17
  */
11
18
  static resetApplications(domNode?: HTMLElement): void;
12
- /**
13
- * Reset compiled components because we often want to compile the same component with
14
- * more than one NgModule.
15
- */
16
- protected static resetCompiledComponents: () => Promise<void>;
17
19
  protected previousStoryRenderInfo: Map<HTMLElement, StoryRenderInfo>;
18
20
  protected storyProps$: Subject<ICollection | undefined>;
19
21
  constructor();
20
22
  protected abstract beforeFullRender(domNode?: HTMLElement): Promise<void>;
21
- protected abstract afterFullRender(): Promise<void>;
22
23
  /**
23
24
  * Bootstrap main angular module with main component or send only new `props` with storyProps$
24
25
  *
@@ -47,6 +48,9 @@ export declare abstract class AbstractRenderer {
47
48
  * @memberof AbstractRenderer
48
49
  */
49
50
  protected generateTargetSelectorFromStoryId(id: string): string;
51
+ /**
52
+ * Adds DOM element that angular will use as bootstrap component.
53
+ */
50
54
  protected initAngularRootElement(targetDOMNode: HTMLElement, targetSelector: string): void;
51
55
  private fullRendererRequired;
52
56
  }