This repository has been archived by the owner on Jul 3, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add baseline git manifest test
- Loading branch information
Showing
3 changed files
with
106 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ install: | |
- npm install | ||
|
||
test_script: | ||
- git config --global user.email "[email protected]" | ||
- git config --global user.name "AppVeyor Test User" | ||
- npm test | ||
|
||
matrix: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use strict' | ||
|
||
const BB = require('bluebird') | ||
|
||
const gitMock = require('./util/git.js') | ||
const npmlog = require('npmlog') | ||
const path = require('path') | ||
const Tacks = require('tacks') | ||
const test = require('tap').test | ||
const testDir = require('./util/test-dir.js')(__filename) | ||
|
||
const Dir = Tacks.Dir | ||
const File = Tacks.File | ||
|
||
const manifest = require('../manifest') | ||
|
||
const OPTS = { | ||
cache: path.join(testDir, 'cache'), | ||
registry: 'https://mock.reg', | ||
log: npmlog, | ||
retry: { | ||
retries: 1, | ||
factor: 1, | ||
minTimeout: 1, | ||
maxTimeout: 10 | ||
} | ||
} | ||
|
||
test('get manifest from package.json in git clone', t => { | ||
const fixture = new Tacks(Dir({ | ||
'foo': Dir({ | ||
'package.json': File({ | ||
name: 'foo', | ||
version: '1.2.3' | ||
}), | ||
'index.js': File('hello') | ||
}) | ||
})) | ||
fixture.create(testDir) | ||
return BB.using(gitMock({cwd: path.join(testDir, 'foo')}), srv => { | ||
return manifest(`bar@git://127.0.0.1:${srv.port}/`, OPTS) | ||
.then(mani => { | ||
t.similar(mani, { | ||
name: 'foo', | ||
version: '1.2.3', | ||
_resolved: new RegExp(`git://127.0.0.1:${srv.port}/#[a-f0-9]{40}$`), | ||
_shasum: null, | ||
_shrinkwrap: null, | ||
_id: '[email protected]' | ||
}, 'manifest fetched correctly') | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters