File tree Expand file tree Collapse file tree 8 files changed +33
-0
lines changed
test/configCases/context-exclusion/simple Expand file tree Collapse file tree 8 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ function requireInContext ( someVariable ) {
2+ return require ( `./some-dir/${ someVariable } ` ) ;
3+ }
4+
5+ it ( "should not exclude paths not matching the exclusion pattern" , function ( ) {
6+ requireInContext ( "file" ) . should . be . eql ( "thats good" ) ;
7+ requireInContext ( "check-here/file" ) . should . be . eql ( "thats good" ) ;
8+ requireInContext ( "check-here/check-here/file" ) . should . be . eql ( "thats good" ) ;
9+ } ) ;
10+
11+ it ( "should exclude paths/files matching the exclusion pattern" , function ( ) {
12+ ( ( ) => requireInContext ( "dont" ) ) .
13+ should . throw ( / C a n n o t f i n d m o d u l e ' .\/ d o n t ' / ) ;
14+
15+ ( ( ) => requireInContext ( "dont-check-here/file" ) ) .
16+ should . throw ( / C a n n o t f i n d m o d u l e ' .\/ d o n t - c h e c k - h e r e \/ f i l e ' / ) ;
17+
18+ ( ( ) => requireInContext ( "check-here/dont-check-here/file" ) ) .
19+ should . throw ( / C a n n o t f i n d m o d u l e ' .\/ c h e c k - h e r e \/ d o n t - c h e c k - h e r e \/ f i l e ' / ) ;
20+ } ) ;
Original file line number Diff line number Diff line change 1+ module . exports = "thats good" ;
Original file line number Diff line number Diff line change 1+ module . exports = "thats bad" ;
Original file line number Diff line number Diff line change 1+ module . exports = "thats good" ;
Original file line number Diff line number Diff line change 1+ module . exports = "thats bad" ;
Original file line number Diff line number Diff line change 1+ module . exports = "thats bad" ;
Original file line number Diff line number Diff line change 1+ module . exports = "thats good" ;
Original file line number Diff line number Diff line change 1+ var webpack = require ( "../../../../" ) ;
2+
3+ module . exports = {
4+ plugins : [
5+ new webpack . ContextExclusionPlugin ( / d o n t / )
6+ ]
7+ } ;
You can’t perform that action at this time.
0 commit comments