Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Add nyc-mocha-cjs-bridge scenario test
Browse files Browse the repository at this point in the history
  • Loading branch information
Cache Hamm committed Apr 7, 2018
1 parent 706736c commit 94a6736
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/fixture/scenario/nyc-mocha-cjs-bridge/add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default (a, b) => a + b
3 changes: 3 additions & 0 deletions test/fixture/scenario/nyc-mocha-cjs-bridge/cwd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict"

process.chdir(__dirname)
5 changes: 5 additions & 0 deletions test/fixture/scenario/nyc-mocha-cjs-bridge/require-add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict"

require = require("../../../../")(module)
const add = require("./add").default
module.exports = add
4 changes: 4 additions & 0 deletions test/fixture/scenario/nyc-mocha-cjs-bridge/test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import assert from "assert"
import add from "../require-add"

assert(add(1, 2), 3)
13 changes: 13 additions & 0 deletions test/scenario-tests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ describe("scenarios", function () {
, Promise.resolve())
)

it("should work with nyc, mocha, and cjs bridge", () => {
const dirPath = path.resolve(testPath, "fixture/scenario/nyc-mocha-cjs-bridge")
const cwdPath = path.resolve(dirPath, "cwd.js")
const mochaPattern = path.resolve(dirPath, "test")

return exec("nyc", [
"--cwd", dirPath,
"-i", cwdPath,
"-i", pkgPath,
"mocha", mochaPattern
], envAuto)
})

it("should work with esmod-pmb", () =>
exec(nodePath, [path.resolve(testPath, "fixture/scenario/esmod-pmb/test.node.js")])
)
Expand Down

0 comments on commit 94a6736

Please sign in to comment.