mirror of
https://github.com/expo/react-native-community-cli.git
synced 2026-11-15 17:39:13 -10:00
* chore: make `cleanup` async Using `rimraf.sync` can cause `ENOTEMPTY` and `EBUSY` errors on Windows. This can make the Windows CI to fail randomly. Changing to the async method defaults to autoretry 3 times and thus avoiding this issues. * chore: jest config * chore: e2e tests use sync cleanup * chore: pr feedback * chore: revert timeout * Update __e2e__/default.test.ts * Update __e2e__/default.test.ts Co-authored-by: Michał Pierzchała <[email protected]>
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import path from 'path';
|
||
import {
|
||
runCLI,
|
||
getTempDirectory,
|
||
cleanupSync,
|
||
writeFiles,
|
||
} from '../jest/helpers';
|
||
|
||
const DIR = getTempDirectory('command-install-test');
|
||
const pkg = 'react-native-config';
|
||
|
||
beforeEach(() => {
|
||
cleanupSync(DIR);
|
||
writeFiles(DIR, {
|
||
'node_modules/react-native/package.json': '{}',
|
||
'package.json': '{}',
|
||
});
|
||
});
|
||
afterEach(() => cleanupSync(DIR));
|
||
|
||
test.each(['yarn', 'npm'])('install module with %s', pm => {
|
||
if (pm === 'yarn') {
|
||
writeFiles(DIR, {'yarn.lock': ''});
|
||
}
|
||
const {stdout, code} = runCLI(DIR, ['install', pkg]);
|
||
|
||
expect(stdout).toContain(`Installing "${pkg}"`);
|
||
expect(stdout).toContain(`Linking "${pkg}"`);
|
||
// TODO – this behavior is a bug, linking should fail/warn without native deps
|
||
// to link. Not a high priority since we're changing how link works
|
||
expect(stdout).toContain(`Successfully installed and linked "${pkg}"`);
|
||
expect(require(path.join(DIR, 'package.json'))).toMatchObject({
|
||
dependencies: {
|
||
[pkg]: expect.any(String),
|
||
},
|
||
});
|
||
expect(code).toBe(0);
|
||
});
|