@application-kit/acceptance 0.1.0 → 0.17.0
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @application-kit/acceptance
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
No changes in this release.
|
|
6
|
+
|
|
7
|
+
## 0.1.1
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 8458cb7: `classes` и `links` видят story продукта, когда репозиторий тестов — его подкаталог: задачи читаются с коммита текущего checkout. Сценарии критериев старого формата `AC-22.10.` засчитываются своей story.
|
|
12
|
+
|
|
3
13
|
## 0.1.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
|
@@ -16,15 +16,17 @@ const revisionStoryFiles = async (cwd, project, revision) => {
|
|
|
16
16
|
.toReversed();
|
|
17
17
|
return new Map(files.map((file) => [(0, projects_js_1.storyKey)(file), file]));
|
|
18
18
|
};
|
|
19
|
-
const
|
|
19
|
+
const storyPrefixes = (story) => {
|
|
20
20
|
const groups = storyNumber.exec(story.key)?.groups;
|
|
21
|
-
return groups === undefined
|
|
21
|
+
return groups === undefined
|
|
22
|
+
? []
|
|
23
|
+
: ['-', '.'].map((separator) => `${story.project}:AC-${groups.epic}${separator}${groups.story}.`);
|
|
22
24
|
};
|
|
23
25
|
const storyIds = (scenarios, story) => {
|
|
24
|
-
const
|
|
26
|
+
const prefixes = storyPrefixes(story);
|
|
25
27
|
const linked = (0, acceptance_class_js_1.storyLinks)(story.text, scenarios.config).map(([, tag]) => tag);
|
|
26
28
|
const known = [...scenarios.ids.keys(), ...scenarios.removed.keys()];
|
|
27
|
-
const prefixed =
|
|
29
|
+
const prefixed = known.filter((id) => prefixes.some((prefix) => id.startsWith(prefix)));
|
|
28
30
|
return (0, python_text_js_1.sortedText)(new Set([...linked, ...prefixed]));
|
|
29
31
|
};
|
|
30
32
|
const scenarioOutcome = (scenarios, story, found) => {
|
|
@@ -38,15 +38,21 @@ const skipNote = (name, commit, revision) => {
|
|
|
38
38
|
return `проект ${name} пропущен — нет ${missing}${revision}`;
|
|
39
39
|
};
|
|
40
40
|
const isText = (text) => text !== undefined && text !== '';
|
|
41
|
-
const
|
|
42
|
-
const repo =
|
|
43
|
-
const revision = input.revisions.get(name) ??
|
|
41
|
+
const projectAtRevision = async (input, source) => {
|
|
42
|
+
const { name, repo } = source;
|
|
43
|
+
const revision = input.revisions.get(name) ?? source.fallback;
|
|
44
44
|
const commit = await (0, git_js_1.git)(input.cwd, repo, ['rev-parse', '--verify', '-q', `${revision}${commitSuffix}`]);
|
|
45
45
|
const board = await (0, git_js_1.git)(input.cwd, repo, ['show', `${revision}:${ownBoard}`]);
|
|
46
46
|
return !isText(board) || !isText(commit)
|
|
47
47
|
? skipNote(name, commit, revision)
|
|
48
48
|
: { board, commit: commit.trim(), name, repo, revision };
|
|
49
49
|
};
|
|
50
|
+
const foreignProject = async (input, name) => projectAtRevision(input, { fallback: 'origin/main', name, repo: (0, features_js_1.joinPath)(input.projects, name) });
|
|
51
|
+
const hostRoot = async (cwd) => {
|
|
52
|
+
const output = await (0, git_js_1.git)(cwd, git_js_1.currentRepo, ['rev-parse', '--show-cdup']);
|
|
53
|
+
const root = output?.trim();
|
|
54
|
+
return root === '' ? undefined : root;
|
|
55
|
+
};
|
|
50
56
|
const ownProject = (name) => ({
|
|
51
57
|
board: undefined,
|
|
52
58
|
commit: undefined,
|
|
@@ -56,7 +62,12 @@ const ownProject = (name) => ({
|
|
|
56
62
|
});
|
|
57
63
|
const probe = async (input, own, name) => {
|
|
58
64
|
const common = await (0, git_js_1.commonDirectory)(input.cwd, (0, features_js_1.joinPath)(input.projects, name));
|
|
59
|
-
|
|
65
|
+
if (own.common === undefined || common !== own.common) {
|
|
66
|
+
return foreignProject(input, name);
|
|
67
|
+
}
|
|
68
|
+
return own.host === undefined
|
|
69
|
+
? ownProject(name)
|
|
70
|
+
: projectAtRevision(input, { fallback: 'HEAD', name, repo: own.host });
|
|
60
71
|
};
|
|
61
72
|
const checkRevisions = (input, names) => {
|
|
62
73
|
const unknown = (0, python_text_js_1.sortedText)([...input.revisions.keys()].filter((name) => !names.includes(name)));
|
|
@@ -71,7 +82,7 @@ const withOwn = (found, hasOwnBoard) => {
|
|
|
71
82
|
return isOwnSeen || !hasOwnBoard ? projects : [...projects, ownProject('.')];
|
|
72
83
|
};
|
|
73
84
|
const walkProjects = async (input) => {
|
|
74
|
-
const own = await (0, git_js_1.commonDirectory)(input.cwd, git_js_1.currentRepo);
|
|
85
|
+
const own = { common: await (0, git_js_1.commonDirectory)(input.cwd, git_js_1.currentRepo), host: await hostRoot(input.cwd) };
|
|
75
86
|
const names = await projectNames(input.cwd, input.projects);
|
|
76
87
|
checkRevisions(input, names);
|
|
77
88
|
const hasOwnBoard = await (0, features_js_1.isFile)(input.cwd, ownBoard);
|
|
@@ -13,15 +13,17 @@ const revisionStoryFiles = async (cwd, project, revision) => {
|
|
|
13
13
|
.toReversed();
|
|
14
14
|
return new Map(files.map((file) => [storyKey(file), file]));
|
|
15
15
|
};
|
|
16
|
-
const
|
|
16
|
+
const storyPrefixes = (story) => {
|
|
17
17
|
const groups = storyNumber.exec(story.key)?.groups;
|
|
18
|
-
return groups === undefined
|
|
18
|
+
return groups === undefined
|
|
19
|
+
? []
|
|
20
|
+
: ['-', '.'].map((separator) => `${story.project}:AC-${groups.epic}${separator}${groups.story}.`);
|
|
19
21
|
};
|
|
20
22
|
const storyIds = (scenarios, story) => {
|
|
21
|
-
const
|
|
23
|
+
const prefixes = storyPrefixes(story);
|
|
22
24
|
const linked = storyLinks(story.text, scenarios.config).map(([, tag]) => tag);
|
|
23
25
|
const known = [...scenarios.ids.keys(), ...scenarios.removed.keys()];
|
|
24
|
-
const prefixed =
|
|
26
|
+
const prefixed = known.filter((id) => prefixes.some((prefix) => id.startsWith(prefix)));
|
|
25
27
|
return sortedText(new Set([...linked, ...prefixed]));
|
|
26
28
|
};
|
|
27
29
|
const scenarioOutcome = (scenarios, story, found) => {
|
|
@@ -31,15 +31,21 @@ const skipNote = (name, commit, revision) => {
|
|
|
31
31
|
return `проект ${name} пропущен — нет ${missing}${revision}`;
|
|
32
32
|
};
|
|
33
33
|
const isText = (text) => text !== undefined && text !== '';
|
|
34
|
-
const
|
|
35
|
-
const repo =
|
|
36
|
-
const revision = input.revisions.get(name) ??
|
|
34
|
+
const projectAtRevision = async (input, source) => {
|
|
35
|
+
const { name, repo } = source;
|
|
36
|
+
const revision = input.revisions.get(name) ?? source.fallback;
|
|
37
37
|
const commit = await git(input.cwd, repo, ['rev-parse', '--verify', '-q', `${revision}${commitSuffix}`]);
|
|
38
38
|
const board = await git(input.cwd, repo, ['show', `${revision}:${ownBoard}`]);
|
|
39
39
|
return !isText(board) || !isText(commit)
|
|
40
40
|
? skipNote(name, commit, revision)
|
|
41
41
|
: { board, commit: commit.trim(), name, repo, revision };
|
|
42
42
|
};
|
|
43
|
+
const foreignProject = async (input, name) => projectAtRevision(input, { fallback: 'origin/main', name, repo: joinPath(input.projects, name) });
|
|
44
|
+
const hostRoot = async (cwd) => {
|
|
45
|
+
const output = await git(cwd, currentRepo, ['rev-parse', '--show-cdup']);
|
|
46
|
+
const root = output?.trim();
|
|
47
|
+
return root === '' ? undefined : root;
|
|
48
|
+
};
|
|
43
49
|
const ownProject = (name) => ({
|
|
44
50
|
board: undefined,
|
|
45
51
|
commit: undefined,
|
|
@@ -49,7 +55,12 @@ const ownProject = (name) => ({
|
|
|
49
55
|
});
|
|
50
56
|
const probe = async (input, own, name) => {
|
|
51
57
|
const common = await commonDirectory(input.cwd, joinPath(input.projects, name));
|
|
52
|
-
|
|
58
|
+
if (own.common === undefined || common !== own.common) {
|
|
59
|
+
return foreignProject(input, name);
|
|
60
|
+
}
|
|
61
|
+
return own.host === undefined
|
|
62
|
+
? ownProject(name)
|
|
63
|
+
: projectAtRevision(input, { fallback: 'HEAD', name, repo: own.host });
|
|
53
64
|
};
|
|
54
65
|
const checkRevisions = (input, names) => {
|
|
55
66
|
const unknown = sortedText([...input.revisions.keys()].filter((name) => !names.includes(name)));
|
|
@@ -64,7 +75,7 @@ const withOwn = (found, hasOwnBoard) => {
|
|
|
64
75
|
return isOwnSeen || !hasOwnBoard ? projects : [...projects, ownProject('.')];
|
|
65
76
|
};
|
|
66
77
|
export const walkProjects = async (input) => {
|
|
67
|
-
const own = await commonDirectory(input.cwd, currentRepo);
|
|
78
|
+
const own = { common: await commonDirectory(input.cwd, currentRepo), host: await hostRoot(input.cwd) };
|
|
68
79
|
const names = await projectNames(input.cwd, input.projects);
|
|
69
80
|
checkRevisions(input, names);
|
|
70
81
|
const hasOwnBoard = await isFile(input.cwd, ownBoard);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@application-kit/acceptance",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "Инструмент репозитория приёмочных тестов: команда application-scenarios (lint, removed, links, classes, coverage, inventory) по feature-файлам и story проектов, каденс прогона, реестр окружений и чтение учётных данных окружения",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|