mirror of
https://github.com/zhigang1992/yarn.git
synced 2026-06-11 08:49:57 +08:00
**Summary** Fixes: #3788. This PR loads `devDependencies` from the manifest, re-builds the patterns package structure, and filters packages if the `NODE_ENV` is production. **Test plan** Added new tests.
28 lines
798 B
JavaScript
28 lines
798 B
JavaScript
/* @flow */
|
|
|
|
import {getPathKey, isProduction} from '../src/constants.js';
|
|
|
|
test('getPathKey', () => {
|
|
expect(getPathKey('win32', {PATH: 'foobar'})).toBe('PATH');
|
|
expect(getPathKey('win32', {Path: 'foobar'})).toBe('Path');
|
|
expect(getPathKey('win32', {PaTh: 'foobar'})).toBe('PaTh');
|
|
expect(getPathKey('win32', {})).toBe('Path');
|
|
expect(getPathKey('linux', {})).toBe('PATH');
|
|
expect(getPathKey('darwin', {})).toBe('PATH');
|
|
});
|
|
|
|
describe('isProduction', () => {
|
|
const env = {
|
|
NODE_ENV: '',
|
|
};
|
|
test('passing "development" should return false', () => {
|
|
env.NODE_ENV = 'development';
|
|
expect(isProduction(env)).toBe(false);
|
|
});
|
|
|
|
test('passing "production" should return true', () => {
|
|
env.NODE_ENV = 'production';
|
|
expect(isProduction(env)).toBe(true);
|
|
});
|
|
});
|