File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66var fs = require ( 'fs-extra' ) ;
77var path = require ( 'path' ) ;
88var assert = require ( 'chai' ) . assert ;
9- var wiredep = require ( '../wiredep' ) ;
9+ var wiredep ;
10+
11+ require . uncache = function ( moduleName ) {
12+ var mod = require . resolve ( moduleName ) ;
13+ if ( mod && ( ( mod = require . cache [ mod ] ) !== undefined ) ) {
14+ ( function run ( mod ) {
15+ mod . children . forEach ( function ( child ) {
16+ run ( child ) ;
17+ } ) ;
18+ delete require . cache [ mod . id ] ;
19+ } ) ( mod ) ;
20+ }
21+
22+ Object . keys ( module . constructor . _pathCache ) . forEach ( function ( cacheKey ) {
23+ if ( cacheKey . indexOf ( moduleName ) > 0 ) {
24+ delete module . constructor . _pathCache [ cacheKey ] ;
25+ }
26+ } ) ;
27+ } ;
1028
1129describe ( 'wiredep' , function ( ) {
30+ beforeEach ( function ( ) {
31+ wiredep = require ( '../wiredep' ) ;
32+ } )
33+ afterEach ( function ( ) {
34+ require . uncache ( '../wiredep' ) ;
35+ } )
1236 before ( function ( ) {
1337 fs . copySync ( 'test/fixture' , '.tmp' ) ;
1438 process . chdir ( '.tmp' ) ;
You can’t perform that action at this time.
0 commit comments