@@ -58,10 +58,20 @@ if (fs.statSync(testPath).isDirectory() &&
58
58
testToRun === 'appendSuffixToWatch' ) { return ; }
59
59
60
60
// @ts -ignore
61
- it ( 'should work with transpile' , createTest ( testToRun , testPath , { transpile : true } ) ) ;
61
+ it ( 'should work with transpileOnly' , createTest ( testToRun , testPath , { transpileOnly : true } ) ) ;
62
+
63
+ // The future....
64
+ // it('should work with experimentalFileCaching', createTest(testToRun, testPath, { experimentalFileCaching: true }));
62
65
} ) ;
63
66
}
64
67
68
+
69
+ /**
70
+ * Create a Jasmine test
71
+ * @param {string } test
72
+ * @param {string } testPath
73
+ * @param {any } options
74
+ */
65
75
function createTest ( test , testPath , options ) {
66
76
return function ( done ) {
67
77
this . timeout ( 60000 ) ; // sometimes it just takes awhile
@@ -82,7 +92,7 @@ function createTest(test, testPath, options) {
82
92
83
93
// execute webpack
84
94
testState . watcher = webpack (
85
- createWebpackConfig ( paths , options . transpile )
95
+ createWebpackConfig ( paths , options )
86
96
) . watch ( { aggregateTimeout : 1500 } , createWebpackWatchHandler ( done , paths , testState , outputs , options , test ) ) ;
87
97
} ;
88
98
}
@@ -97,7 +107,7 @@ function createTestState() {
97
107
}
98
108
99
109
function createPaths ( stagingPath , test , options ) {
100
- var testStagingPath = path . join ( stagingPath , test + ( options . transpile ? '.transpile' : '' ) ) ;
110
+ var testStagingPath = path . join ( stagingPath , test + ( options . transpileOnly ? '.transpile' : '' ) ) ;
101
111
return {
102
112
testStagingPath : testStagingPath ,
103
113
actualOutput : path . join ( testStagingPath , 'actualOutput' ) ,
@@ -121,26 +131,24 @@ function storeSavedOutputs(saveOutputMode, outputs, test, options, paths) {
121
131
122
132
outputs . regularSavedOutput = savedOutputs [ test ] . regular = savedOutputs [ test ] . regular || { } ;
123
133
outputs . transpiledSavedOutput = savedOutputs [ test ] . transpiled = savedOutputs [ test ] . transpiled || { } ;
124
- outputs . currentSavedOutput = options . transpile ? outputs . transpiledSavedOutput : outputs . regularSavedOutput ;
134
+ outputs . currentSavedOutput = options . transpileOnly ? outputs . transpiledSavedOutput : outputs . regularSavedOutput ;
125
135
126
136
mkdirp . sync ( paths . originalExpectedOutput ) ;
127
137
} else {
128
138
assert . ok ( pathExists ( paths . originalExpectedOutput ) , 'The expected output does not exist; there is nothing to compare against! Has the expected output been created?\nCould not find: ' + paths . originalExpectedOutput )
129
139
}
130
140
}
131
141
132
- function createWebpackConfig ( paths , transpile ) {
142
+ function createWebpackConfig ( paths , optionsOriginal ) {
133
143
var config = require ( path . join ( paths . testStagingPath , 'webpack.config' ) ) ;
134
144
135
- var options = {
145
+ var options = Object . assign ( {
136
146
// colors: false,
137
147
silent : true ,
138
148
compilerOptions : {
139
149
newLine : 'LF'
140
150
}
141
- }
142
-
143
- if ( transpile ) { options . transpileOnly = true ; }
151
+ } , optionsOriginal ) ;
144
152
145
153
var tsLoaderPath = require ( 'path' ) . join ( __dirname , "../../index.js" ) ;
146
154
@@ -203,7 +211,7 @@ function saveOutputIfRequired(saveOutputMode, paths, outputs, options, patch) {
203
211
var patchedFileName = patch + '/' + file ;
204
212
outputs . currentSavedOutput [ patchedFileName ] = fs . readFileSync ( path . join ( paths . webpackOutput , file ) , 'utf-8' ) ;
205
213
206
- if ( options . transpile ) {
214
+ if ( options . transpileOnly ) {
207
215
if ( outputs . regularSavedOutput [ patchedFileName ] !== outputs . transpiledSavedOutput [ patchedFileName ] ) {
208
216
var extension = path . extname ( file ) ;
209
217
fs . renameSync (
@@ -233,7 +241,7 @@ function handleErrors(err, paths, outputs, patch, options) {
233
241
var patchedErrFileName = patch + '/' + errFileName ;
234
242
outputs . currentSavedOutput [ patchedErrFileName ] = errString ;
235
243
236
- if ( options . transpile ) {
244
+ if ( options . transpileOnly ) {
237
245
if ( outputs . regularSavedOutput [ patchedErrFileName ] !== outputs . transpiledSavedOutput [ patchedErrFileName ] ) {
238
246
fs . writeFileSync ( path . join ( paths . originalExpectedOutput , 'err.transpiled.txt' ) , errString ) ;
239
247
}
@@ -271,7 +279,7 @@ function storeStats(stats, testState, paths, outputs, patch, options) {
271
279
var patchedStatsFileName = patch + '/' + statsFileName ;
272
280
outputs . currentSavedOutput [ patchedStatsFileName ] = statsString ;
273
281
274
- if ( options . transpile ) {
282
+ if ( options . transpileOnly ) {
275
283
if ( outputs . regularSavedOutput [ patchedStatsFileName ] !== outputs . transpiledSavedOutput [ patchedStatsFileName ] ) {
276
284
fs . writeFileSync ( path . join ( paths . originalExpectedOutput , 'output.transpiled.txt' ) , statsString ) ;
277
285
}
@@ -288,7 +296,7 @@ function compareFiles(paths, options, test, patch) {
288
296
// massage any .transpiled. files
289
297
glob . sync ( '**/*' , { cwd : paths . expectedOutput , nodir : true } ) . forEach ( function ( file ) {
290
298
if ( / \. t r a n s p i l e d / . test ( file ) ) {
291
- if ( options . transpile ) { // rename if we're in transpile mode
299
+ if ( options . transpileOnly ) { // rename if we're in transpile mode
292
300
var extension = path . extname ( file ) ;
293
301
fs . renameSync (
294
302
path . join ( paths . expectedOutput , file ) ,
0 commit comments