npm install
npx jest
Last active
January 11, 2018 10:44
-
-
Save JLHwung/281f004baa1c40f28cc444f8e49e604f to your computer and use it in GitHub Desktop.
integration issue with jest and mock-require
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mock = require("mock-require"); | |
mock.stopAll(); | |
require = require("@std/esm")(module) | |
module.exports = require("./main.mjs").default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("./index"); | |
describe("foo", () => { | |
it("should work"); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from "path" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "playground", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"@std/esm": { | |
"cjs": true, | |
"cache": false | |
}, | |
"dependencies": { | |
"@std/esm": "^0.19.1", | |
"mock-require": "^2.0.2" | |
}, | |
"devDependencies": { | |
"jest": "^22.0.6" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment