You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 31, 2023. It is now read-only.
thrownewError(`The 'typescript' option must be a valid path to your TypeScript installation. We could not find anything at the following path: ${typescriptPath}`)
Copy file name to clipboardExpand all lines: test/unit/index_spec.js
+37-5
Original file line number
Diff line number
Diff line change
@@ -424,23 +424,55 @@ describe('browserify preprocessor', function () {
424
424
})
425
425
})
426
426
427
-
describe('when typescript path and tsify are given together',function(){
428
-
it('throws error when it is a plugin',function(){
427
+
describe('validation',function(){
428
+
constshouldntResolve=()=>{
429
+
thrownewError('Should error, should not resolve')
430
+
}
431
+
432
+
it('throws error when typescript path is not a string',function(){
433
+
this.options.typescript=true
434
+
435
+
returnthis.run()
436
+
.then(shouldntResolve)
437
+
.catch((err)=>{
438
+
expect(err.message).to.equal(`The 'typescript' option must be a string. You passed: true`)
439
+
})
440
+
})
441
+
442
+
it('throws error when nothing exists at typescript path',function(){
443
+
this.options.typescript='/nothing/here'
444
+
445
+
returnthis.run()
446
+
.then(shouldntResolve)
447
+
.catch((err)=>{
448
+
expect(err.message).to.equal(`The 'typescript' option must be a valid path to your TypeScript installation. We could not find anything at the following path: /nothing/here`)
449
+
})
450
+
})
451
+
452
+
it('throws error when typescript path and tsify plugin are specified',function(){
429
453
this.options.browserifyOptions={
430
454
plugin: ['tsify'],
431
455
}
432
456
433
-
expect(this.run).to.throw('This may cause conflicts')
457
+
returnthis.run()
458
+
.then(shouldntResolve)
459
+
.catch((err)=>{
460
+
expect(err.message).to.include('This may cause conflicts')
461
+
})
434
462
})
435
463
436
-
it('throws error when it is a transform',function(){
464
+
it('throws error when typescript path and tsify transform are specified',function(){
437
465
this.options.browserifyOptions={
438
466
transform: [
439
467
['path/to/tsify',{}],
440
468
],
441
469
}
442
470
443
-
expect(this.run).to.throw('This may cause conflicts')
471
+
returnthis.run()
472
+
.then(shouldntResolve)
473
+
.catch((err)=>{
474
+
expect(err.message).to.include('This may cause conflicts')
0 commit comments