File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -5,17 +5,28 @@ import { stub } from 'sinon';
55import { temporaryFile , temporaryDirectory } from 'tempy' ;
66
77const { HOME } = process . env ;
8- const cwd = process . cwd ( ) ;
8+ const oldCwd = process . cwd ( ) ;
9+ let cwd ;
10+
11+ test . before ( ( t ) => {
12+ process . env . HOME = temporaryDirectory ( ) ;
13+ cwd = temporaryDirectory ( ) ;
14+ process . chdir ( cwd ) ;
15+ } ) ;
16+
17+ test . beforeEach ( async ( t ) => {
18+ // Clear files
19+ await fs . remove ( resolve ( process . env . HOME , ".npmrc" ) ) ;
20+ await fs . remove ( resolve ( cwd , ".npmrc" ) ) ;
921
10- test . beforeEach ( ( t ) => {
1122 // Stub the logger
1223 t . context . log = stub ( ) ;
1324 t . context . logger = { log : t . context . log } ;
1425} ) ;
1526
16- test . afterEach . always ( ( ) => {
27+ test . after . always ( ( ) => {
1728 process . env . HOME = HOME ;
18- process . chdir ( cwd ) ;
29+ process . chdir ( oldCwd ) ;
1930} ) ;
2031
2132test . serial ( 'Set auth with "NPM_TOKEN"' , async ( t ) => {
You can’t perform that action at this time.
0 commit comments