Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove promisify, use fs/promises and glob-promise instead #135

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/reader.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
var Promise = require('./Promise');
var path = require('path');
var yaml = require('js-yaml');
var objectAssign = require('object-assign');
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objectAssign was not being used.

var glob = Promise.promisify(require('glob'));
var fs = Promise.promisifyAll(require('fs'));
var glob = require('glob-promise');
var fs = require('fs').promises;
var logger = require('./logger');

var Reader = module.exports = function (options) {
Expand All @@ -28,7 +27,7 @@ Reader.prototype.readFile = Promise.method(function(filename) {
if (!PARSERS[ext]) {
throw new Error('unknown file type: ', ext);
}
return fs.readFileAsync(filename, this.options.encoding).then(function(data) {
return fs.readFile(filename, this.options.encoding).then(function(data) {
var fixtures = PARSERS[ext](data);
if (fixtures.fixtures) fixtures = fixtures.fixtures;
return fixtures;
Expand Down
Loading