@storybook/angular 8.0.0-alpha.4 → 8.0.0-alpha.6

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.
@@ -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,14 @@ 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
57
  // eslint-disable-next-line jest/no-disabled-tests
56
- describe.skip('Build Storybook Builder', () => {
58
+ vitest_1.describe.skip('Build Storybook Builder', () => {
57
59
  let architect;
58
60
  let architectHost;
59
- beforeEach(async () => {
61
+ (0, vitest_1.beforeEach)(async () => {
60
62
  const registry = new core_1.schema.CoreSchemaRegistry();
61
63
  registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
62
64
  architectHost = new testing_1.TestingArchitectHost();
@@ -78,11 +80,11 @@ describe.skip('Build Storybook Builder', () => {
78
80
  // for the package.json file.
79
81
  await architectHost.addBuilderFromPackage(path.join(__dirname, '../../..'));
80
82
  });
81
- beforeEach(() => {
83
+ (0, vitest_1.beforeEach)(() => {
82
84
  buildStaticStandaloneMock.mockImplementation((_options) => Promise.resolve(_options));
83
85
  });
84
86
  afterEach(() => {
85
- jest.clearAllMocks();
87
+ vitest_1.vi.clearAllMocks();
86
88
  });
87
89
  it('should start storybook with angularBrowserTarget', async () => {
88
90
  const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
@@ -91,17 +93,17 @@ describe.skip('Build Storybook Builder', () => {
91
93
  });
92
94
  const output = await run.result;
93
95
  await run.stop();
94
- expect(output.success).toBeTruthy();
95
- expect(mockRunScript).not.toHaveBeenCalledWith();
96
- expect(buildStaticStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
96
+ (0, vitest_1.expect)(output.success).toBeTruthy();
97
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
98
+ (0, vitest_1.expect)(buildStaticStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
97
99
  angularBrowserTarget: 'angular-cli:build-2',
98
- angularBuilderContext: expect.any(Object),
100
+ angularBuilderContext: vitest_1.expect.any(Object),
99
101
  configDir: '.storybook',
100
102
  loglevel: undefined,
101
103
  quiet: false,
102
104
  disableTelemetry: undefined,
103
105
  outputDir: 'storybook-static',
104
- packageJson: expect.any(Object),
106
+ packageJson: vitest_1.expect.any(Object),
105
107
  mode: 'static',
106
108
  tsConfig: './storybook/tsconfig.ts',
107
109
  webpackStatsJson: false,
@@ -114,17 +116,17 @@ describe.skip('Build Storybook Builder', () => {
114
116
  });
115
117
  const output = await run.result;
116
118
  await run.stop();
117
- expect(output.success).toBeTruthy();
118
- expect(mockRunScript).not.toHaveBeenCalledWith();
119
- expect(buildStaticStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
119
+ (0, vitest_1.expect)(output.success).toBeTruthy();
120
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
121
+ (0, vitest_1.expect)(buildStaticStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
120
122
  angularBrowserTarget: null,
121
- angularBuilderContext: expect.any(Object),
123
+ angularBuilderContext: vitest_1.expect.any(Object),
122
124
  configDir: '.storybook',
123
125
  loglevel: undefined,
124
126
  quiet: false,
125
127
  disableTelemetry: undefined,
126
128
  outputDir: 'storybook-static',
127
- packageJson: expect.any(Object),
129
+ packageJson: vitest_1.expect.any(Object),
128
130
  mode: 'static',
129
131
  tsConfig: 'path/to/tsConfig.json',
130
132
  webpackStatsJson: false,
@@ -138,16 +140,16 @@ describe.skip('Build Storybook Builder', () => {
138
140
  });
139
141
  const output = await run.result;
140
142
  await run.stop();
141
- expect(output.success).toBeTruthy();
142
- expect(mockRunScript).not.toHaveBeenCalledWith();
143
- expect(buildStaticStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
143
+ (0, vitest_1.expect)(output.success).toBeTruthy();
144
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
145
+ (0, vitest_1.expect)(buildStaticStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
144
146
  angularBrowserTarget: null,
145
- angularBuilderContext: expect.any(Object),
147
+ angularBuilderContext: vitest_1.expect.any(Object),
146
148
  configDir: '.storybook',
147
149
  loglevel: undefined,
148
150
  quiet: false,
149
151
  outputDir: 'storybook-static',
150
- packageJson: expect.any(Object),
152
+ packageJson: vitest_1.expect.any(Object),
151
153
  mode: 'static',
152
154
  tsConfig: 'path/to/tsConfig.json',
153
155
  webpackStatsJson: true,
@@ -161,11 +163,11 @@ describe.skip('Build Storybook Builder', () => {
161
163
  });
162
164
  try {
163
165
  await run.result;
164
- expect(false).toEqual('Throw expected');
166
+ (0, vitest_1.expect)(false).toEqual('Throw expected');
165
167
  }
166
168
  catch (error) {
167
169
  // 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.');
170
+ (0, vitest_1.expect)(error).toEqual('Broken build, fix the error above.\nYou may need to refresh the browser.');
169
171
  }
170
172
  });
171
173
  it('should run compodoc', async () => {
@@ -174,16 +176,16 @@ describe.skip('Build Storybook Builder', () => {
174
176
  });
175
177
  const output = await run.result;
176
178
  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({
179
+ (0, vitest_1.expect)(output.success).toBeTruthy();
180
+ (0, vitest_1.expect)(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', './storybook/tsconfig.ts', '-d', '.', '-e', 'json'], '');
181
+ (0, vitest_1.expect)(buildStaticStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
180
182
  angularBrowserTarget: 'angular-cli:build-2',
181
- angularBuilderContext: expect.any(Object),
183
+ angularBuilderContext: vitest_1.expect.any(Object),
182
184
  configDir: '.storybook',
183
185
  loglevel: undefined,
184
186
  quiet: false,
185
187
  outputDir: 'storybook-static',
186
- packageJson: expect.any(Object),
188
+ packageJson: vitest_1.expect.any(Object),
187
189
  mode: 'static',
188
190
  tsConfig: './storybook/tsconfig.ts',
189
191
  webpackStatsJson: false,
@@ -197,17 +199,17 @@ describe.skip('Build Storybook Builder', () => {
197
199
  });
198
200
  const output = await run.result;
199
201
  await run.stop();
200
- expect(output.success).toBeTruthy();
201
- expect(mockRunScript).not.toHaveBeenCalledWith();
202
- expect(buildStaticStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
202
+ (0, vitest_1.expect)(output.success).toBeTruthy();
203
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
204
+ (0, vitest_1.expect)(buildStaticStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
203
205
  angularBrowserTarget: null,
204
- angularBuilderContext: expect.any(Object),
206
+ angularBuilderContext: vitest_1.expect.any(Object),
205
207
  angularBuilderOptions: { assets: [], styles: ['style.scss'] },
206
208
  configDir: '.storybook',
207
209
  loglevel: undefined,
208
210
  quiet: false,
209
211
  outputDir: 'storybook-static',
210
- packageJson: expect.any(Object),
212
+ packageJson: vitest_1.expect.any(Object),
211
213
  mode: 'static',
212
214
  tsConfig: 'path/to/tsConfig.json',
213
215
  webpackStatsJson: false,
@@ -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',
@@ -53,10 +55,10 @@ jest.mock('@storybook/cli', () => ({
53
55
  }));
54
56
  // Randomly fails on CI. TODO: investigate why
55
57
  // eslint-disable-next-line jest/no-disabled-tests
56
- describe.skip('Start Storybook Builder', () => {
58
+ vitest_1.describe.skip('Start Storybook Builder', () => {
57
59
  let architect;
58
60
  let architectHost;
59
- beforeEach(async () => {
61
+ (0, vitest_1.beforeEach)(async () => {
60
62
  const registry = new core_1.schema.CoreSchemaRegistry();
61
63
  registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
62
64
  architectHost = new testing_1.TestingArchitectHost();
@@ -78,13 +80,13 @@ describe.skip('Start Storybook Builder', () => {
78
80
  // for the package.json file.
79
81
  await architectHost.addBuilderFromPackage(path.join(__dirname, '../../..'));
80
82
  });
81
- beforeEach(() => {
83
+ (0, vitest_1.beforeEach)(() => {
82
84
  buildDevStandaloneMock.mockImplementation((_options) => Promise.resolve(_options));
83
85
  });
84
86
  afterEach(() => {
85
- jest.clearAllMocks();
87
+ vitest_1.vi.clearAllMocks();
86
88
  });
87
- it('should start storybook with angularBrowserTarget', async () => {
89
+ (0, vitest_1.it)('should start storybook with angularBrowserTarget', async () => {
88
90
  const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
89
91
  browserTarget: 'angular-cli:build-2',
90
92
  port: 4400,
@@ -92,17 +94,17 @@ describe.skip('Start Storybook Builder', () => {
92
94
  });
93
95
  const output = await run.result;
94
96
  await run.stop();
95
- expect(output.success).toBeTruthy();
96
- expect(mockRunScript).not.toHaveBeenCalledWith();
97
- expect(buildDevStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
97
+ (0, vitest_1.expect)(output.success).toBeTruthy();
98
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
99
+ (0, vitest_1.expect)(buildDevStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
98
100
  angularBrowserTarget: 'angular-cli:build-2',
99
- angularBuilderContext: expect.any(Object),
101
+ angularBuilderContext: vitest_1.expect.any(Object),
100
102
  ci: false,
101
103
  configDir: '.storybook',
102
104
  disableTelemetry: undefined,
103
105
  host: 'localhost',
104
106
  https: false,
105
- packageJson: expect.any(Object),
107
+ packageJson: vitest_1.expect.any(Object),
106
108
  port: 4400,
107
109
  quiet: false,
108
110
  smokeTest: false,
@@ -112,7 +114,7 @@ describe.skip('Start Storybook Builder', () => {
112
114
  tsConfig: './storybook/tsconfig.ts',
113
115
  }));
114
116
  });
115
- it('should start storybook with tsConfig', async () => {
117
+ (0, vitest_1.it)('should start storybook with tsConfig', async () => {
116
118
  const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
117
119
  tsConfig: 'path/to/tsConfig.json',
118
120
  port: 4400,
@@ -120,17 +122,17 @@ describe.skip('Start Storybook Builder', () => {
120
122
  });
121
123
  const output = await run.result;
122
124
  await run.stop();
123
- expect(output.success).toBeTruthy();
124
- expect(mockRunScript).not.toHaveBeenCalledWith();
125
- expect(buildDevStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
125
+ (0, vitest_1.expect)(output.success).toBeTruthy();
126
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
127
+ (0, vitest_1.expect)(buildDevStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
126
128
  angularBrowserTarget: null,
127
- angularBuilderContext: expect.any(Object),
129
+ angularBuilderContext: vitest_1.expect.any(Object),
128
130
  ci: false,
129
131
  configDir: '.storybook',
130
132
  disableTelemetry: undefined,
131
133
  host: 'localhost',
132
134
  https: false,
133
- packageJson: expect.any(Object),
135
+ packageJson: vitest_1.expect.any(Object),
134
136
  port: 4400,
135
137
  quiet: false,
136
138
  smokeTest: false,
@@ -140,7 +142,7 @@ describe.skip('Start Storybook Builder', () => {
140
142
  tsConfig: 'path/to/tsConfig.json',
141
143
  }));
142
144
  });
143
- it('should throw error', async () => {
145
+ (0, vitest_1.it)('should throw error', async () => {
144
146
  buildDevStandaloneMock.mockRejectedValue(true);
145
147
  const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
146
148
  browserTarget: 'angular-cli:build-2',
@@ -149,30 +151,30 @@ describe.skip('Start Storybook Builder', () => {
149
151
  });
150
152
  try {
151
153
  await run.result;
152
- expect(false).toEqual('Throw expected');
154
+ (0, vitest_1.expect)(false).toEqual('Throw expected');
153
155
  }
154
156
  catch (error) {
155
157
  // 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.');
158
+ (0, vitest_1.expect)(error).toEqual('Broken build, fix the error above.\nYou may need to refresh the browser.');
157
159
  }
158
160
  });
159
- it('should run compodoc', async () => {
161
+ (0, vitest_1.it)('should run compodoc', async () => {
160
162
  const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
161
163
  browserTarget: 'angular-cli:build-2',
162
164
  });
163
165
  const output = await run.result;
164
166
  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({
167
+ (0, vitest_1.expect)(output.success).toBeTruthy();
168
+ (0, vitest_1.expect)(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', './storybook/tsconfig.ts', '-d', '.', '-e', 'json'], '');
169
+ (0, vitest_1.expect)(buildDevStandaloneMock).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
168
170
  angularBrowserTarget: 'angular-cli:build-2',
169
- angularBuilderContext: expect.any(Object),
171
+ angularBuilderContext: vitest_1.expect.any(Object),
170
172
  ci: false,
171
173
  disableTelemetry: undefined,
172
174
  configDir: '.storybook',
173
175
  host: 'localhost',
174
176
  https: false,
175
- packageJson: expect.any(Object),
177
+ packageJson: vitest_1.expect.any(Object),
176
178
  port: 9009,
177
179
  quiet: false,
178
180
  smokeTest: false,
@@ -182,7 +184,7 @@ describe.skip('Start Storybook Builder', () => {
182
184
  tsConfig: './storybook/tsconfig.ts',
183
185
  }));
184
186
  });
185
- it('should start storybook with styles options', async () => {
187
+ (0, vitest_1.it)('should start storybook with styles options', async () => {
186
188
  const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
187
189
  tsConfig: 'path/to/tsConfig.json',
188
190
  port: 4400,
@@ -191,11 +193,11 @@ describe.skip('Start Storybook Builder', () => {
191
193
  });
192
194
  const output = await run.result;
193
195
  await run.stop();
194
- expect(output.success).toBeTruthy();
195
- expect(mockRunScript).not.toHaveBeenCalledWith();
196
- expect(buildDevStandaloneMock).toHaveBeenCalledWith({
196
+ (0, vitest_1.expect)(output.success).toBeTruthy();
197
+ (0, vitest_1.expect)(mockRunScript).not.toHaveBeenCalledWith();
198
+ (0, vitest_1.expect)(buildDevStandaloneMock).toHaveBeenCalledWith({
197
199
  angularBrowserTarget: null,
198
- angularBuilderContext: expect.any(Object),
200
+ angularBuilderContext: vitest_1.expect.any(Object),
199
201
  angularBuilderOptions: { assets: [], styles: ['src/styles.css'] },
200
202
  disableTelemetry: undefined,
201
203
  ci: false,
@@ -203,7 +205,7 @@ describe.skip('Start Storybook Builder', () => {
203
205
  host: 'localhost',
204
206
  https: false,
205
207
  port: 4400,
206
- packageJson: expect.any(Object),
208
+ packageJson: vitest_1.expect.any(Object),
207
209
  quiet: false,
208
210
  smokeTest: false,
209
211
  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
  });
@@ -6,19 +6,20 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
+ const vitest_1 = require("vitest");
9
10
  const core_1 = require("@angular/core");
10
11
  const testing_1 = require("@angular/platform-browser-dynamic/testing");
11
12
  const platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic");
12
13
  const CanvasRenderer_1 = require("./CanvasRenderer");
13
14
  const RendererFactory_1 = require("./RendererFactory");
14
15
  const DocsRenderer_1 = require("./DocsRenderer");
15
- jest.mock('@angular/platform-browser-dynamic');
16
- describe('RendererFactory', () => {
16
+ vitest_1.vi.mock('@angular/platform-browser-dynamic');
17
+ (0, vitest_1.describe)('RendererFactory', () => {
17
18
  let rendererFactory;
18
19
  let rootTargetDOMNode;
19
20
  let rootDocstargetDOMNode;
20
21
  let storyInDocstargetDOMNode;
21
- beforeEach(async () => {
22
+ (0, vitest_1.beforeEach)(async () => {
22
23
  rendererFactory = new RendererFactory_1.RendererFactory();
23
24
  document.body.innerHTML =
24
25
  '<div id="storybook-root"></div><div id="root-docs"><div id="story-in-docs"></div></div>' +
@@ -26,20 +27,20 @@ describe('RendererFactory', () => {
26
27
  rootTargetDOMNode = global.document.getElementById('storybook-root');
27
28
  rootDocstargetDOMNode = global.document.getElementById('root-docs');
28
29
  platform_browser_dynamic_1.platformBrowserDynamic.mockImplementation(testing_1.platformBrowserDynamicTesting);
29
- jest.spyOn(console, 'log').mockImplementation(() => { });
30
+ vitest_1.vi.spyOn(console, 'log').mockImplementation(() => { });
30
31
  });
31
32
  afterEach(() => {
32
- jest.clearAllMocks();
33
+ vitest_1.vi.clearAllMocks();
33
34
  // Necessary to avoid this error "Provided value for `preserveWhitespaces` can not be changed once it has been set." :
34
35
  // Source: https://github.com/angular/angular/commit/e342ffd855ffeb8af7067b42307ffa320d82177e#diff-92b125e532cc22977b46a91f068d6d7ea81fd61b772842a4a0212f1cfd875be6R28
35
36
  (0, core_1.ɵresetJitOptions)();
36
37
  });
37
- describe('CanvasRenderer', () => {
38
- it('should get CanvasRenderer instance', async () => {
38
+ (0, vitest_1.describe)('CanvasRenderer', () => {
39
+ (0, vitest_1.it)('should get CanvasRenderer instance', async () => {
39
40
  const render = await rendererFactory.getRendererInstance(rootTargetDOMNode);
40
- expect(render).toBeInstanceOf(CanvasRenderer_1.CanvasRenderer);
41
+ (0, vitest_1.expect)(render).toBeInstanceOf(CanvasRenderer_1.CanvasRenderer);
41
42
  });
42
- it('should render my-story for story template', async () => {
43
+ (0, vitest_1.it)('should render my-story for story template', async () => {
43
44
  const render = await rendererFactory.getRendererInstance(rootTargetDOMNode);
44
45
  await render?.render({
45
46
  storyFnAngular: {
@@ -49,9 +50,9 @@ describe('RendererFactory', () => {
49
50
  forced: false,
50
51
  targetDOMNode: rootTargetDOMNode,
51
52
  });
52
- expect(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('🦊');
53
+ (0, vitest_1.expect)(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('🦊');
53
54
  });
54
- it('should render my-story for story component', async () => {
55
+ (0, vitest_1.it)('should render my-story for story component', async () => {
55
56
  let FooComponent = class FooComponent {
56
57
  };
57
58
  FooComponent = __decorate([
@@ -66,9 +67,9 @@ describe('RendererFactory', () => {
66
67
  component: FooComponent,
67
68
  targetDOMNode: rootTargetDOMNode,
68
69
  });
69
- expect(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('<foo>🦊</foo><!--container-->');
70
+ (0, vitest_1.expect)(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('<foo>🦊</foo><!--container-->');
70
71
  });
71
- it('should handle circular reference in moduleMetadata', async () => {
72
+ (0, vitest_1.it)('should handle circular reference in moduleMetadata', async () => {
72
73
  class Thing {
73
74
  constructor() {
74
75
  this.token = this;
@@ -85,10 +86,10 @@ describe('RendererFactory', () => {
85
86
  forced: false,
86
87
  targetDOMNode: rootTargetDOMNode,
87
88
  });
88
- expect(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('🦊');
89
+ (0, vitest_1.expect)(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('🦊');
89
90
  });
90
- describe('when forced=true', () => {
91
- beforeEach(async () => {
91
+ (0, vitest_1.describe)('when forced=true', () => {
92
+ (0, vitest_1.beforeEach)(async () => {
92
93
  // Init first render
93
94
  const render = await rendererFactory.getRendererInstance(rootTargetDOMNode);
94
95
  await render?.render({
@@ -103,10 +104,10 @@ describe('RendererFactory', () => {
103
104
  targetDOMNode: rootTargetDOMNode,
104
105
  });
105
106
  });
106
- it('should be rendered a first time', async () => {
107
- expect(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('🦊: Fox');
107
+ (0, vitest_1.it)('should be rendered a first time', async () => {
108
+ (0, vitest_1.expect)(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('🦊: Fox');
108
109
  });
109
- it('should not be re-rendered when only props change', async () => {
110
+ (0, vitest_1.it)('should not be re-rendered when only props change', async () => {
110
111
  // only props change
111
112
  const render = await rendererFactory.getRendererInstance(rootTargetDOMNode);
112
113
  await render?.render({
@@ -118,9 +119,9 @@ describe('RendererFactory', () => {
118
119
  forced: true,
119
120
  targetDOMNode: rootTargetDOMNode,
120
121
  });
121
- expect(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('👾: Fox');
122
+ (0, vitest_1.expect)(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('👾: Fox');
122
123
  });
123
- it('should be re-rendered when template change', async () => {
124
+ (0, vitest_1.it)('should be re-rendered when template change', async () => {
124
125
  const render = await rendererFactory.getRendererInstance(rootTargetDOMNode);
125
126
  await render?.render({
126
127
  storyFnAngular: {
@@ -132,13 +133,13 @@ describe('RendererFactory', () => {
132
133
  forced: true,
133
134
  targetDOMNode: rootTargetDOMNode,
134
135
  });
135
- expect(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('🍺');
136
+ (0, vitest_1.expect)(document.body.getElementsByTagName('storybook-root')[0].innerHTML).toBe('🍺');
136
137
  });
137
138
  });
138
139
  });
139
- describe('DocsRenderer', () => {
140
- describe('when canvas render is done before', () => {
141
- beforeEach(async () => {
140
+ (0, vitest_1.describe)('DocsRenderer', () => {
141
+ (0, vitest_1.describe)('when canvas render is done before', () => {
142
+ (0, vitest_1.beforeEach)(async () => {
142
143
  // Init first Canvas render
143
144
  const render = await rendererFactory.getRendererInstance(rootTargetDOMNode);
144
145
  await render?.render({
@@ -149,21 +150,21 @@ describe('RendererFactory', () => {
149
150
  targetDOMNode: rootTargetDOMNode,
150
151
  });
151
152
  });
152
- it('should reset root HTML', async () => {
153
+ (0, vitest_1.it)('should reset root HTML', async () => {
153
154
  global.document
154
155
  .getElementById('storybook-root')
155
156
  .appendChild(global.document.createElement('👾'));
156
- expect(global.document.getElementById('storybook-root').innerHTML).toContain('Canvas 🖼');
157
+ (0, vitest_1.expect)(global.document.getElementById('storybook-root').innerHTML).toContain('Canvas 🖼');
157
158
  await rendererFactory.getRendererInstance(rootDocstargetDOMNode);
158
- expect(global.document.getElementById('storybook-root').innerHTML).toBe('');
159
+ (0, vitest_1.expect)(global.document.getElementById('storybook-root').innerHTML).toBe('');
159
160
  });
160
161
  });
161
- it('should get DocsRenderer instance', async () => {
162
+ (0, vitest_1.it)('should get DocsRenderer instance', async () => {
162
163
  const render = await rendererFactory.getRendererInstance(rootDocstargetDOMNode);
163
- expect(render).toBeInstanceOf(DocsRenderer_1.DocsRenderer);
164
+ (0, vitest_1.expect)(render).toBeInstanceOf(DocsRenderer_1.DocsRenderer);
164
165
  });
165
- describe('when multiple story for the same component', () => {
166
- it('should render both stories', async () => {
166
+ (0, vitest_1.describe)('when multiple story for the same component', () => {
167
+ (0, vitest_1.it)('should render both stories', async () => {
167
168
  let FooComponent = class FooComponent {
168
169
  };
169
170
  FooComponent = __decorate([
@@ -192,8 +193,8 @@ describe('RendererFactory', () => {
192
193
  component: FooComponent,
193
194
  targetDOMNode: targetDOMNode2,
194
195
  });
195
- expect(global.document.querySelectorAll('#story-1 > story-1')[0].innerHTML).toBe('<foo>🦊</foo><!--container-->');
196
- expect(global.document.querySelectorAll('#story-1 > story-1')[1].innerHTML).toBe('<foo>🦊</foo><!--container-->');
196
+ (0, vitest_1.expect)(global.document.querySelectorAll('#story-1 > story-1')[0].innerHTML).toBe('<foo>🦊</foo><!--container-->');
197
+ (0, vitest_1.expect)(global.document.querySelectorAll('#story-1 > story-1')[1].innerHTML).toBe('<foo>🦊</foo><!--container-->');
197
198
  });
198
199
  });
199
200
  });
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
3
4
  const common_1 = require("@angular/common");
4
5
  const core_1 = require("@angular/core");
5
6
  const platform_browser_1 = require("@angular/platform-browser");
@@ -46,109 +47,109 @@ const extractApplicationProviders = (metadata, component) => {
46
47
  const { applicationProviders } = new PropertyExtractor_1.PropertyExtractor(metadata, component);
47
48
  return applicationProviders;
48
49
  };
49
- describe('PropertyExtractor', () => {
50
- jest.spyOn(console, 'warn').mockImplementation(() => { });
51
- describe('analyzeMetadata', () => {
52
- it('should remove BrowserModule', () => {
50
+ (0, vitest_1.describe)('PropertyExtractor', () => {
51
+ vitest_1.vi.spyOn(console, 'warn').mockImplementation(() => { });
52
+ (0, vitest_1.describe)('analyzeMetadata', () => {
53
+ (0, vitest_1.it)('should remove BrowserModule', () => {
53
54
  const metadata = {
54
55
  imports: [platform_browser_1.BrowserModule],
55
56
  };
56
57
  const { imports, providers, applicationProviders } = analyzeMetadata(metadata);
57
- expect(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
58
- expect(providers.flat(Number.MAX_VALUE)).toEqual([]);
59
- expect(applicationProviders.flat(Number.MAX_VALUE)).toEqual([]);
58
+ (0, vitest_1.expect)(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
59
+ (0, vitest_1.expect)(providers.flat(Number.MAX_VALUE)).toEqual([]);
60
+ (0, vitest_1.expect)(applicationProviders.flat(Number.MAX_VALUE)).toEqual([]);
60
61
  });
61
- it('should remove BrowserAnimationsModule and use its providers instead', () => {
62
+ (0, vitest_1.it)('should remove BrowserAnimationsModule and use its providers instead', () => {
62
63
  const metadata = {
63
64
  imports: [animations_1.BrowserAnimationsModule],
64
65
  };
65
66
  const { imports, providers, applicationProviders } = analyzeMetadata(metadata);
66
- expect(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
67
- expect(providers.flat(Number.MAX_VALUE)).toEqual([]);
68
- expect(applicationProviders.flat(Number.MAX_VALUE)).toEqual((0, animations_1.provideAnimations)());
67
+ (0, vitest_1.expect)(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
68
+ (0, vitest_1.expect)(providers.flat(Number.MAX_VALUE)).toEqual([]);
69
+ (0, vitest_1.expect)(applicationProviders.flat(Number.MAX_VALUE)).toEqual((0, animations_1.provideAnimations)());
69
70
  });
70
- it('should remove NoopAnimationsModule and use its providers instead', () => {
71
+ (0, vitest_1.it)('should remove NoopAnimationsModule and use its providers instead', () => {
71
72
  const metadata = {
72
73
  imports: [animations_1.NoopAnimationsModule],
73
74
  };
74
75
  const { imports, providers, applicationProviders } = analyzeMetadata(metadata);
75
- expect(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
76
- expect(providers.flat(Number.MAX_VALUE)).toEqual([]);
77
- expect(applicationProviders.flat(Number.MAX_VALUE)).toEqual((0, animations_1.provideNoopAnimations)());
76
+ (0, vitest_1.expect)(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
77
+ (0, vitest_1.expect)(providers.flat(Number.MAX_VALUE)).toEqual([]);
78
+ (0, vitest_1.expect)(applicationProviders.flat(Number.MAX_VALUE)).toEqual((0, animations_1.provideNoopAnimations)());
78
79
  });
79
- it('should remove Browser/Animations modules recursively', () => {
80
+ (0, vitest_1.it)('should remove Browser/Animations modules recursively', () => {
80
81
  const metadata = {
81
82
  imports: [animations_1.BrowserAnimationsModule, platform_browser_1.BrowserModule],
82
83
  };
83
84
  const { imports, providers, applicationProviders } = analyzeMetadata(metadata);
84
- expect(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
85
- expect(providers.flat(Number.MAX_VALUE)).toEqual([]);
86
- expect(applicationProviders.flat(Number.MAX_VALUE)).toEqual((0, animations_1.provideAnimations)());
85
+ (0, vitest_1.expect)(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule]);
86
+ (0, vitest_1.expect)(providers.flat(Number.MAX_VALUE)).toEqual([]);
87
+ (0, vitest_1.expect)(applicationProviders.flat(Number.MAX_VALUE)).toEqual((0, animations_1.provideAnimations)());
87
88
  });
88
- it('should not destructure Angular official module', () => {
89
+ (0, vitest_1.it)('should not destructure Angular official module', () => {
89
90
  const metadata = {
90
91
  imports: [test_module_1.WithOfficialModule],
91
92
  };
92
93
  const { imports, providers, applicationProviders } = analyzeMetadata(metadata);
93
- expect(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule, test_module_1.WithOfficialModule]);
94
- expect(providers.flat(Number.MAX_VALUE)).toEqual([]);
95
- expect(applicationProviders.flat(Number.MAX_VALUE)).toEqual([]);
94
+ (0, vitest_1.expect)(imports.flat(Number.MAX_VALUE)).toEqual([common_1.CommonModule, test_module_1.WithOfficialModule]);
95
+ (0, vitest_1.expect)(providers.flat(Number.MAX_VALUE)).toEqual([]);
96
+ (0, vitest_1.expect)(applicationProviders.flat(Number.MAX_VALUE)).toEqual([]);
96
97
  });
97
98
  });
98
- describe('extractImports', () => {
99
- it('should return Angular official modules', () => {
99
+ (0, vitest_1.describe)('extractImports', () => {
100
+ (0, vitest_1.it)('should return Angular official modules', () => {
100
101
  const imports = extractImports({ imports: [TestModuleWithImportsAndProviders] });
101
- expect(imports).toEqual([common_1.CommonModule, TestModuleWithImportsAndProviders]);
102
+ (0, vitest_1.expect)(imports).toEqual([common_1.CommonModule, TestModuleWithImportsAndProviders]);
102
103
  });
103
- it('should return standalone components', () => {
104
+ (0, vitest_1.it)('should return standalone components', () => {
104
105
  const imports = extractImports({
105
106
  imports: [TestModuleWithImportsAndProviders],
106
107
  }, StandaloneTestComponent);
107
- expect(imports).toEqual([
108
+ (0, vitest_1.expect)(imports).toEqual([
108
109
  common_1.CommonModule,
109
110
  TestModuleWithImportsAndProviders,
110
111
  StandaloneTestComponent,
111
112
  ]);
112
113
  });
113
- it('should return standalone directives', () => {
114
+ (0, vitest_1.it)('should return standalone directives', () => {
114
115
  const imports = extractImports({
115
116
  imports: [TestModuleWithImportsAndProviders],
116
117
  }, StandaloneTestDirective);
117
- expect(imports).toEqual([
118
+ (0, vitest_1.expect)(imports).toEqual([
118
119
  common_1.CommonModule,
119
120
  TestModuleWithImportsAndProviders,
120
121
  StandaloneTestDirective,
121
122
  ]);
122
123
  });
123
124
  });
124
- describe('extractDeclarations', () => {
125
- it('should return an array of declarations that contains `storyComponent`', () => {
125
+ (0, vitest_1.describe)('extractDeclarations', () => {
126
+ (0, vitest_1.it)('should return an array of declarations that contains `storyComponent`', () => {
126
127
  const declarations = extractDeclarations({ declarations: [TestComponent1] }, TestComponent2);
127
- expect(declarations).toEqual([TestComponent1, TestComponent2]);
128
+ (0, vitest_1.expect)(declarations).toEqual([TestComponent1, TestComponent2]);
128
129
  });
129
130
  });
130
- describe('analyzeDecorators', () => {
131
- it('isStandalone should be false', () => {
131
+ (0, vitest_1.describe)('analyzeDecorators', () => {
132
+ (0, vitest_1.it)('isStandalone should be false', () => {
132
133
  const { isStandalone } = PropertyExtractor_1.PropertyExtractor.analyzeDecorators(TestComponent1);
133
- expect(isStandalone).toBe(false);
134
+ (0, vitest_1.expect)(isStandalone).toBe(false);
134
135
  });
135
- it('isStandalone should be true', () => {
136
+ (0, vitest_1.it)('isStandalone should be true', () => {
136
137
  const { isStandalone } = PropertyExtractor_1.PropertyExtractor.analyzeDecorators(StandaloneTestComponent);
137
- expect(isStandalone).toBe(true);
138
+ (0, vitest_1.expect)(isStandalone).toBe(true);
138
139
  });
139
140
  });
140
- describe('extractProviders', () => {
141
- it('should return an array of providers', () => {
141
+ (0, vitest_1.describe)('extractProviders', () => {
142
+ (0, vitest_1.it)('should return an array of providers', () => {
142
143
  const providers = extractProviders({
143
144
  providers: [TestService],
144
145
  });
145
- expect(providers).toEqual([TestService]);
146
+ (0, vitest_1.expect)(providers).toEqual([TestService]);
146
147
  });
147
- it('should return an array of singletons extracted', () => {
148
+ (0, vitest_1.it)('should return an array of singletons extracted', () => {
148
149
  const singeltons = extractApplicationProviders({
149
150
  imports: [animations_1.BrowserAnimationsModule],
150
151
  });
151
- expect(singeltons).toEqual((0, animations_1.provideAnimations)());
152
+ (0, vitest_1.expect)(singeltons).toEqual((0, animations_1.provideAnimations)());
152
153
  });
153
154
  });
154
155
  });
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
+ const vitest_1 = require("vitest");
9
10
  const core_1 = require("@angular/core");
10
11
  const decorators_1 = require("./decorators");
11
12
  const defaultContext = {
@@ -23,7 +24,7 @@ const defaultContext = {
23
24
  globals: {},
24
25
  hooks: {},
25
26
  loaded: {},
26
- originalStoryFn: jest.fn(),
27
+ originalStoryFn: vitest_1.vi.fn(),
27
28
  viewMode: 'story',
28
29
  abortSignal: undefined,
29
30
  canvasElement: undefined,
@@ -39,11 +40,11 @@ let MockComponent = class MockComponent {
39
40
  MockComponent = __decorate([
40
41
  (0, core_1.Component)({})
41
42
  ], MockComponent);
42
- describe('applicationConfig', () => {
43
+ (0, vitest_1.describe)('applicationConfig', () => {
43
44
  const provider1 = () => { };
44
45
  const provider2 = () => { };
45
- it('should apply global config', () => {
46
- expect((0, decorators_1.applicationConfig)({
46
+ (0, vitest_1.it)('should apply global config', () => {
47
+ (0, vitest_1.expect)((0, decorators_1.applicationConfig)({
47
48
  providers: [provider1],
48
49
  })(() => ({}), defaultContext)).toEqual({
49
50
  applicationConfig: {
@@ -51,8 +52,8 @@ describe('applicationConfig', () => {
51
52
  },
52
53
  });
53
54
  });
54
- it('should apply story config', () => {
55
- expect((0, decorators_1.applicationConfig)({
55
+ (0, vitest_1.it)('should apply story config', () => {
56
+ (0, vitest_1.expect)((0, decorators_1.applicationConfig)({
56
57
  providers: [],
57
58
  })(() => ({
58
59
  applicationConfig: {
@@ -66,8 +67,8 @@ describe('applicationConfig', () => {
66
67
  },
67
68
  });
68
69
  });
69
- it('should merge global and story config', () => {
70
- expect((0, decorators_1.applicationConfig)({
70
+ (0, vitest_1.it)('should merge global and story config', () => {
71
+ (0, vitest_1.expect)((0, decorators_1.applicationConfig)({
71
72
  providers: [provider1],
72
73
  })(() => ({
73
74
  applicationConfig: {
@@ -82,15 +83,15 @@ describe('applicationConfig', () => {
82
83
  });
83
84
  });
84
85
  });
85
- describe('moduleMetadata', () => {
86
- it('should add metadata to a story without it', () => {
86
+ (0, vitest_1.describe)('moduleMetadata', () => {
87
+ (0, vitest_1.it)('should add metadata to a story without it', () => {
87
88
  const result = (0, decorators_1.moduleMetadata)({
88
89
  imports: [MockModule],
89
90
  providers: [MockService],
90
91
  })(() => ({}),
91
92
  // deepscan-disable-next-line
92
93
  defaultContext);
93
- expect(result).toEqual({
94
+ (0, vitest_1.expect)(result).toEqual({
94
95
  moduleMetadata: {
95
96
  declarations: [],
96
97
  entryComponents: [],
@@ -100,7 +101,7 @@ describe('moduleMetadata', () => {
100
101
  },
101
102
  });
102
103
  });
103
- it('should combine with individual metadata on a story', () => {
104
+ (0, vitest_1.it)('should combine with individual metadata on a story', () => {
104
105
  const result = (0, decorators_1.moduleMetadata)({
105
106
  imports: [MockModule],
106
107
  })(() => ({
@@ -112,7 +113,7 @@ describe('moduleMetadata', () => {
112
113
  }),
113
114
  // deepscan-disable-next-line
114
115
  defaultContext);
115
- expect(result).toEqual({
116
+ (0, vitest_1.expect)(result).toEqual({
116
117
  component: MockComponent,
117
118
  moduleMetadata: {
118
119
  declarations: [],
@@ -123,7 +124,7 @@ describe('moduleMetadata', () => {
123
124
  },
124
125
  });
125
126
  });
126
- it('should return the original metadata if passed null', () => {
127
+ (0, vitest_1.it)('should return the original metadata if passed null', () => {
127
128
  const result = (0, decorators_1.moduleMetadata)(null)(() => ({
128
129
  component: MockComponent,
129
130
  moduleMetadata: {
@@ -132,7 +133,7 @@ describe('moduleMetadata', () => {
132
133
  }),
133
134
  // deepscan-disable-next-line
134
135
  defaultContext);
135
- expect(result).toEqual({
136
+ (0, vitest_1.expect)(result).toEqual({
136
137
  component: MockComponent,
137
138
  moduleMetadata: {
138
139
  declarations: [],
@@ -1 +1 @@
1
- import 'jest-specific-snapshot';
1
+ export {};
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- require("jest-specific-snapshot");
7
6
  const path_1 = __importDefault(require("path"));
8
7
  const fs_1 = __importDefault(require("fs"));
9
8
  const tmp_1 = __importDefault(require("tmp"));
@@ -48,13 +47,13 @@ describe('angular component properties', () => {
48
47
  // // snapshot the output of compodoc
49
48
  // const compodocOutput = runCompodoc(inputPath);
50
49
  // const compodocJson = JSON.parse(compodocOutput);
51
- // expect(compodocJson).toMatchSpecificSnapshot(
50
+ // expect(compodocJson).toMatchFileSnapshot(
52
51
  // path.join(testDir, `compodoc-${SNAPSHOT_OS}.snapshot`)
53
52
  // );
54
53
  // // snapshot the output of addon-docs angular-properties
55
54
  // const componentData = findComponentByName('InputComponent', compodocJson);
56
55
  // const argTypes = extractArgTypesFromData(componentData);
57
- // expect(argTypes).toMatchSpecificSnapshot(path.join(testDir, 'argtypes.snapshot'));
56
+ // expect(argTypes).toMatchFileSnapshot(path.join(testDir, 'argtypes.snapshot'));
58
57
  // });
59
58
  }
60
59
  }
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const vitest_1 = require("vitest");
3
4
  const compodoc_1 = require("./compodoc");
4
5
  const makeProperty = (compodocType) => ({
5
6
  type: compodocType,
@@ -93,10 +94,10 @@ const getDummyCompodocJson = () => {
93
94
  },
94
95
  };
95
96
  };
96
- describe('extractType', () => {
97
- describe('with compodoc type', () => {
97
+ (0, vitest_1.describe)('extractType', () => {
98
+ (0, vitest_1.describe)('with compodoc type', () => {
98
99
  (0, compodoc_1.setCompodocJson)(getDummyCompodocJson());
99
- it.each([
100
+ vitest_1.it.each([
100
101
  ['string', { name: 'string' }],
101
102
  ['boolean', { name: 'boolean' }],
102
103
  ['number', { name: 'number' }],
@@ -112,11 +113,11 @@ describe('extractType', () => {
112
113
  // ['EnumNumericInitial', { name: 'other', value: 'empty-enum' }], // seems to be wrong | TODO: REVISIT
113
114
  ['EnumStringValues', { name: 'enum', value: ['PRIMARY', 'SECONDARY', 'TERTIARY'] }],
114
115
  ])('%s', (compodocType, expected) => {
115
- expect((0, compodoc_1.extractType)(makeProperty(compodocType), null)).toEqual(expected);
116
+ (0, vitest_1.expect)((0, compodoc_1.extractType)(makeProperty(compodocType), null)).toEqual(expected);
116
117
  });
117
118
  });
118
- describe('without compodoc type', () => {
119
- it.each([
119
+ (0, vitest_1.describe)('without compodoc type', () => {
120
+ vitest_1.it.each([
120
121
  ['string', { name: 'string' }],
121
122
  ['', { name: 'string' }],
122
123
  [false, { name: 'boolean' }],
@@ -125,7 +126,7 @@ describe('extractType', () => {
125
126
  // [{ foo: 1 }, { name: 'other', value: 'empty-enum' }], // seems to be wrong | TODO: REVISIT
126
127
  [undefined, { name: 'other', value: 'void' }],
127
128
  ])('%s', (defaultValue, expected) => {
128
- expect((0, compodoc_1.extractType)(makeProperty(null), defaultValue)).toEqual(expected);
129
+ (0, vitest_1.expect)((0, compodoc_1.extractType)(makeProperty(null), defaultValue)).toEqual(expected);
129
130
  });
130
131
  });
131
132
  });
@@ -0,0 +1 @@
1
+ import '@analogjs/vite-plugin-angular/setup-vitest';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // eslint-disable-next-line import/no-extraneous-dependencies
4
+ require("@analogjs/vite-plugin-angular/setup-vitest");
5
+ const testing_1 = require("@angular/platform-browser-dynamic/testing");
6
+ const testing_2 = require("@angular/core/testing");
7
+ (0, testing_2.getTestBed)().initTestEnvironment(testing_1.BrowserDynamicTestingModule, (0, testing_1.platformBrowserDynamicTesting)());
@@ -0,0 +1,5 @@
1
+ // eslint-disable-next-line import/no-extraneous-dependencies
2
+ import '@analogjs/vite-plugin-angular/setup-vitest';
3
+ import { BrowserDynamicTestingModule, platformBrowserDynamicTesting, } from '@angular/platform-browser-dynamic/testing';
4
+ import { getTestBed } from '@angular/core/testing';
5
+ getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/angular",
3
- "version": "8.0.0-alpha.4",
3
+ "version": "8.0.0-alpha.6",
4
4
  "description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
5
5
  "keywords": [
6
6
  "storybook",
@@ -37,19 +37,19 @@
37
37
  "prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/tsc.ts"
38
38
  },
39
39
  "dependencies": {
40
- "@storybook/builder-webpack5": "8.0.0-alpha.4",
41
- "@storybook/cli": "8.0.0-alpha.4",
42
- "@storybook/client-logger": "8.0.0-alpha.4",
43
- "@storybook/core-common": "8.0.0-alpha.4",
44
- "@storybook/core-events": "8.0.0-alpha.4",
45
- "@storybook/core-server": "8.0.0-alpha.4",
46
- "@storybook/core-webpack": "8.0.0-alpha.4",
47
- "@storybook/docs-tools": "8.0.0-alpha.4",
40
+ "@storybook/builder-webpack5": "8.0.0-alpha.6",
41
+ "@storybook/cli": "8.0.0-alpha.6",
42
+ "@storybook/client-logger": "8.0.0-alpha.6",
43
+ "@storybook/core-common": "8.0.0-alpha.6",
44
+ "@storybook/core-events": "8.0.0-alpha.6",
45
+ "@storybook/core-server": "8.0.0-alpha.6",
46
+ "@storybook/core-webpack": "8.0.0-alpha.6",
47
+ "@storybook/docs-tools": "8.0.0-alpha.6",
48
48
  "@storybook/global": "^5.0.0",
49
- "@storybook/node-logger": "8.0.0-alpha.4",
50
- "@storybook/preview-api": "8.0.0-alpha.4",
51
- "@storybook/telemetry": "8.0.0-alpha.4",
52
- "@storybook/types": "8.0.0-alpha.4",
49
+ "@storybook/node-logger": "8.0.0-alpha.6",
50
+ "@storybook/preview-api": "8.0.0-alpha.6",
51
+ "@storybook/telemetry": "8.0.0-alpha.6",
52
+ "@storybook/types": "8.0.0-alpha.6",
53
53
  "@types/node": "^18.0.0",
54
54
  "@types/react": "^18.0.37",
55
55
  "@types/react-dom": "^18.0.11",
@@ -65,6 +65,7 @@
65
65
  "webpack": "5"
66
66
  },
67
67
  "devDependencies": {
68
+ "@analogjs/vite-plugin-angular": "^0.2.24",
68
69
  "@angular-devkit/architect": "^0.1700.5",
69
70
  "@angular-devkit/build-angular": "^17.0.5",
70
71
  "@angular-devkit/core": "^17.0.5",
@@ -80,9 +81,7 @@
80
81
  "@types/cross-spawn": "^6.0.2",
81
82
  "@types/tmp": "^0.2.3",
82
83
  "cross-spawn": "^7.0.3",
83
- "jest": "^29.7.0",
84
- "jest-preset-angular": "^13.0.1",
85
- "jest-specific-snapshot": "^8.0.0",
84
+ "jsdom": "^23.0.1",
86
85
  "tmp": "^0.2.1",
87
86
  "typescript": "^5.3.2",
88
87
  "webpack": "5",
package/jest.config.js DELETED
@@ -1,31 +0,0 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- displayName: __dirname.split(path.sep).slice(-2).join(path.posix.sep),
5
- preset: 'jest-preset-angular/presets/defaults-esm',
6
- setupFilesAfterEnv: ['<rootDir>/setup-jest.ts'],
7
- transformIgnorePatterns: ['/node_modules/(?!@angular|rxjs|nanoid|uuid)'],
8
- snapshotFormat: {
9
- escapeString: true,
10
- printBasicPrototype: true,
11
- },
12
- coverageDirectory: './coverage/testapp',
13
- transform: {
14
- '^.+\\.(ts|mjs|js|html)$': [
15
- 'jest-preset-angular',
16
- {
17
- tsconfig: '<rootDir>/tsconfig.spec.json',
18
- stringifyContentPathRegex: '\\.(html|svg)$',
19
- },
20
- ],
21
- },
22
- snapshotSerializers: [
23
- 'jest-preset-angular/build/serializers/no-ng-attributes',
24
- 'jest-preset-angular/build/serializers/ng-snapshot',
25
- 'jest-preset-angular/build/serializers/html-comment',
26
- ],
27
- testMatch: [
28
- '<rootDir>/src/**/__tests__/**/*.[jt]s?(x)',
29
- '<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)',
30
- ],
31
- };