This repository was archived by the owner on Oct 1, 2020. It is now read-only.
File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,9 @@ const preprocessor = (options = {}) => {
76
76
// we're provided a default output path that lives alongside Cypress's
77
77
// app data files so we don't have to worry about where to put the bundled
78
78
// file on disk
79
- const outputPath = file . outputPath
79
+ const outputPath = path . extname ( file . outputPath ) === '.js'
80
+ ? file . outputPath
81
+ : `${ file . outputPath } .js`
80
82
81
83
// we need to set entry and output
82
84
webpackOptions = Object . assign ( webpackOptions , {
Original file line number Diff line number Diff line change @@ -132,6 +132,17 @@ describe('webpack preprocessor', function () {
132
132
} )
133
133
} )
134
134
135
+ it ( 'adds .js extension to filename when the originating file had been no javascript file' , function ( ) {
136
+ this . file . outputPath = 'output/output.ts'
137
+
138
+ return this . run ( ) . then ( ( ) => {
139
+ expect ( webpack . lastCall . args [ 0 ] . output ) . to . eql ( {
140
+ path : 'output' ,
141
+ filename : 'output.ts.js' ,
142
+ } )
143
+ } )
144
+ } )
145
+
135
146
it ( 'enables inline source maps' , function ( ) {
136
147
return this . run ( ) . then ( ( ) => {
137
148
expect ( webpack . lastCall . args [ 0 ] . devtool ) . to . equal ( 'inline-source-map' )
@@ -179,6 +190,15 @@ describe('webpack preprocessor', function () {
179
190
} )
180
191
} )
181
192
193
+ it ( 'adds .js extension and resolves with that output path when the originating file had been no javascript file' , function ( ) {
194
+ this . file . outputPath = 'output/output.ts'
195
+ const expectedOutputPath = 'output/output.ts.js'
196
+
197
+ return this . run ( ) . then ( ( outputPath ) => {
198
+ expect ( outputPath ) . to . be . equal ( expectedOutputPath )
199
+ } )
200
+ } )
201
+
182
202
it ( 'emits "rerun" when shouldWatch is true and there is an update' , function ( ) {
183
203
this . file . shouldWatch = true
184
204
this . compilerApi . watch . yields ( null , this . statsApi )
You can’t perform that action at this time.
0 commit comments