@@ -207,7 +207,7 @@ function runProject(project) {
207
207
)
208
208
)
209
209
}
210
- projectPath = `side-suite-${ project . name } `
210
+ projectPath = `side-suite-${ sanitizeFileName ( project . name ) } `
211
211
rimraf . sync ( projectPath )
212
212
fs . mkdirSync ( projectPath )
213
213
fs . writeFileSync (
@@ -251,17 +251,21 @@ function runProject(project) {
251
251
? ''
252
252
: 'beforeEach(() => {vars = {};});afterEach(async () => (cleanup()));'
253
253
writeJSFile (
254
- path . join ( projectPath , suite . name ) ,
254
+ path . join ( projectPath , sanitizeFileName ( suite . name ) ) ,
255
255
`// This file was generated using Selenium IDE\nconst tests = require("./commons.js");${
256
256
code . globalConfig
257
257
} ${ suite . code } ${ cleanup } `
258
258
)
259
259
} else if ( suite . tests . length ) {
260
- fs . mkdirSync ( path . join ( projectPath , suite . name ) )
260
+ fs . mkdirSync ( path . join ( projectPath , sanitizeFileName ( suite . name ) ) )
261
261
// parallel suite
262
262
suite . tests . forEach ( test => {
263
263
writeJSFile (
264
- path . join ( projectPath , suite . name , test . name ) ,
264
+ path . join (
265
+ projectPath ,
266
+ sanitizeFileName ( suite . name ) ,
267
+ sanitizeFileName ( test . name )
268
+ ) ,
265
269
`// This file was generated using Selenium IDE\nconst tests = require("../commons.js");${
266
270
code . globalConfig
267
271
} ${ test . code } `
@@ -366,6 +370,10 @@ function writeJSFile(name, data, postfix = '.test.js') {
366
370
fs . writeFileSync ( `${ name } ${ postfix } ` , beautify ( data , { indent_size : 2 } ) )
367
371
}
368
372
373
+ function sanitizeFileName ( name ) {
374
+ return name . replace ( / ( [ ^ a - z 0 - 9 . _ - ] + ) / gi, '' )
375
+ }
376
+
369
377
const projects = [
370
378
...program . args . reduce ( ( projects , project ) => {
371
379
glob . sync ( project ) . forEach ( p => {
0 commit comments