-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: add more tests for no-relative-import * test: add tests for getPackages()
- Loading branch information
Showing
10 changed files
with
101 additions
and
18 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
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,27 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`getPackages() lerna matches snapshot 1`] = ` | ||
Array [ | ||
Object { | ||
"fsPath": "<cwd>/test/fixture/lerna/packages/bar", | ||
"name": "bar", | ||
}, | ||
Object { | ||
"fsPath": "<cwd>/test/fixture/lerna/packages/foo", | ||
"name": "foo", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`getPackages() yarn matches snapshot 1`] = ` | ||
Array [ | ||
Object { | ||
"fsPath": "<cwd>/test/fixture/yarn/packages/bar", | ||
"name": "bar", | ||
}, | ||
Object { | ||
"fsPath": "<cwd>/test/fixture/yarn/packages/foo", | ||
"name": "foo", | ||
}, | ||
] | ||
`; |
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,3 @@ | ||
{ | ||
"packages": ["packages/*"] | ||
} |
Empty file.
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,3 @@ | ||
{ | ||
"name": "bar" | ||
} |
Empty file.
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,3 @@ | ||
{ | ||
"name": "foo" | ||
} |
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,23 @@ | ||
import getPackages from '../src/get-packages'; | ||
import path from 'path'; | ||
|
||
const LERNA_DIR = path.join(__dirname, 'fixture/lerna'); | ||
const YARN_DIR = path.join(__dirname, 'fixture/yarn'); | ||
|
||
expect.addSnapshotSerializer({ | ||
test: value => | ||
typeof value === 'string' && | ||
(value.indexOf('\\') > -1 || value.indexOf(process.cwd()) > -1), | ||
print: (value, serializer) => | ||
serializer(value.replace(process.cwd(), '<cwd>').replace(/\\/g, '/')), | ||
}); | ||
|
||
describe('getPackages()', () => { | ||
test('lerna matches snapshot', () => { | ||
expect(getPackages(LERNA_DIR)).toMatchSnapshot(); | ||
}); | ||
|
||
test('yarn matches snapshot', () => { | ||
expect(getPackages(YARN_DIR)).toMatchSnapshot(); | ||
}); | ||
}); |
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
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