mirror of
https://github.com/jprichardson/node-fs-extra.git
synced 2026-01-18 16:13:55 +00:00
* Remove process.cwd() trick from test files * BREAKING: Switch from main to exports * Add fs-extra/esm ESM named import module, with just fs-extra methods Fixes #746
29 lines
678 B
JavaScript
29 lines
678 B
JavaScript
'use strict'
|
|
/* eslint-env mocha */
|
|
|
|
const fs = require('../..')
|
|
const path = require('path')
|
|
const os = require('os')
|
|
const assert = require('assert')
|
|
|
|
describe('pathExists()', () => {
|
|
let TEST_DIR
|
|
|
|
beforeEach(done => {
|
|
TEST_DIR = path.join(os.tmpdir(), 'fs-extra', 'path-exists')
|
|
fs.emptyDir(TEST_DIR, done)
|
|
})
|
|
|
|
afterEach(done => fs.remove(TEST_DIR, done))
|
|
|
|
it('should return false if file does not exist', () => {
|
|
assert(!fs.pathExistsSync(path.join(TEST_DIR, 'somefile')))
|
|
})
|
|
|
|
it('should return true if file does exist', () => {
|
|
const file = path.join(TEST_DIR, 'exists')
|
|
fs.ensureFileSync(file)
|
|
assert(fs.pathExistsSync(file))
|
|
})
|
|
})
|