-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
🐛 Bug Report
Suppose you have a file dir/fn.js that requires the current directory using const x = require('./'), and the parent directory has a file dir.js. In Node.js 8, x will contain the exported value from dir/index.js. In Jest, x will contain the exported value from dir.js
To Reproduce
Steps to reproduce the behavior:
https://github.com/vkarpov15/jest-bug
Expected behavior
require() in Jest should behave the same as require() in vanilla Node.js, especially if using the Node test environment.
Link to repl or repo (highly encouraged)
https://github.com/vkarpov15/jest-bug
envinfo
$ npx envinfo --preset jest
npx: installed 1 in 1.063s
System:
OS: Linux 4.15 Ubuntu 16.04.3 LTS (Xenial Xerus)
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Binaries:
Node: 8.9.4 - /usr/bin/node
npm: 5.6.0 - /usr/bin/npm
npmPackages:
jest: 24.9.0 => 24.9.0
$ Green-Cat