@sdods/core 0.3.0 → 0.3.2
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/dist/.tsbuildinfo +1 -1
- package/dist/config/runner.js +2 -2
- package/dist/fixtures/test.js +14 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/steps/glob.d.ts +16 -1
- package/dist/steps/glob.js +40 -1
- package/dist/steps/index.d.ts +1 -1
- package/dist/steps/index.js +1 -1
- package/package.json +3 -3
package/dist/config/runner.js
CHANGED
|
@@ -3,7 +3,7 @@ import { join, resolve as resolvePath } from 'node:path';
|
|
|
3
3
|
import { devices } from '@playwright/test';
|
|
4
4
|
import { cucumberReporter, defineBddConfig } from 'playwright-bdd';
|
|
5
5
|
import { runnerProjectName, runFiles } from '@sdods/contracts';
|
|
6
|
-
import {
|
|
6
|
+
import { coreStepsPatterns } from '../steps/glob.js';
|
|
7
7
|
import { combineTagExpr, normalizeTagExpr } from './tags.js';
|
|
8
8
|
const DEVICE_FOR_BROWSER = {
|
|
9
9
|
chromium: 'Desktop Chrome',
|
|
@@ -121,7 +121,7 @@ export function buildRunnerConfig(registry, sel = {}) {
|
|
|
121
121
|
const testDir = defineBddConfig({
|
|
122
122
|
features: `${toPosix(p.root)}/features/**/*.feature`,
|
|
123
123
|
steps: [
|
|
124
|
-
|
|
124
|
+
...coreStepsPatterns(cfg.project.steps?.core?.exclude ?? []),
|
|
125
125
|
`${toPosix(p.root)}/steps/**/*.ts`,
|
|
126
126
|
`${toPosix(p.root)}/pages/**/*.ts`,
|
|
127
127
|
],
|
package/dist/fixtures/test.js
CHANGED
|
@@ -90,9 +90,15 @@ export const test = base.extend({
|
|
|
90
90
|
],
|
|
91
91
|
// ── test scope ──────────────────────────────────────────────────────────
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
93
|
+
* Automatic, and an explicit DEPENDENCY of `user` — which is what actually makes
|
|
94
|
+
* it decide before anything expensive happens.
|
|
95
|
+
*
|
|
96
|
+
* Declaration order alone does not: Playwright instantiates fixtures in
|
|
97
|
+
* dependency order, and `user` is pulled in by `storageState`, which the browser
|
|
98
|
+
* context needs, so the pool lease happened first regardless of where the gate
|
|
99
|
+
* sat in the object. An `@env:local @user:noconsent` scenario on staging failed
|
|
100
|
+
* with `No users with role "noconsent"` instead of skipping — the gate never got
|
|
101
|
+
* to run. Depending on it is the only ordering guarantee Playwright offers.
|
|
96
102
|
*
|
|
97
103
|
* `@env:`, `@skip:<browser>` and `@flag:` were validated at LINT time and had
|
|
98
104
|
* no runtime path whatsoever. That is the worst arrangement available: the
|
|
@@ -171,7 +177,11 @@ export const test = base.extend({
|
|
|
171
177
|
}
|
|
172
178
|
void apiContext;
|
|
173
179
|
},
|
|
174
|
-
|
|
180
|
+
// `$sdodsTagGate` first, and it is not unused: it is here to force the ordering.
|
|
181
|
+
// Leasing an account for a scenario that the tag gate is about to skip burns a
|
|
182
|
+
// pool slot, and on a role with no rows it throws before the skip can happen.
|
|
183
|
+
user: async ({ $sdodsTagGate, userPool, $tags }, use, testInfo) => {
|
|
184
|
+
void $sdodsTagGate;
|
|
175
185
|
const role = parseTagValue($tags, 'user');
|
|
176
186
|
await use(role ? await userPool.lease(role, testInfo.parallelIndex) : undefined);
|
|
177
187
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export { PageRegistry } from './fixtures/pages.js';
|
|
|
12
12
|
export { AuthStateCache } from './fixtures/auth.js';
|
|
13
13
|
export { ScenarioMeta } from './fixtures/scenario.js';
|
|
14
14
|
export type { TestFixtures, WorkerFixtures, SdodsOption } from './fixtures/types.js';
|
|
15
|
-
export { coreStepsGlob, coreStepsDir } from './steps/glob.js';
|
|
15
|
+
export { coreStepsGlob, coreStepsPatterns, coreStepNames, coreStepsDir } from './steps/glob.js';
|
|
16
16
|
export { VERSION } from './version.js';
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,6 @@ export { BasePage } from './pages/base-page.js';
|
|
|
11
11
|
export { PageRegistry } from './fixtures/pages.js';
|
|
12
12
|
export { AuthStateCache } from './fixtures/auth.js';
|
|
13
13
|
export { ScenarioMeta } from './fixtures/scenario.js';
|
|
14
|
-
export { coreStepsGlob, coreStepsDir } from './steps/glob.js';
|
|
14
|
+
export { coreStepsGlob, coreStepsPatterns, coreStepNames, coreStepsDir } from './steps/glob.js';
|
|
15
15
|
export { VERSION } from './version.js';
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
package/dist/steps/glob.d.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* TS transform sees a workspace path (not node_modules) and playwright-bdd loads it.
|
|
4
4
|
*/
|
|
5
5
|
export declare function coreStepsDir(): string;
|
|
6
|
+
/** The library names present in this build — `a11y` for `a11y.steps.ts`. */
|
|
7
|
+
export declare function coreStepNames(): string[];
|
|
6
8
|
/**
|
|
7
9
|
* Both extensions, because this resolves against whichever copy of the package is running: the
|
|
8
10
|
* workspace checkout ships `*.steps.ts`, the published package ships the compiled `*.steps.js`.
|
|
@@ -10,6 +12,19 @@ export declare function coreStepsDir(): string;
|
|
|
10
12
|
* outside the pattern. playwright-bdd passes explicit patterns to tinyglobby untouched — it only
|
|
11
13
|
* appends extensions to bare directory patterns — and neither it nor tinyglobby excludes
|
|
12
14
|
* node_modules, so the published layout globs fine.
|
|
13
|
-
*/
|
|
15
|
+
* */
|
|
14
16
|
export declare function coreStepsGlob(): string;
|
|
17
|
+
/**
|
|
18
|
+
* The patterns bddgen should load, honouring `steps.core.exclude`.
|
|
19
|
+
*
|
|
20
|
+
* Separate from `coreStepsGlob()` because that one is exported API and returns a single string;
|
|
21
|
+
* widening its return type would break every caller for the sake of an option most projects
|
|
22
|
+
* never set. With nothing excluded this returns exactly that same glob, so the common path is
|
|
23
|
+
* byte-identical to what shipped before.
|
|
24
|
+
*
|
|
25
|
+
* An unknown name THROWS rather than being ignored. A silent no-op on a typo would leave the
|
|
26
|
+
* project believing it had excluded a library while the collision it was avoiding still fails
|
|
27
|
+
* generation — and the error it would then read points at the step, not at the typo.
|
|
28
|
+
*/
|
|
29
|
+
export declare function coreStepsPatterns(exclude?: readonly string[]): string[];
|
|
15
30
|
//# sourceMappingURL=glob.d.ts.map
|
package/dist/steps/glob.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { readdirSync } from 'node:fs';
|
|
1
2
|
import { dirname } from 'node:path';
|
|
2
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { SdodsError } from '../errors.js';
|
|
3
5
|
/**
|
|
4
6
|
* Absolute glob of the core step library. Built from this file's real path so Playwright's
|
|
5
7
|
* TS transform sees a workspace path (not node_modules) and playwright-bdd loads it.
|
|
@@ -7,6 +9,13 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
9
|
export function coreStepsDir() {
|
|
8
10
|
return dirname(fileURLToPath(import.meta.url)).replace(/\\/g, '/');
|
|
9
11
|
}
|
|
12
|
+
/** The library names present in this build — `a11y` for `a11y.steps.ts`. */
|
|
13
|
+
export function coreStepNames() {
|
|
14
|
+
return readdirSync(coreStepsDir())
|
|
15
|
+
.map((f) => /^(.+)\.steps\.(?:js|ts)$/.exec(f)?.[1])
|
|
16
|
+
.filter((n) => Boolean(n))
|
|
17
|
+
.sort();
|
|
18
|
+
}
|
|
10
19
|
/**
|
|
11
20
|
* Both extensions, because this resolves against whichever copy of the package is running: the
|
|
12
21
|
* workspace checkout ships `*.steps.ts`, the published package ships the compiled `*.steps.js`.
|
|
@@ -14,8 +23,38 @@ export function coreStepsDir() {
|
|
|
14
23
|
* outside the pattern. playwright-bdd passes explicit patterns to tinyglobby untouched — it only
|
|
15
24
|
* appends extensions to bare directory patterns — and neither it nor tinyglobby excludes
|
|
16
25
|
* node_modules, so the published layout globs fine.
|
|
17
|
-
*/
|
|
26
|
+
* */
|
|
18
27
|
export function coreStepsGlob() {
|
|
19
28
|
return `${coreStepsDir()}/*.steps.{js,ts}`;
|
|
20
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* The patterns bddgen should load, honouring `steps.core.exclude`.
|
|
32
|
+
*
|
|
33
|
+
* Separate from `coreStepsGlob()` because that one is exported API and returns a single string;
|
|
34
|
+
* widening its return type would break every caller for the sake of an option most projects
|
|
35
|
+
* never set. With nothing excluded this returns exactly that same glob, so the common path is
|
|
36
|
+
* byte-identical to what shipped before.
|
|
37
|
+
*
|
|
38
|
+
* An unknown name THROWS rather than being ignored. A silent no-op on a typo would leave the
|
|
39
|
+
* project believing it had excluded a library while the collision it was avoiding still fails
|
|
40
|
+
* generation — and the error it would then read points at the step, not at the typo.
|
|
41
|
+
*/
|
|
42
|
+
export function coreStepsPatterns(exclude = []) {
|
|
43
|
+
if (exclude.length === 0)
|
|
44
|
+
return [coreStepsGlob()];
|
|
45
|
+
const available = coreStepNames();
|
|
46
|
+
const unknown = exclude.filter((n) => !available.includes(n));
|
|
47
|
+
if (unknown.length) {
|
|
48
|
+
throw new SdodsError('CONFIG_INVALID', `steps.core.exclude names ${unknown.length === 1 ? 'a library' : 'libraries'} that ` +
|
|
49
|
+
`${unknown.length === 1 ? 'does' : 'do'} not exist: ${unknown.join(', ')}.`, {
|
|
50
|
+
hint: `Available: ${available.join(', ')}. Names are the file basenames, so "a11y" for a11y.steps.ts.`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// Explicit per-library patterns rather than a negated glob: playwright-bdd hands these to
|
|
54
|
+
// tinyglobby verbatim, and a `!`-prefixed entry in that list is treated as a path, not an
|
|
55
|
+
// exclusion.
|
|
56
|
+
return available
|
|
57
|
+
.filter((n) => !exclude.includes(n))
|
|
58
|
+
.map((n) => `${coreStepsDir()}/${n}.steps.{js,ts}`);
|
|
59
|
+
}
|
|
21
60
|
//# sourceMappingURL=glob.js.map
|
package/dist/steps/index.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ import './dom.steps.js';
|
|
|
18
18
|
import './net.steps.js';
|
|
19
19
|
import './perf.steps.js';
|
|
20
20
|
import '../shots/hooks.js';
|
|
21
|
-
export { coreStepsGlob, coreStepsDir } from './glob.js';
|
|
21
|
+
export { coreStepsGlob, coreStepsPatterns, coreStepNames, coreStepsDir } from './glob.js';
|
|
22
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/steps/index.js
CHANGED
|
@@ -18,5 +18,5 @@ import './dom.steps.js';
|
|
|
18
18
|
import './net.steps.js';
|
|
19
19
|
import './perf.steps.js';
|
|
20
20
|
import '../shots/hooks.js';
|
|
21
|
-
export { coreStepsGlob, coreStepsDir } from './glob.js';
|
|
21
|
+
export { coreStepsGlob, coreStepsPatterns, coreStepNames, coreStepsDir } from './glob.js';
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdods/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "SDODS runtime: configuration, project registry, fixtures, step libraries, data providers, screenshot narratives and self-healing locators.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "SDODS <admin@sdods.com>",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"playwright-bdd": ">=9"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@sdods/contracts": "0.3.
|
|
45
|
+
"@sdods/contracts": "0.3.2",
|
|
46
46
|
"@cucumber/gherkin": "^42.0.1",
|
|
47
47
|
"@cucumber/messages": "^34.2.1",
|
|
48
48
|
"@faker-js/faker": "^10.6.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"ts-morph": "^28.0.0",
|
|
59
59
|
"yaml": "^2.9.0",
|
|
60
60
|
"zod": "^4.5.4",
|
|
61
|
-
"@sdods/db": "0.3.
|
|
61
|
+
"@sdods/db": "0.3.2"
|
|
62
62
|
},
|
|
63
63
|
"homepage": "https://sdods.com",
|
|
64
64
|
"bugs": {
|