mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
637 B
29 lines
637 B
8 years ago
|
/* eslint-disable required-modules */
|
||
|
'use strict';
|
||
|
|
||
|
const path = require('path');
|
||
|
const fs = require('fs');
|
||
|
|
||
|
const fixturesDir = path.join(__dirname, '..', 'fixtures');
|
||
|
|
||
|
function fixturesPath(...args) {
|
||
|
return path.join(fixturesDir, ...args);
|
||
|
}
|
||
|
|
||
|
function readFixtureSync(args, enc) {
|
||
|
if (Array.isArray(args))
|
||
|
return fs.readFileSync(fixturesPath(...args), enc);
|
||
|
return fs.readFileSync(fixturesPath(args), enc);
|
||
|
}
|
||
|
|
||
|
function readFixtureKey(name, enc) {
|
||
|
return fs.readFileSync(fixturesPath('keys', name), enc);
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
fixturesDir,
|
||
|
path: fixturesPath,
|
||
|
readSync: readFixtureSync,
|
||
|
readKey: readFixtureKey
|
||
|
};
|