-
Notifications
You must be signed in to change notification settings - Fork 23
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
15 changed files
with
87 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
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
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,9 @@ | ||
/* eslint-env jest */ | ||
|
||
module.exports = jest.fn((p, options, cb) => { | ||
if (typeof options === 'function') { | ||
options(); | ||
} else { | ||
cb(); | ||
} | ||
}); |
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,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`CLEAN command executes the correct rimraf calls 1`] = ` | ||
Array [ | ||
"test/fixtures/packages/oao/node_modules", | ||
"test/fixtures/packages/oao-b/node_modules", | ||
"test/fixtures/packages/oao-c/node_modules", | ||
"test/fixtures/packages/oao-d/node_modules", | ||
"test/fixtures/packages/oao-priv/node_modules", | ||
"node_modules", | ||
] | ||
`; |
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
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,15 @@ | ||
/* eslint-env jest */ | ||
/* eslint-disable global-require, import/no-dynamic-require */ | ||
|
||
import clean from '../clean'; | ||
|
||
jest.mock('rimraf'); | ||
|
||
describe('CLEAN command', () => { | ||
it('executes the correct rimraf calls', async () => { | ||
const rimraf = require('rimraf'); | ||
await clean({ src: 'test/fixtures/packages/*' }); | ||
const paths = rimraf.mock.calls.map(call => call[0].replace(/\\/g, '/')); | ||
expect(paths).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
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,31 @@ | ||
// @flow | ||
|
||
import path from 'path'; | ||
import rimraf from 'rimraf'; | ||
import { mainStory, chalk } from 'storyboard'; | ||
import { readAllSpecs } from './utils/readSpecs'; | ||
|
||
type Options = { src: string }; | ||
|
||
const run = async ({ src: srcPatterns }: Options) => { | ||
const allSpecs = await readAllSpecs(srcPatterns); | ||
const pkgNames = Object.keys(allSpecs); | ||
await Promise.all( | ||
pkgNames.map( | ||
pkgName => new Promise((resolve, reject) => { | ||
const { pkgPath } = allSpecs[pkgName]; | ||
const nodeModulesPath = path.join(pkgPath, 'node_modules'); | ||
mainStory.info(`Removing ${chalk.cyan.bold(nodeModulesPath)}...`); | ||
rimraf(nodeModulesPath, err => { | ||
if (err) { | ||
reject(err); | ||
return; | ||
} | ||
resolve(); | ||
}); | ||
}) | ||
) | ||
); | ||
}; | ||
|
||
export default run; |
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