• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const path = require('path');
4const fs = require('fs');
5
6const fixturesDir = path.join(__dirname, '..', 'fixtures');
7
8function fixturesPath(...args) {
9  return path.join(fixturesDir, ...args);
10}
11
12function readFixtureSync(args, enc) {
13  if (Array.isArray(args))
14    return fs.readFileSync(fixturesPath(...args), enc);
15  return fs.readFileSync(fixturesPath(args), enc);
16}
17
18function readFixtureKey(name, enc) {
19  return fs.readFileSync(fixturesPath('keys', name), enc);
20}
21
22module.exports = {
23  fixturesDir,
24  path: fixturesPath,
25  readSync: readFixtureSync,
26  readKey: readFixtureKey
27};
28