Skip to content

Commit 5543cb3

Browse files
committed
test: fix win tests #2
1 parent 56a3687 commit 5543cb3

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

test/read-file.test.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ describe('+ readFile()', function () {
4949

5050
describe('> when invalid JSON and passParsingErrors set to false', function () {
5151
it('should return null and no error', function (done) {
52-
var file = path.join(TEST_DIR, 'somefile4-invalid.json')
52+
var fn = 'somefile4-invalid.json'
53+
var file = path.join(TEST_DIR, fn)
5354
var data = '{not valid JSON'
5455
var bothDone = false
5556
fs.writeFileSync(file, data)
5657

5758
jf.readFile(file, function (err, obj2) {
5859
assert(err instanceof Error)
59-
assert(err.message.match(file))
60+
assert(err.message.match(fn))
6061
if (bothDone) {
6162
done()
6263
}
@@ -76,14 +77,15 @@ describe('+ readFile()', function () {
7677

7778
describe('> when invalid JSON and throws set to false', function () {
7879
it('should return null and no error', function (done) {
79-
var file = path.join(TEST_DIR, 'somefile4-invalid.json')
80+
var fn = 'somefile4-invalid.json'
81+
var file = path.join(TEST_DIR, fn)
8082
var data = '{not valid JSON'
8183
var bothDone = false
8284
fs.writeFileSync(file, data)
8385

8486
jf.readFile(file, function (err, obj2) {
8587
assert(err instanceof Error)
86-
assert(err.message.match(file))
88+
assert(err.message.match(fn))
8789
if (bothDone) {
8890
done()
8991
}
@@ -103,14 +105,15 @@ describe('+ readFile()', function () {
103105

104106
describe('> when invalid JSON and passParsingErrors set to true', function () {
105107
it('should return an error', function (done) {
106-
var file = path.join(TEST_DIR, 'somefile4-invalid.json')
108+
var fn = 'somefile4-invalid.json'
109+
var file = path.join(TEST_DIR, fn)
107110
var data = '{not valid JSON'
108111
var bothDone = false
109112
fs.writeFileSync(file, data)
110113

111114
jf.readFile(file, function (err, obj2) {
112115
assert(err instanceof Error)
113-
assert(err.message.match(file))
116+
assert(err.message.match(fn))
114117
if (bothDone) {
115118
done()
116119
}
@@ -130,14 +133,15 @@ describe('+ readFile()', function () {
130133

131134
describe('> when invalid JSON and throws set to true', function () {
132135
it('should return an error', function (done) {
133-
var file = path.join(TEST_DIR, 'somefile4-invalid.json')
136+
var fn = 'somefile4-invalid.json'
137+
var file = path.join(TEST_DIR, fn)
134138
var data = '{not valid JSON'
135139
var bothDone = false
136140
fs.writeFileSync(file, data)
137141

138142
jf.readFile(file, function (err, obj2) {
139143
assert(err instanceof Error)
140-
assert(err.message.match(file))
144+
assert(err.message.match(fn))
141145
if (bothDone) {
142146
done()
143147
}

0 commit comments

Comments
 (0)