1
1
import { jest , test , expect } from "@jest/globals" ;
2
2
3
3
import { makeContext } from "./fixtures/context" ;
4
- import { RollupContext } from "../src/context" ;
4
+ import { RollupContext , VerbosityLevel } from "../src/context" ;
5
5
6
6
( global as any ) . console = {
7
7
warn : jest . fn ( ) ,
@@ -11,7 +11,7 @@ import { RollupContext } from "../src/context";
11
11
12
12
test ( "RollupContext" , ( ) => {
13
13
const innerContext = makeContext ( ) ;
14
- const context = new RollupContext ( 5 , false , innerContext ) ;
14
+ const context = new RollupContext ( 5 as VerbosityLevel , false , innerContext ) ;
15
15
16
16
context . warn ( "test" ) ;
17
17
expect ( innerContext . warn ) . toHaveBeenLastCalledWith ( "test" ) ;
@@ -40,7 +40,7 @@ test("RollupContext", () => {
40
40
41
41
test ( "RollupContext with 0 verbosity" , ( ) => {
42
42
const innerContext = makeContext ( ) ;
43
- const context = new RollupContext ( 0 , false , innerContext ) ;
43
+ const context = new RollupContext ( VerbosityLevel . Error , false , innerContext ) ;
44
44
45
45
context . debug ( "verbosity is too low here" ) ;
46
46
expect ( innerContext . debug ) . not . toBeCalled ( ) ;
@@ -52,7 +52,7 @@ test("RollupContext with 0 verbosity", () => {
52
52
53
53
test ( "RollupContext.error + debug negative verbosity" , ( ) => {
54
54
const innerContext = makeContext ( ) ;
55
- const context = new RollupContext ( - 100 , true , innerContext ) ;
55
+ const context = new RollupContext ( - 100 as VerbosityLevel , true , innerContext ) ;
56
56
57
57
context . error ( "verbosity is too low here" ) ;
58
58
expect ( innerContext . error ) . not . toBeCalled ( ) ;
@@ -62,7 +62,7 @@ test("RollupContext.error + debug negative verbosity", () => {
62
62
63
63
test ( "RollupContext.error with bail" , ( ) => {
64
64
const innerContext = makeContext ( ) ;
65
- const context = new RollupContext ( 5 , true , innerContext ) ;
65
+ const context = new RollupContext ( 5 as VerbosityLevel , true , innerContext ) ;
66
66
67
67
context . error ( "bail" ) ;
68
68
expect ( innerContext . error ) . toHaveBeenLastCalledWith ( "bail" ) ;
0 commit comments