Skip to content

Commit

Permalink
spec: add unit test for resolved node-gyp-build dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael9 committed May 13, 2024
1 parent 96db593 commit 7d08ab2
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 0 deletions.
Empty file.
5 changes: 5 additions & 0 deletions test/unit/node-gyp-build-resolve/fake-binding/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "fake-binding",
"version": "1.0.0",
"description": "Fake binding that contains just enough for node-gyp-build to be able to resolve it (the .node file is a dummy empty file and cannot actually be imported)"
}
2 changes: 2 additions & 0 deletions test/unit/node-gyp-build-resolve/fake-binding/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const path = require("path");
require('node-gyp-build')(path.resolve(__dirname, ".."));
1 change: 1 addition & 0 deletions test/unit/node-gyp-build-resolve/input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./fake-binding/src/index.js');
60 changes: 60 additions & 0 deletions test/unit/node-gyp-build-resolve/output-coverage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 710:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

const path = __webpack_require__(622);
require(__webpack_require__.ab + "node.napi.node");


/***/ }),

/***/ 622:
/***/ ((module) => {

"use strict";
module.exports = require("path");;

/***/ })

/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = __dirname + "/";/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
__webpack_require__(710);

})();

module.exports = __webpack_exports__;
/******/ })()
;
60 changes: 60 additions & 0 deletions test/unit/node-gyp-build-resolve/output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 86:
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {

const path = __webpack_require__(622);
require(__webpack_require__.ab + "node.napi.node");


/***/ }),

/***/ 622:
/***/ ((module) => {

"use strict";
module.exports = require("path");;

/***/ })

/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __webpack_require__ !== 'undefined') __webpack_require__.ab = __dirname + "/";/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
__webpack_require__(86);

})();

module.exports = __webpack_exports__;
/******/ })()
;

0 comments on commit 7d08ab2

Please sign in to comment.