Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replacing common.fixturesDir in test-require-exceptions.js #15860

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions test/parallel/test-require-exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const fixtures = require ('../common/fixtures');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter complained:

not ok 25 - /usr/home/iojs/build/workspace/node-test-linter/test/parallel/test-require-exceptions.js
  ---
  message: Unexpected space between function name and paren.
  severity: error
  data:
    line: 25
    column: 18
    ruleId: func-call-spacing
  ...

Can you remove the space after require? Thanks.


// 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
Expand All @@ -43,13 +44,13 @@ 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;
});
}

function assertExists(fixture) {
assert(common.fileExists(common.fixturesDir + fixture));
assert(common.fileExists(fixtures.path(fixture)));
}