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

Require'ing a json file twice returns undefined #62

Closed
ariabuckles opened this issue Jun 3, 2014 · 3 comments
Closed

Require'ing a json file twice returns undefined #62

ariabuckles opened this issue Jun 3, 2014 · 3 comments

Comments

@ariabuckles
Copy link

Hi! I think I may have found a bug in jest. When I require a .json file twice in code jest is running, the second require() seems to return undefined. Here's a test that's failing for me, that I would expect to pass:

jest.autoMockOff();
var assert = require("assert");

describe("requiring json", function() {
    it("should return the same json from multiple requires", function() {
        var version1 = require("../version.json");
        var version2 = require("../version.json");
        assert.notEqual(version1, undefined);
        assert.notEqual(version2, undefined);
        assert.deepEqual(version1, version2);
    });
});

(where the file ../version.json exists, and the above test passes when run by mocha).

ariabuckles pushed a commit to Khan/perseus that referenced this issue Jul 16, 2014
Summary:
We previously had interactive2 test inside the interactive2 folder.
This commit adds those to the test infrastructure already in the
top-level perseus Makefile. yay tests!

Test Plan:
    make test
    make jest

Note: make jest is currently [still] failing due to
jestjs/jest#62

Reviewers: charlie

Reviewed By: charlie

Subscribers: jlfwong

Differential Revision: http://phabricator.khanacademy.org/D11186
ariabuckles pushed a commit to Khan/perseus that referenced this issue Nov 21, 2014
Summary:
We previously had interactive2 test inside the interactive2 folder.
This commit adds those to the test infrastructure already in the
top-level perseus Makefile. yay tests!

Test Plan:
    make test
    make jest

Note: make jest is currently [still] failing due to
jestjs/jest#62

Reviewers: charlie

Reviewed By: charlie

Subscribers: jlfwong

Differential Revision: http://phabricator.khanacademy.org/D11186
@ghost
Copy link

ghost commented Aug 4, 2015

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

@cpojer
Copy link
Member

cpojer commented Oct 23, 2015

This was fixed a while ago :)

@cpojer cpojer closed this as completed Oct 23, 2015
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants