Skip to content

Commit 74e39bb

Browse files
committed
test fixup
1 parent b1fb413 commit 74e39bb

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

Diff for: test/resolver_sync.js

+13-10
Original file line numberDiff line numberDiff line change
@@ -220,20 +220,23 @@ test('sync: #121 - treating an existing file as a dir when no basedir', function
220220
});
221221

222222
t.test('with a trailing slash', function (st) {
223-
function run() { return resolve.sync('./' + testFile + '/'); }
224-
225-
st.throws(run, 'throws an error');
223+
var path = './' + testFile + '/';
224+
function run() { return resolve.sync(path); }
226225

226+
var result, error;
227227
try {
228-
run();
228+
result = run();
229229
} catch (e) {
230-
st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');
231-
st.equal(
232-
e.message,
233-
'Cannot find module \'./' + testFile + '/\' from \'' + __dirname + '\'',
234-
'can not find nonexistent module'
235-
);
230+
error = e;
236231
}
232+
st.ok(error, 'there is an error');
233+
st.notOk(result, 'no result');
234+
st.equal(error && error.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');
235+
st.equal(
236+
error && error.message,
237+
'Cannot find module \'' + path + '\' from \'' + __dirname + '\'',
238+
'can not find nonexistent module'
239+
);
237240

238241
st.end();
239242
});

0 commit comments

Comments
 (0)