@@ -58,52 +58,52 @@ describe(`gatsby file compilation`, () => {
58
58
} )
59
59
60
60
describe ( `compileGatsbyFiles` , ( ) => {
61
- afterEach ( async ( ) => {
62
- for ( const directory of [ dir . js , dir . ts ] ) {
63
- await remove ( `${ directory } /.cache` )
64
- }
65
- } )
66
-
67
- it ( `should not compile gatsby-config.js` , async ( ) => {
68
- await compileGatsbyFiles ( dir . js )
69
-
70
- const isCompiled = await pathExists (
71
- `${ dir . js } /.cache/compiled/gatsby-config.js`
72
- )
73
- expect ( isCompiled ) . toEqual ( false )
74
- } )
75
-
76
- it ( `should compile gatsby-config.ts` , async ( ) => {
77
- await compileGatsbyFiles ( dir . ts )
61
+ describe ( `js files are not touched` , ( ) => {
62
+ beforeAll ( async ( ) => {
63
+ await remove ( `${ dir . js } /.cache` )
64
+ await compileGatsbyFiles ( dir . js )
65
+ } )
78
66
79
- const compiledGatsbyConfig = await readFile (
80
- `${ dir . ts } /.cache/compiled/gatsby-config.js` ,
81
- `utf-8`
82
- )
67
+ it ( `should not compile gatsby-config.js` , async ( ) => {
68
+ const isCompiled = await pathExists (
69
+ `${ dir . js } /.cache/compiled/gatsby-config.js`
70
+ )
71
+ expect ( isCompiled ) . toEqual ( false )
72
+ } )
83
73
84
- expect ( compiledGatsbyConfig ) . toContain ( siteMetadata . title )
85
- expect ( compiledGatsbyConfig ) . toContain ( siteMetadata . siteUrl )
86
- expect ( compiledGatsbyConfig ) . toContain ( moreDataConfig . options . name )
74
+ it ( `should not compile gatsby-node.js` , async ( ) => {
75
+ const isCompiled = await pathExists (
76
+ `${ dir . js } /.cache/compiled/gatsby-node.js`
77
+ )
78
+ expect ( isCompiled ) . toEqual ( false )
79
+ } )
87
80
} )
88
81
89
- it ( `should not compile gatsby-node.js` , async ( ) => {
90
- await compileGatsbyFiles ( dir . js )
82
+ describe ( `ts files are compiled` , ( ) => {
83
+ beforeAll ( async ( ) => {
84
+ await remove ( `${ dir . ts } /.cache` )
85
+ await compileGatsbyFiles ( dir . ts )
86
+ } )
91
87
92
- const isCompiled = await pathExists (
93
- ` ${ dir . js } /.cache/compiled/gatsby-node.js`
94
- )
95
- expect ( isCompiled ) . toEqual ( false )
96
- } )
88
+ it ( `should compile gatsby-config.ts` , async ( ) => {
89
+ const compiledGatsbyConfig = await readFile (
90
+ ` ${ dir . ts } /.cache/compiled/gatsby-config.js` ,
91
+ `utf-8`
92
+ )
97
93
98
- it ( `should compile gatsby-node.ts` , async ( ) => {
99
- await compileGatsbyFiles ( dir . ts )
94
+ expect ( compiledGatsbyConfig ) . toContain ( siteMetadata . title )
95
+ expect ( compiledGatsbyConfig ) . toContain ( siteMetadata . siteUrl )
96
+ expect ( compiledGatsbyConfig ) . toContain ( moreDataConfig . options . name )
97
+ } )
100
98
101
- const compiledGatsbyNode = await readFile (
102
- `${ dir . ts } /.cache/compiled/gatsby-node.js` ,
103
- `utf-8`
104
- )
99
+ it ( `should compile gatsby-node.ts` , async ( ) => {
100
+ const compiledGatsbyNode = await readFile (
101
+ `${ dir . ts } /.cache/compiled/gatsby-node.js` ,
102
+ `utf-8`
103
+ )
105
104
106
- expect ( compiledGatsbyNode ) . toContain ( `I am working!` )
105
+ expect ( compiledGatsbyNode ) . toContain ( `I am working!` )
106
+ } )
107
107
} )
108
108
} )
109
109
} )
0 commit comments