Skip to content

Commit

Permalink
Remove semver devDep; use at-least-node in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanZim committed Feb 13, 2020
1 parent cdef03d commit c4a25ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/fs/__tests__/multi-param.test.js
Expand Up @@ -4,13 +4,13 @@ const assert = require('assert')
const path = require('path')
const crypto = require('crypto')
const os = require('os')
const semver = require('semver')
const atLeastNode = require('at-least-node')
const fs = require('../..')

const SIZE = 1000

// Used for tests on Node 12.9.0+ only
const describeNode12 = semver.gte(process.version, '12.9.0') ? describe : describe.skip
const describeNode12 = atLeastNode('12.9.0') ? describe : describe.skip

describe('fs.read()', () => {
let TEST_FILE
Expand Down
8 changes: 3 additions & 5 deletions lib/util/__tests__/stat.test.js
Expand Up @@ -4,7 +4,7 @@ const fs = require(process.cwd())
const os = require('os')
const path = require('path')
const assert = require('assert')
const semver = require('semver')
const atLeastNode = require('at-least-node')
const stat = require('../stat.js')

const NODE_VERSION_WITH_BIGINT = '10.5.0'
Expand All @@ -23,15 +23,14 @@ describe('util/stat', () => {

describe('should use stats with bigint type for node versions >= 10.5.0 and number type for older versions', () => {
it('stat.checkPaths()', () => {
const nodeVersion = process.versions.node
const src = path.join(TEST_DIR, 'src')
const dest = path.join(TEST_DIR, 'dest')
fs.ensureFileSync(src)
fs.ensureFileSync(dest)
stat.checkPaths(src, dest, 'copy', (err, stats) => {
assert.ifError(err)
const { srcStat } = stats
if (semver.gte(nodeVersion, NODE_VERSION_WITH_BIGINT)) {
if (atLeastNode(NODE_VERSION_WITH_BIGINT)) {
assert.strictEqual(typeof srcStat.ino, 'bigint')
} else {
assert.strictEqual(typeof srcStat.ino, 'number')
Expand All @@ -40,13 +39,12 @@ describe('util/stat', () => {
})

it('stat.checkPathsSync()', () => {
const nodeVersion = process.versions.node
const src = path.join(TEST_DIR, 'src')
const dest = path.join(TEST_DIR, 'dest')
fs.ensureFileSync(src)
fs.ensureFileSync(dest)
const { srcStat } = stat.checkPathsSync(src, dest, 'copy')
if (semver.gte(nodeVersion, NODE_VERSION_WITH_BIGINT)) {
if (atLeastNode(NODE_VERSION_WITH_BIGINT)) {
assert.strictEqual(typeof srcStat.ino, 'bigint')
} else {
assert.strictEqual(typeof srcStat.ino, 'number')
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -51,7 +51,6 @@
"nyc": "^15.0.0",
"proxyquire": "^2.0.1",
"read-dir-files": "^0.1.1",
"semver": "^5.3.0",
"standard": "^14.1.0"
},
"main": "./lib/index.js",
Expand Down

0 comments on commit c4a25ed

Please sign in to comment.