@@ -2,52 +2,51 @@ const execSync = require('child_process').execSync;
22const fs = require ( 'fs-extra' ) ;
33
44describe ( 'build' , ( ) => {
5- it ( 'generates CDN files in ./build' , ( ) => {
5+ beforeEach ( ( ) => {
66 execSync ( 'yarn run build' ) ;
7+ } ) ;
8+
9+ afterEach ( ( ) => {
10+ execSync ( 'yarn run clean' ) ;
11+ } ) ;
12+
13+ it ( 'generates CDN files in ./build' , ( ) => {
714 expect ( fs . existsSync ( './build/polaris.css' ) ) . toBe ( true ) ;
815 expect ( fs . existsSync ( './build/polaris.min.css' ) ) . toBe ( true ) ;
9- execSync ( 'yarn run clean' ) ;
1016 } ) ;
1117
1218 it ( 'generates lib files in ./' , ( ) => {
13- execSync ( 'yarn run build' ) ;
1419 expect ( fs . existsSync ( './index.js' ) ) . toBe ( true ) ;
1520 expect ( fs . existsSync ( './embedded.js' ) ) . toBe ( true ) ;
1621 expect ( fs . existsSync ( './index.es.js' ) ) . toBe ( true ) ;
1722 expect ( fs . existsSync ( './styles.css' ) ) . toBe ( true ) ;
18- execSync ( 'yarn run clean' ) ;
1923 } ) ;
2024
2125 it ( 'generates a ./styles/components dir with Icon.scss' , ( ) => {
22- execSync ( 'yarn run build' ) ;
2326 expect ( fs . existsSync ( './styles/components/Icon.scss' ) ) . toBe ( true ) ;
24- execSync ( 'yarn run clean' ) ;
2527 } ) ;
2628
2729 it ( 'generates a ./styles/foundation dir with spacing.scss' , ( ) => {
28- execSync ( 'yarn run build' ) ;
2930 expect ( fs . existsSync ( './styles/foundation/spacing.scss' ) ) . toBe ( true ) ;
30- execSync ( 'yarn run clean' ) ;
3131 } ) ;
3232
3333 it ( 'generates sass entries files in ./styles dir' , ( ) => {
34- execSync ( 'yarn run build' ) ;
3534 expect ( fs . existsSync ( './styles/global.scss' ) ) . toBe ( true ) ;
3635 expect ( fs . existsSync ( './styles/foundation.scss' ) ) . toBe ( true ) ;
3736 expect ( fs . existsSync ( './styles/shared.scss' ) ) . toBe ( true ) ;
3837 expect ( fs . existsSync ( './styles/components.scss' ) ) . toBe ( true ) ;
39- execSync ( 'yarn run clean' ) ;
4038 } ) ;
4139
4240 it ( 'generates a ./styles.scss sass entry point in root' , ( ) => {
43- execSync ( 'yarn run build' ) ;
4441 expect ( fs . existsSync ( './styles.scss' ) ) . toBe ( true ) ;
45- execSync ( 'yarn run clean' ) ;
4642 } ) ;
4743
4844 it ( 'generates a zip of ./build/sass' , ( ) => {
49- execSync ( 'yarn run build' ) ;
5045 expect ( fs . existsSync ( './build/sass.zip' ) ) . toBe ( true ) ;
51- execSync ( 'yarn run clean' ) ;
46+ } ) ;
47+
48+ it ( 'generates the necessary typescript definition files' , ( ) => {
49+ expect ( fs . existsSync ( './types/index.d.ts' ) ) . toBe ( true ) ;
50+ expect ( fs . existsSync ( './embedded.d.ts' ) ) . toBe ( true ) ;
5251 } ) ;
5352} ) ;
0 commit comments