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: replace var with const in test-require-dot #9916

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
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
20 changes: 10 additions & 10 deletions test/parallel/test-require-dot.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var module = require('module');
const common = require('../common');
const assert = require('assert');
const m = require('module');
Copy link
Contributor

Choose a reason for hiding this comment

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

why not keeping module as it is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

keeping the module as it is causes an error, hence renaming it something else:

/Users/amarz/summit16/node/test/parallel/test-require-dot.js:4
const module = require('module');
                               ^
SyntaxError: Identifier 'module' has already been declared


var a = require(common.fixturesDir + '/module-require/relative/dot.js');
var b = require(common.fixturesDir + '/module-require/relative/dot-slash.js');
const a = require(common.fixturesDir + '/module-require/relative/dot.js');
const b = require(common.fixturesDir + '/module-require/relative/dot-slash.js');

assert.equal(a.value, 42);
assert.equal(a, b, 'require(".") should resolve like require("./")');
assert.strictEqual(a.value, 42);
assert.strictEqual(a, b, 'require(".") should resolve like require("./")');

process.env.NODE_PATH = common.fixturesDir + '/module-require/relative';
module._initPaths();
m._initPaths();

var c = require('.');
const c = require('.');

assert.equal(c.value, 42, 'require(".") should honor NODE_PATH');
assert.strictEqual(c.value, 42, 'require(".") should honor NODE_PATH');