Skip to content

Commit

Permalink
Update arc version unit tests to use mock-tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanblock committed Dec 5, 2023
1 parent f532363 commit 6d249b6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/unit/src/config/arc-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let { join } = require('path')
let mockFs = require('mock-fs')
let mockTmp = require('mock-tmp')
let test = require('tape')
let sut = join(process.cwd(), 'src', 'config', 'arc')
let getArcConfig = require(sut)
Expand All @@ -11,12 +11,11 @@ test('Set up env', t => {

test('Set Arc version (if possible)', t => {
t.plan(1)
let cwd = process.cwd()
let path = join(cwd, 'node_modules', '@architect', 'architect', 'package.json')
let path = join('node_modules', '@architect', 'architect', 'package.json')
let version = 'lol'
let json = JSON.stringify({ version })
mockFs({ [path]: json })
let cwd = mockTmp({ [path]: json })
let arc = getArcConfig({ cwd, inventory: { _arc: {} } })
t.equal(arc.version, version, 'Got back installed arc version')
mockFs.restore()
mockTmp.reset()
})

0 comments on commit 6d249b6

Please sign in to comment.