mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-09 21:07:46 +00:00
[tests] Migrate from yarn to pnpm (#9198)
<picture data-single-emoji=":pnpm:" title=":pnpm:"><img class="emoji" src="https://single-emoji.vercel.app/api/emoji/eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..4mJzrO94AnSn0Pue.4apgaKtTUdQ-wxNyahjdJj28u8bbXreLoTA8AGqYjLta3MrsFvbo9DsQFth4CoIkBgXFhQ5_BVcKNfYbwLg4bKzyIvItKe4OFS8AzG7Kkicz2kUUZk0.nXyK_PvHzZFGA-MQB6XHfA" alt=":pnpm:" width="20" height="auto" align="absmiddle"></picture> yarn has become increasingly more difficult to use as the v1 we rely on no longer receives updates. pnpm is faster and is actively maintained. This PR migrates us to pnpm.
This commit is contained in:
3
packages/build-utils/test/fixtures/15-npm-8-legacy-peer-deps/package-lock.json
generated
vendored
3
packages/build-utils/test/fixtures/15-npm-8-legacy-peer-deps/package-lock.json
generated
vendored
@@ -7,6 +7,9 @@
|
||||
"dependencies": {
|
||||
"react": "16.8.0",
|
||||
"swr": "1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "16.x"
|
||||
}
|
||||
},
|
||||
"node_modules/js-tokens": {
|
||||
|
||||
34
packages/build-utils/test/unit.test.ts
vendored
34
packages/build-utils/test/unit.test.ts
vendored
@@ -444,21 +444,21 @@ it('should support initialHeaders and initialStatus correctly', async () => {
|
||||
});
|
||||
|
||||
it('should support require by path for legacy builders', () => {
|
||||
const index = require('@vercel/build-utils');
|
||||
const index = require('../');
|
||||
|
||||
const download2 = require('@vercel/build-utils/fs/download.js');
|
||||
const getWriteableDirectory2 = require('@vercel/build-utils/fs/get-writable-directory.js');
|
||||
const glob2 = require('@vercel/build-utils/fs/glob.js');
|
||||
const rename2 = require('@vercel/build-utils/fs/rename.js');
|
||||
const download2 = require('../fs/download.js');
|
||||
const getWriteableDirectory2 = require('../fs/get-writable-directory.js');
|
||||
const glob2 = require('../fs/glob.js');
|
||||
const rename2 = require('../fs/rename.js');
|
||||
const {
|
||||
runNpmInstall: runNpmInstall2,
|
||||
} = require('@vercel/build-utils/fs/run-user-scripts.js');
|
||||
const streamToBuffer2 = require('@vercel/build-utils/fs/stream-to-buffer.js');
|
||||
} = require('../fs/run-user-scripts.js');
|
||||
const streamToBuffer2 = require('../fs/stream-to-buffer.js');
|
||||
|
||||
const FileBlob2 = require('@vercel/build-utils/file-blob.js');
|
||||
const FileFsRef2 = require('@vercel/build-utils/file-fs-ref.js');
|
||||
const FileRef2 = require('@vercel/build-utils/file-ref.js');
|
||||
const { Lambda: Lambda2 } = require('@vercel/build-utils/lambda.js');
|
||||
const FileBlob2 = require('../file-blob.js');
|
||||
const FileFsRef2 = require('../file-fs-ref.js');
|
||||
const FileRef2 = require('../file-ref.js');
|
||||
const { Lambda: Lambda2 } = require('../lambda.js');
|
||||
|
||||
expect(download2).toBe(index.download);
|
||||
expect(getWriteableDirectory2).toBe(index.getWriteableDirectory);
|
||||
@@ -560,9 +560,9 @@ it('should detect package.json in nested backend', async () => {
|
||||
'../../node/test/fixtures/18.1-nested-packagejson/backend'
|
||||
);
|
||||
const result = await scanParentDirs(fixture);
|
||||
expect(result.cliType).toEqual('yarn');
|
||||
expect(result.lockfileVersion).toEqual(undefined);
|
||||
// There is no lockfile but this test will pick up vercel/vercel/yarn.lock
|
||||
expect(result.cliType).toEqual('pnpm');
|
||||
// There is no lockfile but this test will pick up vercel/vercel/pnpm-lock.yaml
|
||||
expect(result.lockfileVersion).toEqual(5.4);
|
||||
expect(result.packageJsonPath).toEqual(path.join(fixture, 'package.json'));
|
||||
});
|
||||
|
||||
@@ -572,9 +572,9 @@ it('should detect package.json in nested frontend', async () => {
|
||||
'../../node/test/fixtures/18.1-nested-packagejson/frontend'
|
||||
);
|
||||
const result = await scanParentDirs(fixture);
|
||||
expect(result.cliType).toEqual('yarn');
|
||||
expect(result.lockfileVersion).toEqual(undefined);
|
||||
// There is no lockfile but this test will pick up vercel/vercel/yarn.lock
|
||||
expect(result.cliType).toEqual('pnpm');
|
||||
// There is no lockfile but this test will pick up vercel/vercel/pnpm-lock.yaml
|
||||
expect(result.lockfileVersion).toEqual(5.4);
|
||||
expect(result.packageJsonPath).toEqual(path.join(fixture, 'package.json'));
|
||||
});
|
||||
|
||||
|
||||
14
packages/build-utils/test/unit.walk.test.ts
vendored
14
packages/build-utils/test/unit.walk.test.ts
vendored
@@ -2,7 +2,7 @@ import { walkParentDirs } from '../src';
|
||||
import { strict } from 'assert';
|
||||
import { join } from 'path';
|
||||
import { promises } from 'fs';
|
||||
const { deepEqual, notDeepEqual, fail } = strict;
|
||||
const { notDeepEqual, fail } = strict;
|
||||
const { readFile } = promises;
|
||||
const fixture = (name: string) => join(__dirname, 'walk', name);
|
||||
const filename = 'file.txt';
|
||||
@@ -10,7 +10,7 @@ const filename = 'file.txt';
|
||||
async function assertContent(target: string | null, contents: string) {
|
||||
notDeepEqual(target, null);
|
||||
const actual = await readFile(target!, 'utf8');
|
||||
deepEqual(actual.trim(), contents.trim());
|
||||
strict.deepEqual(actual.trim(), contents.trim());
|
||||
}
|
||||
|
||||
describe('Test `walkParentDirs`', () => {
|
||||
@@ -21,7 +21,7 @@ describe('Test `walkParentDirs`', () => {
|
||||
await walkParentDirs({ base, start, filename });
|
||||
fail('Expected error');
|
||||
} catch (error) {
|
||||
deepEqual(
|
||||
strict.deepEqual(
|
||||
(error as Error).message,
|
||||
'Expected "base" to be absolute path'
|
||||
);
|
||||
@@ -35,7 +35,7 @@ describe('Test `walkParentDirs`', () => {
|
||||
await walkParentDirs({ base, start, filename });
|
||||
fail('Expected error');
|
||||
} catch (error) {
|
||||
deepEqual(
|
||||
strict.deepEqual(
|
||||
(error as Error).message,
|
||||
'Expected "start" to be absolute path'
|
||||
);
|
||||
@@ -67,21 +67,21 @@ describe('Test `walkParentDirs`', () => {
|
||||
const base = fixture('not-found');
|
||||
const start = base;
|
||||
const target = await walkParentDirs({ base, start, filename });
|
||||
deepEqual(target, null);
|
||||
strict.deepEqual(target, null);
|
||||
});
|
||||
|
||||
it('should not find nested two', async () => {
|
||||
const base = fixture('not-found');
|
||||
const start = join(base, 'two');
|
||||
const target = await walkParentDirs({ base, start, filename });
|
||||
deepEqual(target, null);
|
||||
strict.deepEqual(target, null);
|
||||
});
|
||||
|
||||
it('should not find nested three', async () => {
|
||||
const base = fixture('not-found');
|
||||
const start = join(base, 'two', 'three');
|
||||
const target = await walkParentDirs({ base, start, filename });
|
||||
deepEqual(target, null);
|
||||
strict.deepEqual(target, null);
|
||||
});
|
||||
|
||||
it('should find only one', async () => {
|
||||
|
||||
Reference in New Issue
Block a user