1- const test = require ( 'ava' ) ;
21const output = require ( '../src/output' ) ;
32const deasync = require ( 'deasync' ) ;
4- const assert = require ( 'assert-diff' ) ;
53const webpack = require ( 'webpack' ) ;
64const FriendlyErrorsWebpackPlugin = require ( '../src/friendly-errors-plugin' ) ;
75const MemoryFileSystem = require ( 'memory-fs' ) ;
@@ -17,26 +15,23 @@ const syncWebpackWithPlugin = deasync(function(config, fn) {
1715 return compiler ;
1816} ) ;
1917
20- test ( 'integration : success' , t => {
18+ it ( 'integration : success' , ( ) => {
2119
22- var logs = output . captureLogs ( ( ) => {
20+ const logs = output . captureLogs ( ( ) => {
2321 syncWebpack ( require ( './fixtures/success/webpack.config' ) ) ;
2422 } ) ;
2523
26- assert (
27- / D O N E C o m p i l e d s u c c e s s f u l l y i n ( .\d * ) m s / . test ( logs ) ,
28- 'Expected logs to include \'DONE Compiled successfully in {{number}}ms\''
29- ) ;
24+ expect ( logs . join ( '\n' ) ) . toMatch ( / D O N E C o m p i l e d s u c c e s s f u l l y i n ( .\d * ) m s / ) ;
3025} ) ;
3126
3227
33- test ( 'integration : module-errors' , t => {
28+ it ( 'integration : module-errors' , ( ) => {
3429
35- var logs = output . captureLogs ( ( ) => {
30+ const logs = output . captureLogs ( ( ) => {
3631 syncWebpack ( require ( './fixtures/module-errors/webpack.config.js' ) ) ;
3732 } ) ;
3833
39- assert . deepEqual ( logs , [
34+ expect ( logs ) . toEqual ( [
4035 ' ERROR Failed to compile with 2 errors' ,
4136 '' ,
4237 'These dependencies were not found in node_modules:' ,
@@ -48,16 +43,16 @@ test('integration : module-errors', t => {
4843 ] ) ;
4944} ) ;
5045
51- test ( 'integration : should display eslint warnings' , t => {
46+ it ( 'integration : should display eslint warnings' , ( ) => {
5247
53- var logs = output . captureLogs ( ( ) => {
48+ const logs = output . captureLogs ( ( ) => {
5449 syncWebpack ( require ( './fixtures/eslint-warnings/webpack.config.js' ) ) ;
5550 } ) ;
5651
57- assert . deepEqual ( logs , [
52+ expect ( logs ) . toEqual ( [
5853 ' WARNING Compiled with 1 warnings' ,
5954 '' ,
60- ' warning in ./fixtures/eslint-warnings/index.js' ,
55+ ' warning in ./test/ fixtures/eslint-warnings/index.js' ,
6156 '' ,
6257 `${ __dirname } /fixtures/eslint-warnings/index.js
6358 1:7 warning 'unused' is assigned a value but never used no-unused-vars
@@ -71,16 +66,16 @@ test('integration : should display eslint warnings', t => {
7166 ] ) ;
7267} ) ;
7368
74- test ( 'integration : babel syntax error' , t => {
69+ it ( 'integration : babel syntax error' , ( ) => {
7570
76- var logs = output . captureLogs ( ( ) => {
71+ const logs = output . captureLogs ( ( ) => {
7772 syncWebpack ( require ( './fixtures/babel-syntax/webpack.config' ) ) ;
7873 } ) ;
7974
80- assert . deepEqual ( logs , [
75+ expect ( logs ) . toEqual ( [
8176 ' ERROR Failed to compile with 1 errors' ,
8277 '' ,
83- ' error in ./fixtures/babel-syntax/index.js' ,
78+ ' error in ./test/ fixtures/babel-syntax/index.js' ,
8479 '' ,
8580 `SyntaxError: Unexpected token (5:11)
8681
@@ -94,25 +89,22 @@ test('integration : babel syntax error', t => {
9489 ] ) ;
9590} ) ;
9691
97- test ( 'integration : webpack multi compiler : success' , t => {
92+ it ( 'integration : webpack multi compiler : success' , ( ) => {
9893
99- var logs = output . captureLogs ( ( ) => {
94+ const logs = output . captureLogs ( ( ) => {
10095 syncWebpackWithPlugin ( require ( './fixtures/multi-compiler-success/webpack.config' ) ) ;
10196 } ) ;
10297
103- assert (
104- / D O N E C o m p i l e d s u c c e s s f u l l y i n ( .\d * ) m s / . test ( logs ) ,
105- 'Expected logs to include \'DONE Compiled successfully in {{number}}ms\''
106- ) ;
98+ expect ( logs . join ( '\n' ) ) . toMatch ( / D O N E C o m p i l e d s u c c e s s f u l l y i n ( .\d * ) m s / )
10799} ) ;
108100
109- test ( 'integration : webpack multi compiler : module-errors' , t => {
101+ it ( 'integration : webpack multi compiler : module-errors' , ( ) => {
110102
111- var logs = output . captureLogs ( ( ) => {
103+ const logs = output . captureLogs ( ( ) => {
112104 syncWebpackWithPlugin ( require ( './fixtures/multi-compiler-module-errors/webpack.config' ) ) ;
113105 } ) ;
114106
115- assert . deepEqual ( logs , [
107+ expect ( logs ) . toEqual ( [
116108 ' ERROR Failed to compile with 2 errors' ,
117109 '' ,
118110 'These dependencies were not found in node_modules:' ,
0 commit comments