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

getDir: test indicates file contents are buffer #56

Merged
merged 3 commits into from
Nov 25, 2019
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
os: [ windows-latest ]
node-version: [8.x, 10.x, 12.x]
node-version: [10.x, 12.x]
fail-fast: false

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest ]
node-version: [8.x, 10.x, 12.x]
node-version: [10.x, 12.x]
fail-fast: false

steps:
Expand Down
2 changes: 1 addition & 1 deletion readers/binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exports.load = (name) => {
}

exports.loadPromise = (name) => {
return new Promise(function (resolve, reject) {
return new Promise((resolve, reject) => {
fs.readFile(name, (err, content) => {
if (err) return reject(err);
resolve({ path: name, data: content });
Expand Down
2 changes: 1 addition & 1 deletion readers/flat.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exports.load = (name, type, options, regex) => {
return result;
}

exports.empty = function (options, type) {
exports.empty = (options, type) => {
switch (type) {
case 'flat':
case 'value':
Expand Down
14 changes: 8 additions & 6 deletions test/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

const assert = require('assert')
const fs = require('fs');
const path = require('path');
const fs = require('fs')
const os = require('os')
const path = require('path')

function cb () { return false; }
const opts = { booleans: ['arg1'] };
Expand Down Expand Up @@ -464,11 +465,12 @@ describe('getDir', function () {

it('loads all files in dir', function (done) {
this.config.getDir('dir', { type: 'binary' }, (err, files) => {
assert.ifError(err);
// console.log(files);
assert.equal(err, null);
assert.equal(files.length, 3);
assert.equal(files[0].data, 'contents1\n');
assert.equal(files[2].data, 'contents3\n');
assert.equal(files[0].data, `contents1${os.EOL}`);
assert.equal(files[2].data, `contents3${os.EOL}`);
done();
})
})
Expand Down Expand Up @@ -498,8 +500,8 @@ describe('getDir', function () {
// console.log(files);
assert.equal(err, null);
assert.equal(files.length, 3);
assert.equal(files[0].data, 'contents1\n');
assert.equal(files[2].data, 'contents3\n');
assert.equal(files[0].data, `contents1${os.EOL}`);
assert.equal(files[2].data, `contents3${os.EOL}`);
fs.writeFile(tmpFile, 'contents4\n', (err2, res) => {
assert.equal(err2, null);
// console.log('file touched, waiting for callback');
Expand Down