-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove mocks from completion tests
- Loading branch information
Showing
3 changed files
with
48 additions
and
12 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 |
---|---|---|
|
@@ -5,9 +5,38 @@ | |
* Make sure to inspect the output below. Do not ignore changes! | ||
*/ | ||
'use strict' | ||
exports[`test/lib/commands/audit.js TAP audit fix > lockfile has [email protected] 1`] = ` | ||
{ | ||
"name": "test-dep", | ||
"version": "1.0.0", | ||
"lockfileVersion": 2, | ||
"requires": true, | ||
"packages": { | ||
"": { | ||
"name": "test-dep", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"test-dep-a": "*" | ||
} | ||
}, | ||
"node_modules/test-dep-a": { | ||
"version": "1.0.1", | ||
"resolved": "https://registry.npmjs.org/test-dep-a/-/test-dep-a-1.0.1.tgz" | ||
} | ||
}, | ||
"dependencies": { | ||
"test-dep-a": { | ||
"version": "1.0.1", | ||
"resolved": "https://registry.npmjs.org/test-dep-a/-/test-dep-a-1.0.1.tgz" | ||
} | ||
} | ||
} | ||
` | ||
|
||
exports[`test/lib/commands/audit.js TAP audit fix > must match snapshot 1`] = ` | ||
added 1 package, and audited 2 packages in 120ms | ||
added 1 package, and audited 2 packages in xxx | ||
found 0 vulnerabilities | ||
` | ||
|
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 |
---|---|---|
|
@@ -6,6 +6,9 @@ const util = require('util') | |
const zlib = require('zlib') | ||
const gzip = util.promisify(zlib.gzip) | ||
const path = require('path') | ||
const fs = require('fs') | ||
|
||
t.cleanSnapshot = str => str.replace(/packages in [0-9]+[a-z]+/g, 'packages in xxx') | ||
|
||
const tree = { | ||
'package.json': JSON.stringify({ | ||
|
@@ -114,7 +117,6 @@ t.test('audit fix', async t => { | |
tap: t, | ||
registry: npm.config.get('registry'), | ||
}) | ||
// with fix | ||
const manifest = registry.manifest({ | ||
name: 'test-dep-a', | ||
packuments: [{ version: '1.0.0' }, { version: '1.0.1' }], | ||
|
@@ -139,6 +141,12 @@ t.test('audit fix', async t => { | |
}) | ||
await npm.exec('audit', ['fix']) | ||
t.matchSnapshot(joinedOutput()) | ||
const pkg = fs.readFileSync(path.join(npm.prefix, 'package-lock.json'), 'utf8') | ||
t.matchSnapshot(pkg, 'lockfile has [email protected]') | ||
t.ok( | ||
fs.existsSync(path.join(npm.prefix, 'node_modules', 'test-dep-a', 'fixed.txt')), | ||
'has [email protected] on disk' | ||
) | ||
}) | ||
|
||
t.test('completion', async t => { | ||
|
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