1+ import { execa } from 'execa' ;
12import { existsSync , rmSync } from 'fs' ;
23import { tmpdir } from 'os' ;
34import { join } from 'path' ;
45import { afterEach , describe , expect , it } from 'vitest' ;
5- import { execa } from 'execa' ;
66import { ProjectConfig } from '../../config/schema.js' ;
77import { ProjectGenerator } from '../../generator/index.js' ;
88
@@ -28,7 +28,7 @@ function createConfig(name: string, overrides: Partial<ProjectConfig>): ProjectC
2828 path : basePath ,
2929 runtime : 'vite' ,
3030 language : 'typescript' ,
31- styling : { solution : 'tailwind ' } ,
31+ styling : { solution : 'styled-components ' } ,
3232 stateManagement : 'none' ,
3333 dataFetching : { enabled : false , library : 'tanstack-query' } ,
3434 testing : {
@@ -53,11 +53,11 @@ describe('Styling Solutions Verification', () => {
5353 projectPaths . length = 0 ;
5454 } ) ;
5555
56- describe ( 'Plain CSS ' , ( ) => {
57- it ( 'should generate and build with plain CSS ' , async ( ) => {
58- const config = createConfig ( 'css-plain ' , {
56+ describe ( 'Styled Components (Vite) ' , ( ) => {
57+ it ( 'should generate project with Styled Components file structure ' , async ( ) => {
58+ const config = createConfig ( 'styled-vite-structure ' , {
5959 runtime : 'vite' ,
60- styling : { solution : 'css ' } ,
60+ styling : { solution : 'styled-components ' } ,
6161 } ) ;
6262 projectPaths . push ( config . path ) ;
6363
@@ -66,50 +66,37 @@ describe('Styling Solutions Verification', () => {
6666
6767 expect ( result . success ) . toBe ( true ) ;
6868
69- // Install dependencies
70- console . log ( 'Installing dependencies for plain CSS project...' ) ;
71- const installResult = await execa ( 'npm' , [ 'install' ] , {
72- cwd : config . path ,
73- timeout : 120000 ,
74- } ) ;
75- expect ( installResult . exitCode ) . toBe ( 0 ) ;
76-
77- // Build the project
78- console . log ( 'Building plain CSS project...' ) ;
79- const buildResult = await execa ( 'npm' , [ 'run' , 'build' ] , {
80- cwd : config . path ,
81- timeout : 120000 ,
82- } ) ;
83- expect ( buildResult . exitCode ) . toBe ( 0 ) ;
84-
85- expect ( existsSync ( join ( config . path , 'dist' ) ) ) . toBe ( true ) ;
86- } , 300000 ) ;
87- } ) ;
69+ // Verify Styled Components files exist
70+ expect ( existsSync ( join ( config . path , 'src/styles/globals.ts' ) ) ) . toBe ( true ) ;
71+ expect ( existsSync ( join ( config . path , 'src/components/ui/Button.styled.ts' ) ) ) . toBe ( true ) ;
72+ expect ( existsSync ( join ( config . path , 'src/app/provider.tsx' ) ) ) . toBe ( true ) ;
73+ expect ( existsSync ( join ( config . path , 'src/main.tsx' ) ) ) . toBe ( true ) ;
74+ } , 60000 ) ;
8875
89- describe . skip ( 'CSS Modules' , ( ) => {
90- it ( 'should generate and build with CSS Modules' , async ( ) => {
91- const config = createConfig ( 'css-modules' , {
76+ it ( 'should generate and build with Styled Components' , async ( ) => {
77+ const config = createConfig ( 'styled-vite' , {
9278 runtime : 'vite' ,
93- styling : { solution : 'css-modules ' } ,
79+ styling : { solution : 'styled-components ' } ,
9480 } ) ;
9581 projectPaths . push ( config . path ) ;
9682
9783 const generator = new ProjectGenerator ( config ) ;
9884 const result = await generator . generate ( ) ;
9985
10086 expect ( result . success ) . toBe ( true ) ;
101- expect ( existsSync ( join ( config . path , 'src/components/ui/Button.module.css' ) ) ) . toBe ( true ) ;
87+ expect ( existsSync ( join ( config . path , 'src/styles/globals.ts' ) ) ) . toBe ( true ) ;
88+ expect ( existsSync ( join ( config . path , 'src/components/ui/Button.styled.ts' ) ) ) . toBe ( true ) ;
10289
10390 // Install dependencies
104- console . log ( 'Installing dependencies for CSS Modules project...' ) ;
91+ console . log ( 'Installing dependencies for Styled Components project...' ) ;
10592 const installResult = await execa ( 'npm' , [ 'install' ] , {
10693 cwd : config . path ,
10794 timeout : 120000 ,
10895 } ) ;
10996 expect ( installResult . exitCode ) . toBe ( 0 ) ;
11097
11198 // Build the project
112- console . log ( 'Building CSS Modules project...' ) ;
99+ console . log ( 'Building Styled Components project...' ) ;
113100 const buildResult = await execa ( 'npm' , [ 'run' , 'build' ] , {
114101 cwd : config . path ,
115102 timeout : 120000 ,
@@ -120,106 +107,92 @@ describe('Styling Solutions Verification', () => {
120107 } , 300000 ) ;
121108 } ) ;
122109
123- describe . skip ( 'Styled Components ', ( ) => {
124- it ( 'should generate and build with Styled Components (Vite) ' , async ( ) => {
125- const config = createConfig ( 'styled-vite ' , {
126- runtime : 'vite ' ,
127- styling : { solution : 'styled-components ' } ,
110+ describe ( 'Tailwind CSS (Next.js) ', ( ) => {
111+ it ( 'should generate and build with Tailwind ' , async ( ) => {
112+ const config = createConfig ( 'tailwind-nextjs ' , {
113+ runtime : 'nextjs ' ,
114+ styling : { solution : 'tailwind ' } ,
128115 } ) ;
129116 projectPaths . push ( config . path ) ;
130117
131118 const generator = new ProjectGenerator ( config ) ;
132119 const result = await generator . generate ( ) ;
133120
134121 expect ( result . success ) . toBe ( true ) ;
135- expect ( existsSync ( join ( config . path , 'src/styles/globals.ts ' ) ) ) . toBe ( true ) ;
136- expect ( existsSync ( join ( config . path , 'src/components/ui/Button.styled.ts ' ) ) ) . toBe ( true ) ;
122+ expect ( existsSync ( join ( config . path , 'tailwind.config.js ' ) ) ) . toBe ( true ) ;
123+ expect ( existsSync ( join ( config . path , 'postcss.config.js ' ) ) ) . toBe ( true ) ;
137124
138125 // Install dependencies
139- console . log ( 'Installing dependencies for Styled Components project...' ) ;
126+ console . log ( 'Installing dependencies for Tailwind project...' ) ;
140127 const installResult = await execa ( 'npm' , [ 'install' ] , {
141128 cwd : config . path ,
142129 timeout : 120000 ,
143130 } ) ;
144131 expect ( installResult . exitCode ) . toBe ( 0 ) ;
145132
146133 // Build the project
147- console . log ( 'Building Styled Components project...' ) ;
134+ console . log ( 'Building Tailwind project...' ) ;
148135 const buildResult = await execa ( 'npm' , [ 'run' , 'build' ] , {
149136 cwd : config . path ,
150- timeout : 120000 ,
137+ timeout : 180000 ,
151138 } ) ;
152139 expect ( buildResult . exitCode ) . toBe ( 0 ) ;
153140
154- expect ( existsSync ( join ( config . path , 'dist' ) ) ) . toBe ( true ) ;
155- } , 300000 ) ;
141+ expect ( existsSync ( join ( config . path , '.next' ) ) ) . toBe ( true ) ;
142+ } , 360000 ) ;
143+ } ) ;
156144
157- it ( 'should generate and build with Styled Components (Next.js)' , async ( ) => {
158- const config = createConfig ( 'styled-nextjs' , {
145+ describe ( 'None Styling (Next.js)' , ( ) => {
146+ it ( 'should generate project with no styling framework' , async ( ) => {
147+ const config = createConfig ( 'none-nextjs-structure' , {
159148 runtime : 'nextjs' ,
160- styling : { solution : 'styled-components ' } ,
149+ styling : { solution : 'none ' } ,
161150 } ) ;
162151 projectPaths . push ( config . path ) ;
163152
164153 const generator = new ProjectGenerator ( config ) ;
165154 const result = await generator . generate ( ) ;
166155
167156 expect ( result . success ) . toBe ( true ) ;
168- expect ( existsSync ( join ( config . path , 'src/styles/globals.ts' ) ) ) . toBe ( true ) ;
169157
170- // Install dependencies
171- console . log ( 'Installing dependencies for Next.js + Styled Components...' ) ;
172- const installResult = await execa ( 'npm' , [ 'install' ] , {
173- cwd : config . path ,
174- timeout : 120000 ,
175- } ) ;
176- expect ( installResult . exitCode ) . toBe ( 0 ) ;
158+ // Verify no Tailwind config files
159+ expect ( existsSync ( join ( config . path , 'tailwind.config.js' ) ) ) . toBe ( false ) ;
160+ expect ( existsSync ( join ( config . path , 'postcss.config.js' ) ) ) . toBe ( false ) ;
177161
178- // Build the project
179- console . log ( 'Building Next.js + Styled Components...' ) ;
180- const buildResult = await execa ( 'npm' , [ 'run' , 'build' ] , {
181- cwd : config . path ,
182- timeout : 180000 ,
183- } ) ;
184- expect ( buildResult . exitCode ) . toBe ( 0 ) ;
185-
186- expect ( existsSync ( join ( config . path , '.next' ) ) ) . toBe ( true ) ;
187- } , 360000 ) ;
188- } ) ;
162+ // Verify base files exist
163+ expect ( existsSync ( join ( config . path , 'src/app/page.tsx' ) ) ) . toBe ( true ) ;
164+ expect ( existsSync ( join ( config . path , 'src/styles/globals.css' ) ) ) . toBe ( true ) ;
165+ } , 60000 ) ;
189166
190- describe ( 'Tailwind CSS' , ( ) => {
191- it ( 'should generate and build with Tailwind' , async ( ) => {
192- const config = createConfig ( 'tailwind' , {
193- runtime : 'vite' ,
194- styling : { solution : 'tailwind' } ,
167+ it ( 'should generate and build with no styling framework' , async ( ) => {
168+ const config = createConfig ( 'none-nextjs' , {
169+ runtime : 'nextjs' ,
170+ styling : { solution : 'none' } ,
195171 } ) ;
196172 projectPaths . push ( config . path ) ;
197173
198174 const generator = new ProjectGenerator ( config ) ;
199175 const result = await generator . generate ( ) ;
200176
201177 expect ( result . success ) . toBe ( true ) ;
202- expect ( existsSync ( join ( config . path , 'tailwind.config.js' ) ) ) . toBe ( true ) ;
203- expect ( existsSync ( join ( config . path , 'postcss.config.js' ) ) ) . toBe ( true ) ;
204178
205179 // Install dependencies
206- console . log ( 'Installing dependencies for Tailwind project...' ) ;
180+ console . log ( 'Installing dependencies for None styling project...' ) ;
207181 const installResult = await execa ( 'npm' , [ 'install' ] , {
208182 cwd : config . path ,
209183 timeout : 120000 ,
210184 } ) ;
211185 expect ( installResult . exitCode ) . toBe ( 0 ) ;
212186
213187 // Build the project
214- console . log ( 'Building Tailwind project...' ) ;
188+ console . log ( 'Building None styling project...' ) ;
215189 const buildResult = await execa ( 'npm' , [ 'run' , 'build' ] , {
216190 cwd : config . path ,
217- timeout : 120000 ,
191+ timeout : 180000 ,
218192 } ) ;
219193 expect ( buildResult . exitCode ) . toBe ( 0 ) ;
220194
221- expect ( existsSync ( join ( config . path , 'dist ' ) ) ) . toBe ( true ) ;
222- } , 300000 ) ;
195+ expect ( existsSync ( join ( config . path , '.next ' ) ) ) . toBe ( true ) ;
196+ } , 360000 ) ;
223197 } ) ;
224198} ) ;
225-
0 commit comments