Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
const inspectLoader = require("../../lib/loader"); | ||
"use strict"; | ||
|
||
const inspectLoader = require("./loader"); | ||
|
||
function rawInspectLoader() { | ||
return inspectLoader.apply(this, arguments); // eslint-disable-line no-invalid-this | ||
} | ||
|
||
rawInspectLoader.raw = true; | ||
Object.assign(rawInspectLoader, { | ||
raw: true | ||
}, inspectLoader); | ||
|
||
module.exports = rawInspectLoader; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("./lib/loader.raw"); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import test from "ava"; | ||
import compile from "./helpers/compile"; | ||
import rawInspectLoader from "../raw"; | ||
import inspectLoader from "../lib/loader"; | ||
|
||
test("should work the same as the inspect-loader just for buffers", t => { | ||
const options = { | ||
callback(i) { | ||
inspect = i; | ||
} | ||
}; | ||
let inspect; | ||
|
||
t.plan(1); | ||
|
||
return compile([{ | ||
loader: require.resolve("../raw"), | ||
options | ||
}]) | ||
.then(() => { | ||
t.true(inspect.arguments[0] instanceof Buffer); | ||
}); | ||
}); | ||
|
||
test("should also expose the same callbacks object", t => { | ||
t.is(inspectLoader.callbacks, rawInspectLoader.callbacks); | ||
}); |
This file contains 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