@@ -5,6 +5,7 @@ const rimraf = require('rimraf');
55const promisify = require ( '../src/utils/promisify' ) ;
66const ncp = promisify ( require ( 'ncp' ) ) ;
77const WebSocket = require ( 'ws' ) ;
8+ const parseJson = require ( 'parse-json' ) ;
89
910describe ( 'hmr' , function ( ) {
1011 let b , ws ;
@@ -44,7 +45,7 @@ describe('hmr', function () {
4445
4546 fs . writeFileSync ( __dirname + '/input/local.js' , 'exports.a = 5; exports.b = 5;' ) ;
4647
47- let msg = JSON . parse ( await nextEvent ( ws , 'message' ) ) ;
48+ let msg = parseJson ( await nextEvent ( ws , 'message' ) ) ;
4849 assert . equal ( msg . type , 'update' ) ;
4950 assert . equal ( msg . assets . length , 1 ) ;
5051 assert . equal ( msg . assets [ 0 ] . generated . js , 'exports.a = 5; exports.b = 5;' ) ;
@@ -61,7 +62,7 @@ describe('hmr', function () {
6162
6263 fs . writeFileSync ( __dirname + '/input/local.js' , 'require("fs"); exports.a = 5; exports.b = 5;' ) ;
6364
64- let msg = JSON . parse ( await nextEvent ( ws , 'message' ) ) ;
65+ let msg = parseJson ( await nextEvent ( ws , 'message' ) ) ;
6566 assert . equal ( msg . type , 'update' ) ;
6667 assert . equal ( msg . assets . length , 2 ) ;
6768 } ) ;
@@ -130,4 +131,4 @@ describe('hmr', function () {
130131 await sleep ( 50 ) ;
131132 assert . deepEqual ( outputs , [ 3 , 10 ] ) ;
132133 } ) ;
133- } ) ;
134+ } ) ;
0 commit comments