Skip to content

Commit 018cc49

Browse files
Merge branch 'next' into fix-nested-esm-file-compilation
2 parents ed14d04 + f65c44c commit 018cc49

File tree

3,262 files changed

+104338
-86123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,262 files changed

+104338
-86123
lines changed

.circleci/config.yml

+101-55
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ jobs:
115115
- restore_cache:
116116
name: Restore Yarn cache
117117
keys:
118-
- prettydocs-yarn-2-cache-v7--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
118+
- prettydocs-yarn-2-cache-v8--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
119119
- run:
120120
name: Install
121121
command: |
122122
cd scripts
123123
yarn install
124124
- save_cache:
125125
name: Save Yarn cache
126-
key: prettydocs-yarn-2-cache-v7--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
126+
key: prettydocs-yarn-2-cache-v8--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
127127
paths:
128128
- ~/.yarn/berry/cache
129129
- run:
@@ -141,7 +141,7 @@ jobs:
141141
- restore_cache:
142142
name: Restore Yarn cache
143143
keys:
144-
- build-yarn-2-cache-v4--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
144+
- build-yarn-2-cache-v5--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
145145
- run:
146146
name: Compile
147147
command: |
@@ -158,7 +158,7 @@ jobs:
158158
path: code/bench/esbuild-metafiles
159159
- save_cache:
160160
name: Save Yarn cache
161-
key: build-yarn-2-cache-v4--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
161+
key: build-yarn-2-cache-v5--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
162162
paths:
163163
- ~/.yarn/berry/cache
164164
- persist_to_workspace:
@@ -170,7 +170,6 @@ jobs:
170170
- code/bench
171171
- code/examples
172172
- code/frameworks
173-
- code/deprecated
174173
- code/lib
175174
- code/core
176175
- code/builders
@@ -195,7 +194,7 @@ jobs:
195194
- cancel-workflow-on-failure
196195
knip:
197196
executor:
198-
class: medium
197+
class: large
199198
name: sb_node_22_classic
200199
steps:
201200
- git-shallow-clone/checkout_advanced:
@@ -271,7 +270,7 @@ jobs:
271270
- restore_cache:
272271
name: Restore Yarn cache
273272
keys:
274-
- build-yarn-2-cache-v4--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
273+
- build-yarn-2-cache-v5--{{ checksum "code/yarn.lock" }}--{{ checksum "scripts/yarn.lock" }}
275274
- run:
276275
name: Compile
277276
command: |
@@ -314,9 +313,9 @@ jobs:
314313
- cancel-workflow-on-failure
315314
unit-tests:
316315
executor:
317-
class: large
316+
class: xlarge
318317
name: sb_playwright
319-
parallelism: 4
318+
parallelism: 2
320319
steps:
321320
- git-shallow-clone/checkout_advanced:
322321
clone_options: "--depth 1 --verbose"
@@ -368,10 +367,10 @@ jobs:
368367
- report-workflow-on-failure
369368
chromatic-internal-storybook:
370369
executor:
371-
class: medium
370+
class: large
372371
name: sb_node_22_browsers
373372
environment:
374-
NODE_OPTIONS: --max_old_space_size=6144
373+
NODE_OPTIONS: --max_old_space_size=4096
375374
steps:
376375
# switched this to the CircleCI helper to get the full git history for TurboSnap
377376
- checkout
@@ -399,8 +398,14 @@ jobs:
399398
- attach_workspace:
400399
at: .
401400
- run:
402-
name: Enable Corepack
403-
command: sudo corepack enable yarn
401+
name: Setup Corepack
402+
command: |
403+
# Enable corepack
404+
sudo corepack enable
405+
406+
# Verify yarn is working
407+
which yarn
408+
yarn --version
404409
- run:
405410
name: Starting Event Collector
406411
command: yarn jiti ./event-log-collector.ts
@@ -475,7 +480,7 @@ jobs:
475480
parallelism:
476481
type: integer
477482
executor:
478-
class: large
483+
class: xlarge
479484
name: sb_playwright
480485
parallelism: << parameters.parallelism >>
481486
steps:
@@ -621,7 +626,33 @@ jobs:
621626
command: yarn upload-bench $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench) << pipeline.parameters.ghPrNumber >> << pipeline.parameters.ghBaseBranch >>
622627
- report-workflow-on-failure:
623628
template: $(yarn get-template --cadence << pipeline.parameters.workflow >> --task bench)
624-
test-empty-init:
629+
test-init-features:
630+
executor:
631+
class: small
632+
name: sb_node_22_browsers
633+
steps:
634+
- git-shallow-clone/checkout_advanced:
635+
clone_options: "--depth 1 --verbose"
636+
- attach_workspace:
637+
at: .
638+
- run:
639+
name: Storybook init for features
640+
command: |
641+
cd code
642+
yarn local-registry --open &
643+
yarn wait-on tcp:127.0.0.1:6001
644+
cd ../../
645+
mkdir features-1
646+
cd features-1
647+
npm set registry http://localhost:6001
648+
npx create-storybook --yes --package-manager npm --features dev docs test
649+
npx vitest
650+
environment:
651+
IN_STORYBOOK_SANDBOX: true
652+
STORYBOOK_INIT_EMPTY_TYPE: react-vite-ts
653+
STORYBOOK_DISABLE_TELEMETRY: true
654+
655+
test-init-empty:
625656
executor:
626657
class: small
627658
name: sb_node_22_browsers
@@ -810,9 +841,10 @@ workflows:
810841
- knip:
811842
requires:
812843
- build
813-
- bench-packages:
814-
requires:
815-
- build
844+
# TODO: don't forget to reenable this
845+
# - bench-packages:
846+
# requires:
847+
# - build
816848
- check
817849
- unit-tests:
818850
requires:
@@ -853,13 +885,17 @@ workflows:
853885
parallelism: 5
854886
requires:
855887
- create-sandboxes
856-
- bench-sandboxes:
857-
parallelism: 5
858-
requires:
859-
- create-sandboxes
888+
# TODO: don't forget to reenable this
889+
# - bench-sandboxes:
890+
# parallelism: 5
891+
# requires:
892+
# - create-sandboxes
860893
- test-ui-testing-module:
861894
requires:
862895
- build
896+
- test-init-features:
897+
requires:
898+
- build
863899
- test-portable-stories:
864900
requires:
865901
- build
@@ -882,9 +918,10 @@ workflows:
882918
- knip:
883919
requires:
884920
- build
885-
- bench-packages:
886-
requires:
887-
- build
921+
# TODO: don't forget to reenable this
922+
# - bench-packages:
923+
# requires:
924+
# - build
888925
- check
889926
- unit-tests:
890927
requires:
@@ -902,23 +939,23 @@ workflows:
902939
requires:
903940
- unit-tests
904941
- create-sandboxes:
905-
parallelism: 20
942+
parallelism: 18
906943
requires:
907944
- build
908945
- chromatic-sandboxes:
909-
parallelism: 17
946+
parallelism: 15
910947
requires:
911948
- create-sandboxes
912949
- e2e-production:
913-
parallelism: 15
950+
parallelism: 13
914951
requires:
915952
- create-sandboxes
916953
- e2e-dev:
917954
parallelism: 1
918955
requires:
919956
- create-sandboxes
920957
- test-runner-production:
921-
parallelism: 15
958+
parallelism: 13
922959
requires:
923960
- create-sandboxes
924961
- vitest-integration:
@@ -934,15 +971,19 @@ workflows:
934971
- test-ui-testing-module:
935972
requires:
936973
- build
937-
- bench-sandboxes:
938-
parallelism: 5
974+
- test-init-features:
939975
requires:
940-
- create-sandboxes
941-
# TODO: reenable once we find out the source of flakyness
942-
# - test-runner-dev:
943-
# parallelism: 4
944-
# requires:
945-
# - create-sandboxes
976+
- build
977+
# TODO: don't forget to reenable this
978+
# - bench-sandboxes:
979+
# parallelism: 5
980+
# requires:
981+
# - create-sandboxes
982+
# TODO: reenable once we find out the source of flakyness
983+
# - test-runner-dev:
984+
# parallelism: 4
985+
# requires:
986+
# - create-sandboxes
946987
daily:
947988
when:
948989
equal: [daily, << pipeline.parameters.workflow >>]
@@ -955,9 +996,10 @@ workflows:
955996
- knip:
956997
requires:
957998
- build
958-
- bench-packages:
959-
requires:
960-
- build
999+
# TODO: don't forget to reenable this
1000+
# - bench-packages:
1001+
# requires:
1002+
# - build
9611003
- check
9621004
- unit-tests:
9631005
requires:
@@ -972,30 +1014,30 @@ workflows:
9721014
requires:
9731015
- build
9741016
- create-sandboxes:
975-
parallelism: 37
1017+
parallelism: 31
9761018
requires:
9771019
- build
9781020
# - smoke-test-sandboxes: # disabled for now
9791021
# requires:
9801022
# - create-sandboxes
9811023
- chromatic-sandboxes:
982-
parallelism: 34
1024+
parallelism: 28
9831025
requires:
9841026
- create-sandboxes
9851027
- e2e-production:
986-
parallelism: 32
1028+
parallelism: 26
9871029
requires:
9881030
- create-sandboxes
9891031
- e2e-dev:
9901032
parallelism: 1
9911033
requires:
9921034
- create-sandboxes
9931035
- test-runner-production:
994-
parallelism: 32
1036+
parallelism: 26
9951037
requires:
9961038
- create-sandboxes
9971039
- vitest-integration:
998-
parallelism: 11
1040+
parallelism: 9
9991041
requires:
10001042
- create-sandboxes
10011043
- test-portable-stories:
@@ -1007,7 +1049,10 @@ workflows:
10071049
- test-ui-testing-module:
10081050
requires:
10091051
- build
1010-
- test-empty-init:
1052+
- test-init-features:
1053+
requires:
1054+
- build
1055+
- test-init-empty:
10111056
requires:
10121057
- build
10131058
matrix:
@@ -1025,13 +1070,14 @@ workflows:
10251070
# --smoke-test is not supported for the angular builder right now
10261071
# - "angular-cli"
10271072
- "lit-vite-ts"
1028-
- bench-sandboxes:
1029-
parallelism: 5
1030-
requires:
1031-
- create-sandboxes
1073+
# TODO: don't forget to reenable this
1074+
# - bench-sandboxes:
1075+
# parallelism: 5
1076+
# requires:
1077+
# - create-sandboxes
10321078

