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

test: use tmp directory instead of fixtures #2587

Closed
Closed
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
Empty file removed test/fixtures/readdir/are
Empty file.
Empty file removed test/fixtures/readdir/dir/empty
Empty file.
Empty file removed test/fixtures/readdir/empty
Empty file.
Empty file removed test/fixtures/readdir/files
Empty file.
Empty file removed test/fixtures/readdir/for
Empty file.
Empty file removed test/fixtures/readdir/just
Empty file.
Empty file removed test/fixtures/readdir/testing.js
Empty file.
Empty file removed test/fixtures/readdir/these
Empty file.
36 changes: 36 additions & 0 deletions test/parallel/test-fs-readdir.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';

const common = require('../common');
const assert = require('assert');
const path = require('path');
const fs = require('fs');

const readdirDir = common.tmpDir;
const files = ['empty', 'files', 'for', 'just', 'testing'];

// Make sure tmp directory is clean
common.refreshTmpDir();

// Create the necessary files
files.forEach(function(currentFile) {
fs.closeSync(fs.openSync(readdirDir + '/' + currentFile, 'w'));
});

// Check the readdir Sync version
assert.deepEqual(files, fs.readdirSync(readdirDir).sort());

// Check the readdir async version
fs.readdir(readdirDir, common.mustCall(function(err, f) {
assert.ifError(err);
assert.deepEqual(files, f.sort());
}));

// readdir() on file should throw ENOTDIR
// https://github.com/joyent/node/issues/1869
assert.throws(function() {
fs.readdirSync(__filename);
}, /Error: ENOTDIR: not a directory/);

fs.readdir(__filename, common.mustCall(function(e) {
assert.equal(e.code, 'ENOTDIR');
}));
71 changes: 0 additions & 71 deletions test/sequential/test-readdir.js

This file was deleted.