@@ -2,11 +2,12 @@ import path from 'path';
22import { readFile , copy , outputFile , remove } from 'fs-extra' ;
33import test from 'ava' ;
44import { spy , match } from 'sinon' ;
5+ import tempy from 'tempy' ;
56import cssnano from 'cssnano' ;
67import mixins from 'postcss-mixins' ;
78import simpleVars from 'postcss-simple-vars' ;
89import atImport from 'postcss-import' ;
9- import { tmp , waitFor , compile } from './helpers/utils' ;
10+ import { waitFor , compile } from './helpers/utils' ;
1011import { mockPreprocessor } from './helpers/mock' ;
1112
1213test ( 'Compile css file' , async t => {
@@ -227,7 +228,7 @@ test('Do not add dependency to watcher if parent is not watched', async t => {
227228} ) ;
228229
229230test ( 'Add dependency to watcher only once, even when its referenced multiple times' , async t => {
230- const dir = path . resolve ( tmp ( ) ) ;
231+ const dir = tempy . directory ( ) ;
231232 const fixture = path . join ( dir , 'with-partial.css' ) ;
232233 const otherFixture = path . join ( dir , 'other-with-partial.css' ) ;
233234 const includePath = path . join ( dir , 'partials' ) ;
@@ -286,7 +287,7 @@ test('Add dependency to watcher only once if file is overwritten', async t => {
286287} ) ;
287288
288289test ( 'Remove dependency from watcher if not referenced anymore' , async t => {
289- const dir = path . resolve ( tmp ( ) ) ;
290+ const dir = tempy . directory ( ) ;
290291 const fixture = path . join ( dir , 'with-partial.css' ) ;
291292 const includePath = path . join ( dir , 'partials' ) ;
292293 const partial = path . join ( includePath , 'partial.css' ) ;
@@ -322,7 +323,7 @@ test('Remove dependency from watcher if not referenced anymore', async t => {
322323} ) ;
323324
324325test ( 'Do not remove dependency from watcher when unreferenced, if another file still depends on it' , async t => {
325- const dir = path . resolve ( tmp ( ) ) ;
326+ const dir = tempy . directory ( ) ;
326327 const fixture = path . join ( dir , 'with-partial.css' ) ;
327328 const otherFixture = path . join ( dir , 'other-with-partial.css' ) ;
328329 const includePath = path . join ( dir , 'partials' ) ;
@@ -363,7 +364,7 @@ test('Do not remove dependency from watcher when unreferenced, if another file s
363364} ) ;
364365
365366test ( 'Do not remove dependency from watcher when different files have differents childs' , async t => {
366- const dir = path . resolve ( tmp ( ) ) ;
367+ const dir = tempy . directory ( ) ;
367368 const fixture = path . join ( dir , 'with-partial.css' ) ;
368369 const otherFixture = path . join ( dir , 'other-with-partial.css' ) ;
369370 const includePath = path . join ( dir , 'partials' ) ;
@@ -403,7 +404,7 @@ test('Do not remove dependency from watcher when different files have differents
403404} ) ;
404405
405406test ( 'Call refreshFiles when dependency is modified' , async t => {
406- const dir = path . resolve ( tmp ( ) ) ;
407+ const dir = tempy . directory ( ) ;
407408 const fixture = path . join ( dir , 'with-partial.css' ) ;
408409 const includePath = path . join ( dir , 'partials' ) ;
409410 const partial = path . join ( includePath , 'partial.css' ) ;
@@ -431,7 +432,7 @@ test('Call refreshFiles when dependency is modified', async t => {
431432} ) ;
432433
433434test ( 'Call refreshFiles when dependency is deleted and added' , async t => {
434- const dir = path . resolve ( tmp ( ) ) ;
435+ const dir = tempy . directory ( ) ;
435436 const fixture = path . join ( dir , 'with-partial.css' ) ;
436437 const includePath = path . join ( dir , 'partials' ) ;
437438 const partial = path . join ( includePath , 'partial.css' ) ;
0 commit comments