-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
88 additions
and
9 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
!__tests__/packages/**/node_modules | ||
.DS_Store | ||
.idea/ |
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,22 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Running the programmatic interface return expected duplicates in json 1`] = ` | ||
Object { | ||
"npmPackages": Object { | ||
"b": Object { | ||
"duplicates": Array [ | ||
"1.0.2", | ||
], | ||
"installed": "1.0.0", | ||
"wanted": "1.0.0", | ||
}, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`Running the programmatic interface return expected duplicates in yaml 1`] = ` | ||
" | ||
npmPackages: | ||
b: 1.0.0 => 1.0.0 (1.0.2) | ||
" | ||
`; |
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,26 @@ | ||
const envinfo = require('../src/envinfo'); | ||
const path = require('path'); | ||
|
||
describe('Running the programmatic interface', () => { | ||
test('return expected duplicates in json', async () => { | ||
const cwd = process.cwd(); | ||
process.chdir(path.join(__dirname, 'packages/test-duplicates')); | ||
try { | ||
const data = await envinfo.run({ npmPackages: ['b'] }, { duplicates: true, json: true }); | ||
expect(JSON.parse(data)).toMatchSnapshot(); | ||
} finally { | ||
process.chdir(cwd); | ||
} | ||
}); | ||
|
||
test('return expected duplicates in yaml', async () => { | ||
const cwd = process.cwd(); | ||
process.chdir(path.join(__dirname, 'packages/test-duplicates')); | ||
try { | ||
const data = await envinfo.run({ npmPackages: ['b'] }, { duplicates: true }); | ||
expect(data).toMatchSnapshot(); | ||
} finally { | ||
process.chdir(cwd); | ||
} | ||
}); | ||
}); |
4 changes: 4 additions & 0 deletions
4
__tests__/packages/test-duplicates/node_modules/a/node_modules/b/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
__tests__/packages/test-duplicates/node_modules/a/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
__tests__/packages/test-duplicates/node_modules/b/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,8 @@ | ||
{ | ||
"name": "test-duplicates", | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"a": "1.0.0", | ||
"b": "1.0.0" | ||
} | ||
} |
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