Files
pnpm/catalogs/config/test/getCatalogsFromWorkspaceManifest.test.ts
Brandon Cheng 9c63679df1 feat: catalogs (#8122)
* feat: create new @pnpm/catalogs.types package (#8026)

* feat: read catalog configs from workspace manifest (#8123)

* refactor: move InvalidWorkspaceManifestError to its own file

* feat: read catalogs config from workspace manifest

* chore: add changeset for new catalog config parsing

* feat: create new `@pnpm/catalogs.protocol-parser` package (#8124)

This works around a problem with pnpm's CI setup not compiling
packages that are not dependencies of the main pnpm package before
running these tests.

https://github.com/pnpm/pnpm/pull/8027#issuecomment-2081650304

* refactor: factor out isWantedDepPrefSame to extend in a future commit (#8125)

* feat: create new `@pnpm/catalogs.config` package (#8220)

* refactor: remove single default catalog check

This check will happen in  `@pnpm/catalogs.config` instead.

* feat: create new @pnpm/catalogs.config package

* fix: work around CI setup not compiling orphan packages before testing

This works around a problem with pnpm's CI setup not compiling
packages that are not dependencies of the main pnpm package before
running these tests.

https://github.com/pnpm/pnpm/pull/8027#issuecomment-2081650304

* feat: create new `@pnpm/catalogs.resolver` package (#8219)

* feat: create new @pnpm/catalogs.resolver package

* fix: work around CI setup not compiling orphan packages before testing

This works around a problem with pnpm's CI setup not compiling
packages that are not dependencies of the main pnpm package before
running these tests.

https://github.com/pnpm/pnpm/pull/8027#issuecomment-2081650304

* feat: implement catalog protocol for publish (#8225)

* feat: implement catalog protocol for install (#8221)

* feat: add catalogs to @pnpm/config

* refactor: factor out resolveDependenciesOfImporterDependency function

* feat: implement catalog resolver and replace prefs

* revert: work around CI setup not compiling orphan packages before testing

* feat: record catalog lookup snapshots through propagated metadata

* feat: update projects when catalogs config changes

* test: add catalog protocol install tests

* refactor: remove filter-packages-from-dir dependency from core tests (#8244)

* refactor: remove filter-packages-from-dir dependency from core tests

* test: refactor

* test: refactor

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
2024-06-27 14:19:38 +02:00

55 lines
1.0 KiB
TypeScript

import { getCatalogsFromWorkspaceManifest } from '@pnpm/catalogs.config'
test('combines implicit default and named catalogs', () => {
expect(getCatalogsFromWorkspaceManifest({
catalog: {
foo: '^1.0.0',
},
catalogs: {
bar: {
baz: '^2.0.0',
},
},
})).toEqual({
default: {
foo: '^1.0.0',
},
bar: {
baz: '^2.0.0',
},
})
})
test('combines explicit default and named catalogs', () => {
expect(getCatalogsFromWorkspaceManifest({
catalogs: {
default: {
foo: '^1.0.0',
},
bar: {
baz: '^2.0.0',
},
},
})).toEqual({
default: {
foo: '^1.0.0',
},
bar: {
baz: '^2.0.0',
},
})
})
test('throws if default catalog is defined multiple times', () => {
expect(() => getCatalogsFromWorkspaceManifest({
catalog: {
bar: '^2.0.0',
},
catalogs: {
default: {
foo: '^1.0.0',
},
},
})).toThrow(/The 'default' catalog was defined multiple times/)
})