1033-
# TODO: reenable once we find out the source of flakyness
1034-
# - test-runner-dev:
1035-
# parallelism: 4
1036-
# requires:
1037-
# - create-sandboxes
1079+
# TODO: reenable once we find out the source of flakyness
1080+
# - test-runner-dev:
1081+
# parallelism: 4
1082+
# requires:
1083+
# - create-sandboxes

.cursor/rules/spy-mocking.mdc

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
description: Rules for consistent and type-safe mocking in Vitest tests
3+
globs: "**/*.test.{ts,tsx,js,jsx}"
4+
alwaysApply: true
5+
---
6+
7+
# Spy Mocking Rules for Vitest Tests
8+
9+
## Mocking Approach
10+
11+
When mocking packages or files in Vitest-based tests, follow these rules:
12+
13+
1. Use `vi.mock()` with the `spy: true` option for all package and file mocks
14+
2. Place all mocks at the top of the test file before any test cases
15+
3. Use `vi.mocked()` to type and access the mocked functions
16+
4. Implement mock behaviors in `beforeEach` blocks
17+
5. Mock all required dependencies that the test subject uses
18+
19+
## Mock Implementation Rules
20+
21+
1. Mock implementations should be placed in `beforeEach` blocks
22+
2. Each mock implementation should return a Promise for async functions
23+
3. Mock implementations should match the expected return type of the original function
24+
4. Use `vi.mocked()` to access and implement mock behaviors
25+
5. Mock all required properties and methods that the test subject uses
26+
27+
## Avoided Patterns
28+
29+
The following mocking patterns should be avoided:
30+
31+
1. Direct function mocking without `vi.mocked()`
32+
2. Mock implementations outside of `beforeEach` blocks
33+
3. Mocking without the `spy: true` option
34+
4. Inline mock implementations within test cases
35+
5. Mocking only a subset of required dependencies
36+
37+
## Best Practices
38+
39+
1. Mock at the highest level of abstraction needed
40+
2. Keep mock implementations simple and focused
41+
3. Use type-safe mocking with `vi.mocked()`
42+
4. Document complex mock behaviors
43+
5. Group related mocks together

0 commit comments

Comments
 (0)