@teambit/ci 1.0.659 → 1.0.661
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
;
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.git_ci@1.0.
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.git_ci@1.0.661/dist/ci.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -7,6 +7,13 @@ function _chai() {
|
|
|
7
7
|
};
|
|
8
8
|
return data;
|
|
9
9
|
}
|
|
10
|
+
function _git() {
|
|
11
|
+
const data = require("../git");
|
|
12
|
+
_git = function () {
|
|
13
|
+
return data;
|
|
14
|
+
};
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
10
17
|
function _syncOrchestrator() {
|
|
11
18
|
const data = require("./sync-orchestrator");
|
|
12
19
|
_syncOrchestrator = function () {
|
|
@@ -89,10 +96,26 @@ describe('SyncOrchestrator target guards', () => {
|
|
|
89
96
|
debug() {}
|
|
90
97
|
}
|
|
91
98
|
};
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
// These queries precede the target guard. Keep this unit test independent of the
|
|
100
|
+
// checkout's size and Git latency, and restore the shared client even on failure.
|
|
101
|
+
const originalGit = {
|
|
102
|
+
status: _git().git.status,
|
|
103
|
+
remote: _git().git.remote
|
|
104
|
+
};
|
|
105
|
+
Object.assign(_git().git, {
|
|
106
|
+
status: async () => ({
|
|
107
|
+
files: []
|
|
108
|
+
}),
|
|
109
|
+
remote: async () => undefined
|
|
94
110
|
});
|
|
95
|
-
|
|
111
|
+
try {
|
|
112
|
+
const result = await new (_syncOrchestrator().SyncOrchestrator)(deps).sync({
|
|
113
|
+
branch: 'feature/foo'
|
|
114
|
+
});
|
|
115
|
+
(0, _chai().expect)(result).to.equal('branch feature/foo does not map to a valid lane name; nothing to do');
|
|
116
|
+
} finally {
|
|
117
|
+
Object.assign(_git().git, originalGit);
|
|
118
|
+
}
|
|
96
119
|
});
|
|
97
120
|
});
|
|
98
121
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chai","data","require","_syncOrchestrator","_syncConfig","orchestrator","SyncOrchestrator","conflicts","all","branch","lane","main","init","describe","it","options","expected","label","JSON","stringify","message","sync","catch","err","forEach","fragment","expect","to","contain","deps","config","workspace","defaultScope","ci","getDefaultBranchName","listGitHostProviders","lanes","getDefaultLaneId","name","logger","console","consoleWarning","debug","result","equal","assertCleanForDryRun","e","paths","Array","from","length","_","index","not","throw","cfg","resolveSyncConfig","branchToLaneName","map","b","syncableLaneNameForBranch","filter","Boolean","deep","prefixed","branchPrefix","undefined","overridden","branches"],"sources":["sync-orchestrator.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { SyncOrchestrator, assertCleanForDryRun } from './sync-orchestrator';\nimport { branchToLaneName, resolveSyncConfig, syncableLaneNameForBranch } from './sync-config';\n\n// The deps are never reached: every conflict case throws before the first `this.deps` access.\nfunction orchestrator(): SyncOrchestrator {\n return new SyncOrchestrator({} as any);\n}\n\n/** Each row must name every selector it refused, and which one would otherwise have silently won. */\nconst conflicts: Array<[Record<string, unknown>, string[]]> = [\n [{ all: true, branch: 'my-branch' }, ['--all cannot be combined with', '--branch (\"my-branch\")']],\n [{ all: true, lane: 'my-lane' }, ['--all cannot be combined with', 'a lane argument (\"my-lane\")']],\n [{ all: true, main: true }, ['--all cannot be combined with', '--main']],\n [\n { lane: 'my-lane', branch: 'my-branch' },\n [\n 'a lane argument (\"my-lane\") cannot be combined with --branch (\"my-branch\")',\n 'only --branch (\"my-branch\") would have run',\n ],\n ],\n [\n { lane: 'my-lane', main: true },\n ['a lane argument (\"my-lane\") cannot be combined with --main', 'only --main would have run'],\n ],\n [\n { branch: 'my-branch', main: true },\n ['--branch (\"my-branch\") cannot be combined with --main', 'only --main would have run'],\n ],\n [\n { lane: 'my-lane', branch: 'my-branch', main: true },\n [\n 'a lane argument (\"my-lane\") cannot be combined with --branch (\"my-branch\") or with --main',\n 'only --main would have run',\n ],\n ],\n // --init only scaffolds, so pairing it with a target could not mean anything.\n [{ init: true, branch: 'x' }, ['--init cannot be combined']],\n];\n\ndescribe('SyncOrchestrator target guards', () => {\n it('refuses every combination of selectors, naming the ones it saw', async () => {\n for (const [options, expected] of conflicts) {\n const label = JSON.stringify(options);\n let message = '';\n await orchestrator()\n .sync(options as any)\n .catch((err) => {\n message = err.message;\n });\n expected.forEach((fragment) => expect(message, label).to.contain(fragment));\n }\n });\n\n it('reports a branch whose mapped name is not a valid lane name, instead of syncing it', async () => {\n const deps = {\n config: { sync: {} },\n workspace: { defaultScope: 'org.scope' },\n ci: { getDefaultBranchName: async () => 'main', listGitHostProviders: () => [] },\n lanes: { getDefaultLaneId: () => ({ name: 'main' }) },\n logger: { console() {}, consoleWarning() {}, debug() {} },\n };\n const result = await new SyncOrchestrator(deps as any).sync({ branch: 'feature/foo' });\n expect(result).to.equal('branch feature/foo does not map to a valid lane name; nothing to do');\n });\n});\n\n// A dry run computes the main-scope plan by force-checking-out the sync branch, so a dirty tree would be\n// discarded by a run that promised to write nothing.\ndescribe('assertCleanForDryRun', () => {\n it('refuses a dirty tree, naming the paths at stake and how to keep them', () => {\n let message = '';\n try {\n assertCleanForDryRun(['comp1/index.js', 'notes.txt']);\n } catch (e: any) {\n message = e.message;\n }\n expect(message).to.contain('--dry-run refuses to run');\n expect(message).to.contain('2 uncommitted change(s)');\n expect(message).to.contain('comp1/index.js, notes.txt');\n expect(message).to.contain('Commit or stash them first');\n });\n\n it('caps the named paths so a large diff cannot produce an unreadable error', () => {\n const paths = Array.from({ length: 12 }, (_, index) => `file-${index}.js`);\n let message = '';\n try {\n assertCleanForDryRun(paths);\n } catch (e: any) {\n message = e.message;\n }\n expect(message).to.contain('12 uncommitted change(s)');\n expect(message).to.contain('file-9.js');\n expect(message).to.not.contain('file-10.js');\n expect(message).to.contain('…');\n });\n\n it('permits a clean tree: the write-then-restore is only acceptable when nothing can be lost', () => {\n expect(() => assertCleanForDryRun([])).to.not.throw();\n });\n});\n\ndescribe('branch -> lane enumeration filter', () => {\n it('queues only the branches whose mapped name could actually be a lane', () => {\n const cfg = resolveSyncConfig({});\n // non-vacuity: the default mapping really is the identity, so the filter is what excludes anything\n expect(branchToLaneName('feature/foo', cfg)).to.equal('feature/foo');\n expect(\n ['feature/foo', 'FEATURE', 'ok-lane'].map((b) => syncableLaneNameForBranch(b, cfg)).filter(Boolean)\n ).to.deep.equal(['ok-lane']);\n });\n\n it('honours the prefix (stripped before the name is checked) and an explicit branches override', () => {\n const prefixed = resolveSyncConfig({ branchPrefix: 'lane/' });\n expect(syncableLaneNameForBranch('lane/my-lane', prefixed)).to.equal('my-lane');\n expect(syncableLaneNameForBranch('feature/foo', prefixed)).to.equal(undefined);\n const overridden = resolveSyncConfig({ branches: { 'my-lane': 'custom/branch' } });\n expect(syncableLaneNameForBranch('custom/branch', overridden)).to.equal('my-lane');\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,kBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,iBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA,SAASI,YAAYA,CAAA,EAAqB;EACxC,OAAO,KAAIC,oCAAgB,EAAC,CAAC,CAAQ,CAAC;AACxC;;AAEA;AACA,MAAMC,SAAqD,GAAG,CAC5D,CAAC;EA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CAAC,CAAC,CAACxC,EAAE,CAACiB,KAAK,CAAC,SAAS,CAAC;EACpF,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chai","data","require","_git","_syncOrchestrator","_syncConfig","orchestrator","SyncOrchestrator","conflicts","all","branch","lane","main","init","describe","it","options","expected","label","JSON","stringify","message","sync","catch","err","forEach","fragment","expect","to","contain","deps","config","workspace","defaultScope","ci","getDefaultBranchName","listGitHostProviders","lanes","getDefaultLaneId","name","logger","console","consoleWarning","debug","originalGit","status","git","remote","Object","assign","files","undefined","result","equal","assertCleanForDryRun","e","paths","Array","from","length","_","index","not","throw","cfg","resolveSyncConfig","branchToLaneName","map","b","syncableLaneNameForBranch","filter","Boolean","deep","prefixed","branchPrefix","overridden","branches"],"sources":["sync-orchestrator.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport { git } from '../git';\nimport { SyncOrchestrator, assertCleanForDryRun } from './sync-orchestrator';\nimport { branchToLaneName, resolveSyncConfig, syncableLaneNameForBranch } from './sync-config';\n\n// The deps are never reached: every conflict case throws before the first `this.deps` access.\nfunction orchestrator(): SyncOrchestrator {\n return new SyncOrchestrator({} as any);\n}\n\n/** Each row must name every selector it refused, and which one would otherwise have silently won. */\nconst conflicts: Array<[Record<string, unknown>, string[]]> = [\n [{ all: true, branch: 'my-branch' }, ['--all cannot be combined with', '--branch (\"my-branch\")']],\n [{ all: true, lane: 'my-lane' }, ['--all cannot be combined with', 'a lane argument (\"my-lane\")']],\n [{ all: true, main: true }, ['--all cannot be combined with', '--main']],\n [\n { lane: 'my-lane', branch: 'my-branch' },\n [\n 'a lane argument (\"my-lane\") cannot be combined with --branch (\"my-branch\")',\n 'only --branch (\"my-branch\") would have run',\n ],\n ],\n [\n { lane: 'my-lane', main: true },\n ['a lane argument (\"my-lane\") cannot be combined with --main', 'only --main would have run'],\n ],\n [\n { branch: 'my-branch', main: true },\n ['--branch (\"my-branch\") cannot be combined with --main', 'only --main would have run'],\n ],\n [\n { lane: 'my-lane', branch: 'my-branch', main: true },\n [\n 'a lane argument (\"my-lane\") cannot be combined with --branch (\"my-branch\") or with --main',\n 'only --main would have run',\n ],\n ],\n // --init only scaffolds, so pairing it with a target could not mean anything.\n [{ init: true, branch: 'x' }, ['--init cannot be combined']],\n];\n\ndescribe('SyncOrchestrator target guards', () => {\n it('refuses every combination of selectors, naming the ones it saw', async () => {\n for (const [options, expected] of conflicts) {\n const label = JSON.stringify(options);\n let message = '';\n await orchestrator()\n .sync(options as any)\n .catch((err) => {\n message = err.message;\n });\n expected.forEach((fragment) => expect(message, label).to.contain(fragment));\n }\n });\n\n it('reports a branch whose mapped name is not a valid lane name, instead of syncing it', async () => {\n const deps = {\n config: { sync: {} },\n workspace: { defaultScope: 'org.scope' },\n ci: { getDefaultBranchName: async () => 'main', listGitHostProviders: () => [] },\n lanes: { getDefaultLaneId: () => ({ name: 'main' }) },\n logger: { console() {}, consoleWarning() {}, debug() {} },\n };\n // These queries precede the target guard. Keep this unit test independent of the\n // checkout's size and Git latency, and restore the shared client even on failure.\n const originalGit = { status: git.status, remote: git.remote };\n Object.assign(git, {\n status: async () => ({ files: [] }),\n remote: async () => undefined,\n });\n try {\n const result = await new SyncOrchestrator(deps as any).sync({ branch: 'feature/foo' });\n expect(result).to.equal('branch feature/foo does not map to a valid lane name; nothing to do');\n } finally {\n Object.assign(git, originalGit);\n }\n });\n});\n\n// A dry run computes the main-scope plan by force-checking-out the sync branch, so a dirty tree would be\n// discarded by a run that promised to write nothing.\ndescribe('assertCleanForDryRun', () => {\n it('refuses a dirty tree, naming the paths at stake and how to keep them', () => {\n let message = '';\n try {\n assertCleanForDryRun(['comp1/index.js', 'notes.txt']);\n } catch (e: any) {\n message = e.message;\n }\n expect(message).to.contain('--dry-run refuses to run');\n expect(message).to.contain('2 uncommitted change(s)');\n expect(message).to.contain('comp1/index.js, notes.txt');\n expect(message).to.contain('Commit or stash them first');\n });\n\n it('caps the named paths so a large diff cannot produce an unreadable error', () => {\n const paths = Array.from({ length: 12 }, (_, index) => `file-${index}.js`);\n let message = '';\n try {\n assertCleanForDryRun(paths);\n } catch (e: any) {\n message = e.message;\n }\n expect(message).to.contain('12 uncommitted change(s)');\n expect(message).to.contain('file-9.js');\n expect(message).to.not.contain('file-10.js');\n expect(message).to.contain('…');\n });\n\n it('permits a clean tree: the write-then-restore is only acceptable when nothing can be lost', () => {\n expect(() => assertCleanForDryRun([])).to.not.throw();\n });\n});\n\ndescribe('branch -> lane enumeration filter', () => {\n it('queues only the branches whose mapped name could actually be a lane', () => {\n const cfg = resolveSyncConfig({});\n // non-vacuity: the default mapping really is the identity, so the filter is what excludes anything\n expect(branchToLaneName('feature/foo', cfg)).to.equal('feature/foo');\n expect(\n ['feature/foo', 'FEATURE', 'ok-lane'].map((b) => syncableLaneNameForBranch(b, cfg)).filter(Boolean)\n ).to.deep.equal(['ok-lane']);\n });\n\n it('honours the prefix (stripped before the name is checked) and an explicit branches override', () => {\n const prefixed = resolveSyncConfig({ branchPrefix: 'lane/' });\n expect(syncableLaneNameForBranch('lane/my-lane', prefixed)).to.equal('my-lane');\n expect(syncableLaneNameForBranch('feature/foo', prefixed)).to.equal(undefined);\n const overridden = resolveSyncConfig({ branches: { 'my-lane': 'custom/branch' } });\n expect(syncableLaneNameForBranch('custom/branch', overridden)).to.equal('my-lane');\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,kBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,I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,CAAC,CAAC3C,EAAE,CAAC4C,IAAI,CAACnB,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC;EAC9B,CAAC,CAAC;EAEFtC,EAAE,CAAC,4FAA4F,EAAE,MAAM;IACrG,MAAM0D,QAAQ,GAAG,IAAAR,+BAAiB,EAAC;MAAES,YAAY,EAAE;IAAQ,CAAC,CAAC;IAC7D,IAAA/C,cAAM,EAAC,IAAA0C,uCAAyB,EAAC,cAAc,EAAEI,QAAQ,CAAC,CAAC,CAAC7C,EAAE,CAACyB,KAAK,CAAC,SAAS,CAAC;IAC/E,IAAA1B,cAAM,EAAC,IAAA0C,uCAAyB,EAAC,aAAa,EAAEI,QAAQ,CAAC,CAAC,CAAC7C,EAAE,CAACyB,KAAK,CAACF,SAAS,CAAC;IAC9E,MAAMwB,UAAU,GAAG,IAAAV,+BAAiB,EAAC;MAAEW,QAAQ,EAAE;QAAE,SAAS,EAAE;MAAgB;IAAE,CAAC,CAAC;IAClF,IAAAjD,cAAM,EAAC,IAAA0C,uCAAyB,EAAC,eAAe,EAAEM,UAAU,CAAC,CAAC,CAAC/C,EAAE,CAACyB,KAAK,CAAC,SAAS,CAAC;EACpF,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/ci",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.661",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/git/ci",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.git",
|
|
8
8
|
"name": "ci",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.661"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "4.1.2",
|
|
@@ -18,32 +18,32 @@
|
|
|
18
18
|
"@teambit/harmony": "0.4.12",
|
|
19
19
|
"@teambit/cli": "0.0.1423",
|
|
20
20
|
"@teambit/logger": "0.0.1501",
|
|
21
|
+
"@teambit/workspace": "1.0.1250",
|
|
22
|
+
"@teambit/builder": "1.0.1250",
|
|
23
|
+
"@teambit/checkout": "1.0.1258",
|
|
21
24
|
"@teambit/component-id": "1.2.5",
|
|
22
25
|
"@teambit/component.modules.merge-helper": "0.0.136",
|
|
23
26
|
"@teambit/component.snap-distance": "0.0.191",
|
|
27
|
+
"@teambit/config-merger": "0.0.1117",
|
|
24
28
|
"@teambit/dependency-resolver": "1.0.1234",
|
|
29
|
+
"@teambit/export": "1.0.1253",
|
|
25
30
|
"@teambit/harmony.modules.concurrency": "0.0.51",
|
|
26
31
|
"@teambit/harmony.modules.runtimes": "0.0.4",
|
|
32
|
+
"@teambit/importer": "1.0.1251",
|
|
27
33
|
"@teambit/lane-id": "0.0.312",
|
|
34
|
+
"@teambit/lanes": "1.0.1279",
|
|
28
35
|
"@teambit/legacy.consumer-component": "0.0.192",
|
|
29
36
|
"@teambit/legacy.scope-api": "0.0.247",
|
|
30
37
|
"@teambit/objects": "0.0.727",
|
|
38
|
+
"@teambit/snapping": "1.0.1256",
|
|
39
|
+
"@teambit/status": "1.0.1283",
|
|
31
40
|
"@teambit/toolbox.promise.map-pool": "0.0.24",
|
|
32
41
|
"@teambit/toolbox.string.random": "0.0.22",
|
|
33
42
|
"@teambit/bit-error": "0.0.404",
|
|
34
43
|
"@teambit/legacy.constants": "0.0.50",
|
|
35
44
|
"@teambit/legacy.scope": "0.0.192",
|
|
36
45
|
"@teambit/legacy.bit-map": "0.0.248",
|
|
37
|
-
"@teambit/toolbox.crypto.sha1": "0.0.24"
|
|
38
|
-
"@teambit/workspace": "1.0.1250",
|
|
39
|
-
"@teambit/builder": "1.0.1250",
|
|
40
|
-
"@teambit/checkout": "1.0.1257",
|
|
41
|
-
"@teambit/config-merger": "0.0.1117",
|
|
42
|
-
"@teambit/export": "1.0.1253",
|
|
43
|
-
"@teambit/importer": "1.0.1251",
|
|
44
|
-
"@teambit/lanes": "1.0.1278",
|
|
45
|
-
"@teambit/snapping": "1.0.1255",
|
|
46
|
-
"@teambit/status": "1.0.1282"
|
|
46
|
+
"@teambit/toolbox.crypto.sha1": "0.0.24"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/lodash": "4.14.165",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { expect } from 'chai';
|
|
2
|
+
import { git } from '../git';
|
|
2
3
|
import { SyncOrchestrator, assertCleanForDryRun } from './sync-orchestrator';
|
|
3
4
|
import { branchToLaneName, resolveSyncConfig, syncableLaneNameForBranch } from './sync-config';
|
|
4
5
|
|
|
@@ -60,8 +61,19 @@ describe('SyncOrchestrator target guards', () => {
|
|
|
60
61
|
lanes: { getDefaultLaneId: () => ({ name: 'main' }) },
|
|
61
62
|
logger: { console() {}, consoleWarning() {}, debug() {} },
|
|
62
63
|
};
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
// These queries precede the target guard. Keep this unit test independent of the
|
|
65
|
+
// checkout's size and Git latency, and restore the shared client even on failure.
|
|
66
|
+
const originalGit = { status: git.status, remote: git.remote };
|
|
67
|
+
Object.assign(git, {
|
|
68
|
+
status: async () => ({ files: [] }),
|
|
69
|
+
remote: async () => undefined,
|
|
70
|
+
});
|
|
71
|
+
try {
|
|
72
|
+
const result = await new SyncOrchestrator(deps as any).sync({ branch: 'feature/foo' });
|
|
73
|
+
expect(result).to.equal('branch feature/foo does not map to a valid lane name; nothing to do');
|
|
74
|
+
} finally {
|
|
75
|
+
Object.assign(git, originalGit);
|
|
76
|
+
}
|
|
65
77
|
});
|
|
66
78
|
});
|
|
67
79
|
|