Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e16f68d

Browse filesBrowse files
committed
test(ci): add failing cache config test
1 parent f2d770a commit e16f68d
Copy full SHA for e16f68d

File tree

Expand file treeCollapse file tree

1 file changed

+31
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+31
-2
lines changed

‎test/tap/ci.js

Copy file name to clipboardExpand all lines: test/tap/ci.js
+31-2Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const test = require('tap').test
1212

1313
const Dir = Tacks.Dir
1414
const File = Tacks.File
15+
const cacheDir = common.cache
1516
const testDir = common.pkg
1617

1718
const EXEC_OPTS = { cwd: testDir }
@@ -47,7 +48,7 @@ test('setup', () => {
4748
const fixture = new Tacks(Dir({
4849
'package.json': File(PKG)
4950
}))
50-
return rimraf(testDir).then(() => {
51+
return Promise.all([rimraf(cacheDir), rimraf(testDir)]).then(() => {
5152
fixture.create(testDir)
5253
return mr({port: common.port})
5354
})
@@ -306,7 +307,35 @@ test('errors if package-lock.json invalid', (t) => {
306307
)
307308
})
308309

310+
test('correct cache location when using cache config', (t) => {
311+
const fixture = new Tacks(Dir({
312+
'package.json': File(PKG),
313+
'package-lock.json': File(RAW_LOCKFILE)
314+
}))
315+
return Promise.all([rimraf(cacheDir), rimraf(testDir)])
316+
.then(() => fixture.create(cacheDir))
317+
.then(() => fixture.create(testDir))
318+
.then(() => common.npm([
319+
'ci',
320+
`--cache=${cacheDir}`,
321+
'--foo=asdf',
322+
'--registry', common.registry,
323+
'--loglevel', 'warn'
324+
], EXEC_OPTS))
325+
.then((ret) => {
326+
const code = ret[0]
327+
const stderr = ret[2]
328+
t.equal(code, 0, 'command completed without error')
329+
t.equal(stderr.trim(), '', 'no output on stderr')
330+
return fs.readdirAsync(path.join(cacheDir, '_cacache'))
331+
})
332+
.then((modules) => {
333+
t.ok(modules, 'should create _cacache folder')
334+
t.end()
335+
})
336+
})
337+
309338
test('cleanup', () => {
310339
SERVER.close()
311-
return rimraf(testDir)
340+
return Promise.all([rimraf(cacheDir), rimraf(testDir)])
312341
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.