1
- var test = require ( "tape " )
1
+ var test = require ( "ava " )
2
2
var webpack = require ( "webpack" )
3
- var assign = require ( "object-assign" )
4
3
var conf = require ( "./utils/conf" )
5
4
var fs = require ( "fs" )
6
5
7
6
// clone the "fixable" file, so that we do not lose the original contents
8
7
// when the fixes are applied to disk
9
- test ( "setup" , function ( t ) {
8
+ test . before ( function ( ) {
10
9
fs
11
10
. createReadStream ( "./test/fixtures/fixable.js" )
12
11
. pipe ( fs . createWriteStream ( "./test/fixtures/fixable-clone.js" ) )
13
-
14
- t . end ( )
15
12
} )
16
13
17
- test ( "loader doesn't throw error if file ok after auto-fixing" , function ( t ) {
18
- webpack ( assign ( { } ,
19
- conf ,
14
+ test . cb ( "loader doesn't throw error if file ok after auto-fixing" ,
15
+ function ( t ) {
16
+ t . plan ( 2 )
17
+ webpack ( conf (
20
18
{
21
19
entry : "./test/fixtures/fixable-clone.js" ,
22
20
module : {
@@ -35,15 +33,14 @@ test("loader doesn't throw error if file ok after auto-fixing", function(t) {
35
33
throw err
36
34
}
37
35
// console.log(stats.compilation.errors)
38
- t . notOk ( stats . hasErrors ( ) , "a good file doesn't give any error" )
36
+ t . false ( stats . hasErrors ( ) , "a good file doesn't give any error" )
39
37
// console.log(stats.compilation.warnings)
40
- t . notOk ( stats . hasWarnings ( ) , "a good file doesn't give any warning" )
38
+ t . false ( stats . hasWarnings ( ) , "a good file doesn't give any warning" )
41
39
t . end ( )
42
40
} )
43
41
} )
44
42
45
43
// remove the clone
46
- test ( "teardown" , function ( t ) {
44
+ test . after . always ( function ( ) {
47
45
fs . unlinkSync ( "./test/fixtures/fixable-clone.js" )
48
- t . end ( )
49
46
} )
0 commit comments