Browse Source

test: change common.fixturesDir to fixtures.path

Use common.fixtures module instead of common.fixturesDir based on task
at Nodejs code and learn at Node.js Interactive 2017 in Vancouver.

PR-URL: https://github.com/nodejs/node/pull/15860
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
v9.x-staging
tejbirsingh 7 years ago
committed by Lance Ball
parent
commit
9b3d6a0d8f
No known key found for this signature in database GPG Key ID: 1B4326AE55E9408C
  1. 9
      test/parallel/test-require-exceptions.js

9
test/parallel/test-require-exceptions.js

@ -22,15 +22,16 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const fixtures = require('../common/fixtures');
// A module with an error in it should throw
assert.throws(function() {
require(`${common.fixturesDir}/throws_error`);
require(fixtures.path('/throws_error'));
}, /^Error: blah$/);
// Requiring the same module again should throw as well
assert.throws(function() {
require(`${common.fixturesDir}/throws_error`);
require(fixtures.path('/throws_error'));
}, /^Error: blah$/);
// Requiring a module that does not exist should throw an
@ -43,7 +44,7 @@ assertModuleNotFound('/module-require/not-found/trailingSlash');
function assertModuleNotFound(path) {
assert.throws(function() {
require(common.fixturesDir + path);
require(fixtures.path(path));
}, function(e) {
assert.strictEqual(e.code, 'MODULE_NOT_FOUND');
return true;
@ -51,5 +52,5 @@ function assertModuleNotFound(path) {
}
function assertExists(fixture) {
assert(common.fileExists(common.fixturesDir + fixture));
assert(common.fileExists(fixtures.path(fixture)));
}

Loading…
Cancel
Save