@@ -6,14 +6,14 @@ import {
6
6
runSkuScriptInDir ,
7
7
} from '@sku-private/test-utils' ;
8
8
9
- import skuConfig from '@sku-fixtures/braid-design-system/sku.config.mjs ' ;
9
+ import skuConfig from '@sku-fixtures/braid-design-system/sku.config.js ' ;
10
10
11
11
import { createRequire } from 'node:module' ;
12
12
13
13
const require = createRequire ( import . meta. url ) ;
14
14
15
15
const appDir = path . dirname (
16
- require . resolve ( '@sku-fixtures/braid-design-system/sku.config.mjs ' ) ,
16
+ require . resolve ( '@sku-fixtures/braid-design-system/sku.config.js ' ) ,
17
17
) ;
18
18
const distDir = path . resolve ( appDir , 'dist' ) ;
19
19
@@ -24,55 +24,65 @@ function getLocalUrl(site) {
24
24
}
25
25
26
26
describe ( 'braid-design-system' , ( ) => {
27
- describe ( 'start' , ( ) => {
28
- let server ;
29
-
30
- beforeAll ( async ( ) => {
31
- server = await runSkuScriptInDir ( 'start' , appDir ) ;
32
- await waitForUrls ( getLocalUrl ( 'seekAnz' ) ) ;
33
- } , 230000 ) ;
34
-
35
- afterAll ( async ( ) => {
36
- await server . kill ( ) ;
37
- } ) ;
38
-
39
- it ( 'should return development seekAnz site' , async ( ) => {
40
- const snapshot = await getAppSnapshot ( getLocalUrl ( 'seekAnz' ) ) ;
41
- expect ( snapshot ) . toMatchSnapshot ( ) ;
42
- } ) ;
43
-
44
- it ( 'should return development jobStreet site' , async ( ) => {
45
- const snapshot = await getAppSnapshot ( getLocalUrl ( 'jobStreet' ) ) ;
46
- expect ( snapshot ) . toMatchSnapshot ( ) ;
47
- } ) ;
48
- } ) ;
49
-
50
- describe ( 'build' , ( ) => {
51
- let process ;
52
-
53
- beforeAll ( async ( ) => {
54
- await runSkuScriptInDir ( 'build' , appDir ) ;
55
- process = await runSkuScriptInDir ( 'serve' , appDir ) ;
56
- await waitForUrls ( getLocalUrl ( 'seekAnz' ) ) ;
57
- } , 230000 ) ;
58
-
59
- afterAll ( async ( ) => {
60
- await process . kill ( ) ;
61
- } ) ;
62
-
63
- it ( 'should return built jobStreet site' , async ( ) => {
64
- const app = await getAppSnapshot ( getLocalUrl ( 'jobStreet' ) ) ;
65
- expect ( app ) . toMatchSnapshot ( ) ;
66
- } ) ;
67
-
68
- it ( 'should return built seekAnz site' , async ( ) => {
69
- const app = await getAppSnapshot ( getLocalUrl ( 'seekAnz' ) ) ;
70
- expect ( app ) . toMatchSnapshot ( ) ;
27
+ describe . each ( [
28
+ 'vite' ,
29
+ // 'webpack'
30
+ ] ) ( 'bundler %s' , ( bundler ) => {
31
+ const args =
32
+ bundler === 'vite'
33
+ ? [ '--config' , 'sku.config.vite.js' , '--experimental-bundler' ]
34
+ : [ ] ;
35
+
36
+ describe ( 'start' , ( ) => {
37
+ let server ;
38
+
39
+ beforeAll ( async ( ) => {
40
+ server = await runSkuScriptInDir ( 'start' , appDir , args ) ;
41
+ await waitForUrls ( getLocalUrl ( 'seekAnz' ) ) ;
42
+ } , 230000 ) ;
43
+
44
+ afterAll ( async ( ) => {
45
+ await server . kill ( ) ;
46
+ } ) ;
47
+
48
+ it ( 'should return development seekAnz site' , async ( ) => {
49
+ const snapshot = await getAppSnapshot ( getLocalUrl ( 'seekAnz' ) ) ;
50
+ expect ( snapshot ) . toMatchSnapshot ( ) ;
51
+ } ) ;
52
+
53
+ it ( 'should return development jobStreet site' , async ( ) => {
54
+ const snapshot = await getAppSnapshot ( getLocalUrl ( 'jobStreet' ) ) ;
55
+ expect ( snapshot ) . toMatchSnapshot ( ) ;
56
+ } ) ;
71
57
} ) ;
72
58
73
- it ( 'should generate the expected files' , async ( ) => {
74
- const files = await dirContentsToObject ( distDir ) ;
75
- expect ( files ) . toMatchSnapshot ( ) ;
59
+ describe ( 'build' , ( ) => {
60
+ let process ;
61
+
62
+ beforeAll ( async ( ) => {
63
+ await runSkuScriptInDir ( 'build' , appDir , args ) ;
64
+ process = await runSkuScriptInDir ( 'serve' , appDir , args ) ;
65
+ await waitForUrls ( getLocalUrl ( 'seekAnz' ) ) ;
66
+ } , 230000 ) ;
67
+
68
+ afterAll ( async ( ) => {
69
+ await process . kill ( ) ;
70
+ } ) ;
71
+
72
+ it ( 'should return built jobStreet site' , async ( ) => {
73
+ const app = await getAppSnapshot ( getLocalUrl ( 'jobStreet' ) ) ;
74
+ expect ( app ) . toMatchSnapshot ( ) ;
75
+ } ) ;
76
+
77
+ it ( 'should return built seekAnz site' , async ( ) => {
78
+ const app = await getAppSnapshot ( getLocalUrl ( 'seekAnz' ) ) ;
79
+ expect ( app ) . toMatchSnapshot ( ) ;
80
+ } ) ;
81
+
82
+ it ( 'should generate the expected files' , async ( ) => {
83
+ const files = await dirContentsToObject ( distDir ) ;
84
+ expect ( files ) . toMatchSnapshot ( ) ;
85
+ } ) ;
76
86
} ) ;
77
87
} ) ;
78
88
0 commit comments