@@ -2,7 +2,7 @@ import assert from "node:assert/strict";
2
2
import path from "node:path" ;
3
3
import { afterEach , beforeEach , describe , it } from "node:test" ;
4
4
5
- import { readUtf8File , remove } from "@ignored/hardhat-vnext-utils/fs" ;
5
+ import { readJsonFile , remove } from "@ignored/hardhat-vnext-utils/fs" ;
6
6
import { spawnDetachedSubProcess } from "@ignored/hardhat-vnext-utils/subprocess" ;
7
7
8
8
import {
@@ -40,9 +40,9 @@ describe("sentry-subprocess", function () {
40
40
} ) ;
41
41
42
42
await checkIfSubprocessWasExecuted ( RESULT_FILE_PATH ) ;
43
- const fileRes = await readUtf8File ( RESULT_FILE_PATH ) ;
43
+ const fileRes = await readJsonFile ( RESULT_FILE_PATH ) ;
44
44
45
- assert . equal ( fileRes , "{}" ) ;
45
+ assert . deepEqual ( fileRes , { } ) ;
46
46
} ) ;
47
47
48
48
it ( "should send a failure message to Sentry because no argument is passed in argv[2] (serializedEvent)" , async ( ) => {
@@ -51,12 +51,11 @@ describe("sentry-subprocess", function () {
51
51
} ) ;
52
52
53
53
await checkIfSubprocessWasExecuted ( RESULT_FILE_PATH ) ;
54
- const fileRes = await readUtf8File ( RESULT_FILE_PATH ) ;
54
+ const fileRes = await readJsonFile ( RESULT_FILE_PATH ) ;
55
55
56
- assert . equal (
57
- fileRes ,
58
- "There was an error parsing an event: 'process.argv[2]' argument is not set" ,
59
- ) ;
56
+ assert . deepEqual ( fileRes , {
57
+ msg : "There was an error parsing an event: 'process.argv[2]' argument is not set" ,
58
+ } ) ;
60
59
} ) ;
61
60
62
61
it ( "should send a failure message to Sentry because the argument in argv[2] is not a valid JSON" , async ( ) => {
@@ -65,12 +64,11 @@ describe("sentry-subprocess", function () {
65
64
} ) ;
66
65
67
66
await checkIfSubprocessWasExecuted ( RESULT_FILE_PATH ) ;
68
- const fileRes = await readUtf8File ( RESULT_FILE_PATH ) ;
67
+ const fileRes = await readJsonFile ( RESULT_FILE_PATH ) ;
69
68
70
- assert . equal (
71
- fileRes ,
72
- "There was an error parsing an event: 'process.argv[2]' doesn't have a valid JSON" ,
73
- ) ;
69
+ assert . deepEqual ( fileRes , {
70
+ msg : "There was an error parsing an event: 'process.argv[2]' doesn't have a valid JSON" ,
71
+ } ) ;
74
72
} ) ;
75
73
76
74
it ( "should send a failure message to Sentry because there is an anonymization error" , async ( ) => {
@@ -79,11 +77,10 @@ describe("sentry-subprocess", function () {
79
77
} ) ;
80
78
81
79
await checkIfSubprocessWasExecuted ( RESULT_FILE_PATH ) ;
82
- const fileRes = await readUtf8File ( RESULT_FILE_PATH ) ;
80
+ const fileRes = await readJsonFile ( RESULT_FILE_PATH ) ;
83
81
84
- assert . equal (
85
- fileRes ,
86
- "There was an error anonymizing an event: event is null or undefined" ,
87
- ) ;
82
+ assert . deepEqual ( fileRes , {
83
+ msg : "There was an error anonymizing an event: event is null or undefined" ,
84
+ } ) ;
88
85
} ) ;
89
86
} ) ;
0 commit comments