nuxt-spec 0.4.0-alpha.1 → 0.4.0-alpha.3

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.
Files changed (41) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +13 -13
  3. package/app/app.vue +10 -10
  4. package/app/components/NuxtSpecApiTestComponent.vue +24 -24
  5. package/app/components/NuxtSpecTestComponent.vue +9 -9
  6. package/app/components/index.d.ts +7 -7
  7. package/app/components/index.ts +2 -2
  8. package/app/utils/vitest-utils.ts +5 -5
  9. package/config/index.d.ts +36 -36
  10. package/config/index.mjs +147 -140
  11. package/config/report/report-entry.html +6 -6
  12. package/config/report/report-head.html +34 -34
  13. package/config/report/report-screenshot.html +8 -8
  14. package/config/report/report-tail.html +4 -4
  15. package/config/templates/.github/workflows/ci-test-update.yml.template +105 -0
  16. package/config/templates/.github/workflows/ci-test-verify.yml.template +68 -0
  17. package/config/templates/.gitlab/ci/ci-test-update.yml.template +69 -0
  18. package/config/templates/.gitlab/ci/ci-test-verify.yml.template +41 -0
  19. package/config/templates/.gitlab-ci.yml.template +6 -0
  20. package/config/templates/pnpm-workspace.yaml.template +19 -19
  21. package/config/templates/vitest.config.ts.template +5 -5
  22. package/config/utils/merge.mjs +43 -43
  23. package/config/utils/options.d.mts +59 -59
  24. package/config/utils/options.mjs +116 -116
  25. package/config/utils/reporter.mjs +409 -409
  26. package/config/utils/warnings.mjs +38 -38
  27. package/modules/spec-options.ts +23 -23
  28. package/nuxt.config.ts +20 -20
  29. package/package.json +23 -25
  30. package/utils/e2e.ts +131 -131
  31. package/utils/helpers/check-params.ts +44 -44
  32. package/utils/helpers/location-hint.ts +30 -30
  33. package/utils/helpers/screenshot-utils.ts +27 -27
  34. package/utils/index.ts +12 -12
  35. package/utils/playwright.ts +28 -28
  36. package/utils/screenshot.ts +201 -201
  37. package/bin/_internal/prepublish-check.js +0 -16
  38. package/bin/cli.js +0 -44
  39. package/bin/helpers/commands.js +0 -82
  40. package/bin/setup.js +0 -366
  41. package/bin/update.js +0 -94
@@ -1,8 +1,8 @@
1
- <div class="screenshot">
2
- <h3>{{FILE_NAME}}</h3>
3
- <p class="message">{{MESSAGE}}</p>
4
- <div class="pair">
5
- <figure><figcaption>Baseline image</figcaption><img src="{{BASELINE_URI}}" alt="Baseline image for reference"></figure>
6
- <figure><figcaption>Actual screenshot</figcaption><img src="{{ACTUAL_URI}}" alt="Actual screenshot taken"></figure>
7
- </div>
8
- </div>
1
+ <div class="screenshot">
2
+ <h3>{{FILE_NAME}}</h3>
3
+ <p class="message">{{MESSAGE}}</p>
4
+ <div class="pair">
5
+ <figure><figcaption>Baseline image</figcaption><img src="{{BASELINE_URI}}" alt="Baseline image for reference"></figure>
6
+ <figure><figcaption>Actual screenshot</figcaption><img src="{{ACTUAL_URI}}" alt="Actual screenshot taken"></figure>
7
+ </div>
8
+ </div>
@@ -1,4 +1,4 @@
1
- <!-- END failure entries -->
2
- <div>Generated by <a href="https://github.com/AloisSeckar/nuxt-spec">Nuxt Spec</a> @ {{TIMESTAMP}}</div>
3
- </body>
4
- </html>
1
+ <!-- END failure entries -->
2
+ <div>Generated by <a href="https://github.com/AloisSeckar/nuxt-spec">Nuxt Spec</a> @ {{TIMESTAMP}}</div>
3
+ </body>
4
+ </html>
@@ -0,0 +1,105 @@
1
+ # GitHub Actions workflow (scaffolded by Nuxt Spec) to update test baselines (manually triggered).
2
+ # Runs in the same pinned Playwright container as "verify" workflow.
3
+ # Updated baselines (`__baseline__`, `__screenshots__`) and snapshots (`__snapshots__`) are committed back to the dispatched branch.
4
+ # If the push is rejected (e.g. protected branch), a new branch with a pull request is created instead.
5
+ # PREREQUISITE: for the pull request fallback, enable
6
+ # "Settings > Actions > General > Allow GitHub Actions to create and approve pull requests".
7
+ # NOTE: commits and pull requests created via GITHUB_TOKEN don't trigger other workflows - run "verify" manually afterwards.
8
+
9
+ name: Nuxt Spec CI Tests (update baselines)
10
+
11
+ on:
12
+ workflow_dispatch:
13
+
14
+ concurrency:
15
+ group: ci-test-update-${{ github.ref }}
16
+ cancel-in-progress: false
17
+
18
+ permissions:
19
+ contents: write
20
+ pull-requests: write
21
+
22
+ jobs:
23
+ update:
24
+ runs-on: ubuntu-latest
25
+ container:
26
+ # must match `playwright` dependency version
27
+ image: mcr.microsoft.com/playwright:v__PLAYWRIGHT_VERSION__-jammy
28
+ steps:
29
+ - name: Checkout
30
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
31
+ with:
32
+ ref: ${{ github.ref_name }}
33
+
34
+ - name: Enable pnpm via corepack
35
+ run: corepack enable
36
+
37
+ - name: Resolve pnpm store path
38
+ id: pnpm-store
39
+ run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
40
+
41
+ - name: Cache pnpm store
42
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
43
+ with:
44
+ path: ${{ steps.pnpm-store.outputs.path }}
45
+ key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
46
+ restore-keys: pnpm-${{ runner.os }}-
47
+
48
+ - name: Install dependencies
49
+ run: pnpm install --frozen-lockfile
50
+
51
+ - name: Prune pnpm store
52
+ run: pnpm store prune
53
+
54
+ - name: Regenerate test baselines
55
+ run: pnpm test-u
56
+
57
+ - name: Commit updated baselines
58
+ env:
59
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60
+ REPO: ${{ github.repository }}
61
+ REF_NAME: ${{ github.ref_name }}
62
+ RUN_NUMBER: ${{ github.run_number }}
63
+ run: |
64
+ set -eu
65
+
66
+ git config --global --add safe.directory "$GITHUB_WORKSPACE"
67
+ git config user.name "github-actions[bot]"
68
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
69
+
70
+ # `git add` fails on a glob without matches, `git ls-files` doesn't
71
+ git ls-files -z -m -d -o --exclude-standard -- \
72
+ ':(glob)**/__baseline__/**' \
73
+ ':(glob)**/__screenshots__/**' \
74
+ ':(glob)**/__snapshots__/**' \
75
+ | xargs -0 -r git add -A --
76
+ if git diff --cached --quiet; then
77
+ echo "No baseline changes to commit."
78
+ exit 0
79
+ fi
80
+
81
+ git commit -m "test(ci): update test baselines"
82
+
83
+ if git push origin "HEAD:$REF_NAME"; then
84
+ echo "Updated baselines pushed to '$REF_NAME'."
85
+ exit 0
86
+ fi
87
+
88
+ echo "Push to '$REF_NAME' was rejected (e.g. protected branch) - creating pull request..."
89
+ export NEW_BRANCH="ci-test/update-$(date +%Y%m%d%H%M%S)"
90
+ git push origin "HEAD:refs/heads/$NEW_BRANCH"
91
+ BODY=$(node -e '
92
+ const { NEW_BRANCH, REF_NAME, RUN_NUMBER } = process.env
93
+ console.log(JSON.stringify({
94
+ title: "test(ci): update test baselines",
95
+ head: NEW_BRANCH,
96
+ base: REF_NAME,
97
+ body: `Test baselines update triggered on run #${RUN_NUMBER} against branch \`${REF_NAME}\`.`,
98
+ }))')
99
+ curl -sS -X POST \
100
+ -H "Authorization: Bearer $GH_TOKEN" \
101
+ -H "Accept: application/vnd.github+json" \
102
+ -H "Content-Type: application/json" \
103
+ -d "$BODY" \
104
+ --fail-with-body \
105
+ "https://api.github.com/repos/$REPO/pulls"
@@ -0,0 +1,68 @@
1
+ # GitHub Actions workflow (scaffolded by Nuxt Spec) to run test suite in a pinned Playwright container for reproducible results.
2
+ # Triggered automatically on push/pull requests to default branch with possible manual dispatch.
3
+ # Uses pnpm - the pnpm store is cached so subsequent `pnpm install` runs reuse downloaded deps.
4
+ # If tests fail, `ci-test-report` artifact (HTML report, current screenshots, Vitest attachments) is uploaded for inspection.
5
+ # NOTE: commits pushed by "update baselines" workflow don't trigger this workflow - dispatch it manually afterwards.
6
+
7
+ name: Nuxt Spec CI Tests (verify)
8
+
9
+ on:
10
+ push:
11
+ branches: [__DEFAULT_BRANCH__]
12
+ pull_request:
13
+ branches: [__DEFAULT_BRANCH__]
14
+ workflow_dispatch:
15
+
16
+ concurrency:
17
+ group: ci-test-verify-${{ github.ref }}
18
+ cancel-in-progress: true
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ jobs:
24
+ verify:
25
+ runs-on: ubuntu-latest
26
+ container:
27
+ # must match `playwright` dependency version
28
+ image: mcr.microsoft.com/playwright:v__PLAYWRIGHT_VERSION__-jammy
29
+ steps:
30
+ - name: Checkout
31
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
32
+
33
+ - name: Enable pnpm via corepack
34
+ run: corepack enable
35
+
36
+ - name: Resolve pnpm store path
37
+ id: pnpm-store
38
+ run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
39
+
40
+ - name: Cache pnpm store
41
+ uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
42
+ with:
43
+ path: ${{ steps.pnpm-store.outputs.path }}
44
+ key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
45
+ restore-keys: pnpm-${{ runner.os }}-
46
+
47
+ - name: Install dependencies
48
+ run: pnpm install --frozen-lockfile
49
+
50
+ - name: Prune pnpm store
51
+ run: pnpm store prune
52
+
53
+ - name: Run tests
54
+ run: pnpm test
55
+
56
+ - name: Upload test report
57
+ if: failure()
58
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
59
+ with:
60
+ name: ci-test-report-${{ github.run_id }}-${{ github.run_attempt }}
61
+ path: |
62
+ test/__reports__
63
+ **/__current__/**
64
+ .vitest/attachments
65
+ !**/node_modules/**
66
+ include-hidden-files: true
67
+ if-no-files-found: ignore
68
+ retention-days: 14
@@ -0,0 +1,69 @@
1
+ # GitLab CI/CD job (scaffolded by Nuxt Spec) to update test baselines (manually triggered).
2
+ # Start it via "Build > Pipelines > Run pipeline" on selected branch with `NUXT_SPEC_UPDATE_BASELINES` set to `true`.
3
+ # Runs in the same pinned Playwright container as "verify" job.
4
+ # Updated baselines (`__baseline__`, `__screenshots__`) and snapshots (`__snapshots__`) are committed back to the selected branch.
5
+ # If the push is rejected (e.g. protected branch), a new branch with a merge request is created instead.
6
+ # PREREQUISITE: project access token with `write_repository` scope stored as masked CI/CD variable `NUXT_SPEC_CI_TOKEN`
7
+ # (CI_JOB_TOKEN cannot be used for pushing; the token role decides whether it may push into protected branches).
8
+
9
+ variables:
10
+ NUXT_SPEC_UPDATE_BASELINES:
11
+ value: "false"
12
+ options: ["false", "true"]
13
+ description: Set to "true" to regenerate and commit test baselines (Nuxt Spec).
14
+
15
+ ci-test-update:
16
+ stage: test
17
+ # must match `playwright` dependency version
18
+ image: mcr.microsoft.com/playwright:v__PLAYWRIGHT_VERSION__-jammy
19
+ resource_group: ci-test-update-$CI_COMMIT_REF_SLUG
20
+ rules:
21
+ - if: $CI_PIPELINE_SOURCE == "web" && $NUXT_SPEC_UPDATE_BASELINES == "true" && $CI_COMMIT_BRANCH
22
+ variables:
23
+ PNPM_STORE_DIR: $CI_PROJECT_DIR/.pnpm-store
24
+ cache:
25
+ key:
26
+ prefix: pnpm
27
+ files:
28
+ - pnpm-lock.yaml
29
+ paths:
30
+ - .pnpm-store/
31
+ before_script:
32
+ - ': "${NUXT_SPEC_CI_TOKEN:?CI/CD variable NUXT_SPEC_CI_TOKEN (project access token with write_repository scope) is required}"'
33
+ - corepack enable
34
+ - pnpm install --frozen-lockfile --store-dir "$PNPM_STORE_DIR"
35
+ - pnpm store prune --store-dir "$PNPM_STORE_DIR"
36
+ script:
37
+ - pnpm test-u
38
+ - |
39
+ set -eu
40
+
41
+ git config user.name "$GITLAB_USER_NAME"
42
+ git config user.email "$GITLAB_USER_EMAIL"
43
+
44
+ # `git add` fails on a glob without matches, `git ls-files` doesn't
45
+ git ls-files -z -m -d -o --exclude-standard -- \
46
+ ':(glob)**/__baseline__/**' \
47
+ ':(glob)**/__screenshots__/**' \
48
+ ':(glob)**/__snapshots__/**' \
49
+ | xargs -0 -r git add -A --
50
+ if git diff --cached --quiet; then
51
+ echo "No baseline changes to commit."
52
+ exit 0
53
+ fi
54
+
55
+ git commit -m "test(ci): update test baselines"
56
+
57
+ PUSH_URL="${CI_SERVER_PROTOCOL}://oauth2:${NUXT_SPEC_CI_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/${CI_PROJECT_PATH}.git"
58
+ if git push "$PUSH_URL" "HEAD:refs/heads/$CI_COMMIT_BRANCH"; then
59
+ echo "Updated baselines pushed to '$CI_COMMIT_BRANCH'."
60
+ exit 0
61
+ fi
62
+
63
+ echo "Push to '$CI_COMMIT_BRANCH' was rejected (e.g. protected branch) - creating merge request..."
64
+ NEW_BRANCH="ci-test/update-$(date +%Y%m%d%H%M%S)"
65
+ git push "$PUSH_URL" "HEAD:refs/heads/$NEW_BRANCH" \
66
+ -o merge_request.create \
67
+ -o merge_request.target="$CI_COMMIT_BRANCH" \
68
+ -o merge_request.title="test(ci): update test baselines" \
69
+ -o merge_request.description="Test baselines update triggered by pipeline #$CI_PIPELINE_IID against branch \`$CI_COMMIT_BRANCH\`."
@@ -0,0 +1,41 @@
1
+ # GitLab CI/CD job (scaffolded by Nuxt Spec) to run test suite in a pinned Playwright container for reproducible results.
2
+ # Triggered automatically on push to default branch and on merge requests targeting it.
3
+ # Can be started manually via "Build > Pipelines > Run pipeline" (with `NUXT_SPEC_UPDATE_BASELINES` left as `false`).
4
+ # Uses pnpm - the pnpm store is cached so subsequent `pnpm install` runs reuse downloaded deps.
5
+ # If tests fail, artifacts (HTML report, current screenshots, Vitest attachments) are kept for inspection.
6
+
7
+ ci-test-verify:
8
+ stage: test
9
+ # must match `playwright` dependency version
10
+ image: mcr.microsoft.com/playwright:v__PLAYWRIGHT_VERSION__-jammy
11
+ interruptible: true
12
+ rules:
13
+ - if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
14
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
15
+ - if: $CI_PIPELINE_SOURCE == "web" && $NUXT_SPEC_UPDATE_BASELINES != "true"
16
+ variables:
17
+ PNPM_STORE_DIR: $CI_PROJECT_DIR/.pnpm-store
18
+ cache:
19
+ key:
20
+ prefix: pnpm
21
+ files:
22
+ - pnpm-lock.yaml
23
+ paths:
24
+ - .pnpm-store/
25
+ before_script:
26
+ - corepack enable
27
+ - pnpm install --frozen-lockfile --store-dir "$PNPM_STORE_DIR"
28
+ - pnpm store prune --store-dir "$PNPM_STORE_DIR"
29
+ script:
30
+ - pnpm test
31
+ artifacts:
32
+ name: ci-test-report-$CI_PIPELINE_ID
33
+ when: on_failure
34
+ expire_in: 14 days
35
+ paths:
36
+ - test/__reports__/
37
+ - "**/__current__/"
38
+ - .vitest/attachments/
39
+ exclude:
40
+ - node_modules/**/*
41
+ - .pnpm-store/**/*
@@ -0,0 +1,6 @@
1
+ # GitLab CI/CD configuration (scaffolded by Nuxt Spec).
2
+ # Nuxt Spec test jobs are defined in the included files.
3
+
4
+ include:
5
+ - local: .gitlab/ci/ci-test-verify.yml
6
+ - local: .gitlab/ci/ci-test-update.yml
@@ -1,19 +1,19 @@
1
- # settings for Nuxt & pnpm
2
-
3
- # https://pnpm.io/settings/node-modules#shamefullyhoist
4
- # required to handle transitive dependencies
5
- # without having to explicitly declare them
6
- shamefullyHoist: true
7
-
8
- # https://pnpm.io/settings/build#allowbuilds
9
- # pnpm naturally blocks all post-install scripts
10
- # some are required for development, others are not relevant
11
- allowBuilds:
12
- # provides fallback repair of platform-specific Rust native engine
13
- 'unrs-resolver': true
14
- # allows node-gyp build of associated native binaries from local sources
15
- # disabled because it would require an explicit opt-in
16
- '@parcel/watcher': false
17
- # optimization for CLI usage of 'esbuild'
18
- # disabled because its runtime resolves native binaries itself
19
- 'esbuild': false
1
+ # settings for Nuxt & pnpm
2
+
3
+ # https://pnpm.io/settings/node-modules#shamefullyhoist
4
+ # required to handle transitive dependencies
5
+ # without having to explicitly declare them
6
+ shamefullyHoist: true
7
+
8
+ # https://pnpm.io/settings/build#allowbuilds
9
+ # pnpm naturally blocks all post-install scripts
10
+ # some are required for development, others are not relevant
11
+ allowBuilds:
12
+ # provides fallback repair of platform-specific Rust native engine
13
+ 'unrs-resolver': true
14
+ # allows node-gyp build of associated native binaries from local sources
15
+ # disabled because it would require an explicit opt-in
16
+ '@parcel/watcher': false
17
+ # optimization for CLI usage of 'esbuild'
18
+ # disabled because its runtime resolves native binaries itself
19
+ 'esbuild': false
@@ -1,5 +1,5 @@
1
- import { loadVitestConfig } from 'nuxt-spec/config'
2
-
3
- export default loadVitestConfig({
4
- // custom config here
5
- })
1
+ import { loadVitestConfig } from 'nuxt-spec/config'
2
+
3
+ export default loadVitestConfig({
4
+ // custom config here
5
+ })
@@ -1,43 +1,43 @@
1
- // custom merger function based on defu
2
- // allows working with the "projects" array properly
3
- // user-defined config overrides are merged by "name"
4
-
5
- // for consistent and predictable results, passing "include" or "browser.instances"
6
- // will result in OVERRIDE instead of merging with nuxt-spec defaults
7
-
8
- import { createDefu } from 'defu'
9
-
10
- // in real Vitest config, "name" is nested inside another "test" object
11
- const getProjectName = project => project?.name ?? project?.test?.name
12
-
13
- export const mergeConfig = createDefu((obj, key, value) => {
14
- if (key === 'projects' && Array.isArray(obj[key]) && Array.isArray(value)) {
15
- const defaults = obj[key]
16
- const overrides = value
17
-
18
- // override default values if user-defined config specifies them
19
- obj[key] = defaults.map((defaultProject) => {
20
- const override = overrides.find(o => getProjectName(o) === getProjectName(defaultProject))
21
- return override ? mergeProject(override, defaultProject) : defaultProject
22
- })
23
-
24
- // add any user projects that don't exist in defaults
25
- for (const override of overrides) {
26
- if (!defaults.some(d => getProjectName(d) === getProjectName(override))) {
27
- obj[key].push(override)
28
- }
29
- }
30
-
31
- return true
32
- }
33
- })
34
-
35
- // Keys where user value should fully replace the default, not merge
36
- const overrideKeys = new Set(['include', 'instances'])
37
-
38
- const mergeProject = createDefu((obj, key, value) => {
39
- if (overrideKeys.has(key)) {
40
- obj[key] = value
41
- return true
42
- }
43
- })
1
+ // custom merger function based on defu
2
+ // allows working with the "projects" array properly
3
+ // user-defined config overrides are merged by "name"
4
+
5
+ // for consistent and predictable results, passing "include" or "browser.instances"
6
+ // will result in OVERRIDE instead of merging with nuxt-spec defaults
7
+
8
+ import { createDefu } from 'defu'
9
+
10
+ // in real Vitest config, "name" is nested inside another "test" object
11
+ const getProjectName = project => project?.name ?? project?.test?.name
12
+
13
+ export const mergeConfig = createDefu((obj, key, value) => {
14
+ if (key === 'projects' && Array.isArray(obj[key]) && Array.isArray(value)) {
15
+ const defaults = obj[key]
16
+ const overrides = value
17
+
18
+ // override default values if user-defined config specifies them
19
+ obj[key] = defaults.map((defaultProject) => {
20
+ const override = overrides.find(o => getProjectName(o) === getProjectName(defaultProject))
21
+ return override ? mergeProject(override, defaultProject) : defaultProject
22
+ })
23
+
24
+ // add any user projects that don't exist in defaults
25
+ for (const override of overrides) {
26
+ if (!defaults.some(d => getProjectName(d) === getProjectName(override))) {
27
+ obj[key].push(override)
28
+ }
29
+ }
30
+
31
+ return true
32
+ }
33
+ })
34
+
35
+ // Keys where user value should fully replace the default, not merge
36
+ const overrideKeys = new Set(['include', 'instances'])
37
+
38
+ const mergeProject = createDefu((obj, key, value) => {
39
+ if (overrideKeys.has(key)) {
40
+ obj[key] = value
41
+ return true
42
+ }
43
+ })
@@ -1,59 +1,59 @@
1
- export type HtmlReportOpenMode = 'always' | 'failed' | 'never'
2
-
3
- /**
4
- * Nuxt Spec options set via `spec` key in nuxt.config.ts.
5
- * Each option can also be set via respective NUXT_SPEC_* env variable,
6
- * which takes precedence over the value from nuxt.config.ts.
7
- */
8
- export interface NuxtSpecOptions {
9
- /**
10
- * Include `@nuxt/hints` module.
11
- * Env: `NUXT_SPEC_HINTS_ENABLED`
12
- * @default true
13
- */
14
- hints?: boolean
15
- /**
16
- * WebSocket endpoint of an external Playwright server used by `e2e` and `browser` projects.
17
- * Env: `NUXT_SPEC_EXTERNAL_PLAYWRIGHT`
18
- */
19
- externalPlaywright?: string
20
- /** HTML test report settings */
21
- htmlReport?: {
22
- /**
23
- * Generate HTML report after each test run.
24
- * Env: `NUXT_SPEC_HTML_REPORT`
25
- * @default true
26
- */
27
- enabled?: boolean
28
- /**
29
- * When to open the report in the default browser.
30
- * Env: `NUXT_SPEC_HTML_REPORT_OPEN`
31
- * @default 'failed'
32
- */
33
- open?: HtmlReportOpenMode
34
- }
35
- /**
36
- * Plain text patterns of log messages that should be omitted.
37
- * Env: `NUXT_SPEC_MESSAGE_FILTERS` (comma-separated, added to values from nuxt.config.ts)
38
- */
39
- messageFilters?: string[]
40
- }
41
-
42
- export interface ResolvedNuxtSpecOptions {
43
- hints: boolean
44
- externalPlaywright: string | undefined
45
- htmlReport: {
46
- enabled: boolean
47
- open: HtmlReportOpenMode
48
- }
49
- messageFilters: string[]
50
- }
51
-
52
- export declare const NUXT_SPEC_DEFAULTS: ResolvedNuxtSpecOptions
53
-
54
- export declare function resolveSpecOptions(
55
- fromConfig?: NuxtSpecOptions | false | null,
56
- env?: Record<string, string | undefined>,
57
- ): ResolvedNuxtSpecOptions
58
-
59
- export declare function loadSpecOptions(cwd?: string): Promise<ResolvedNuxtSpecOptions>
1
+ export type HtmlReportOpenMode = 'always' | 'failed' | 'never'
2
+
3
+ /**
4
+ * Nuxt Spec options set via `spec` key in nuxt.config.ts.
5
+ * Each option can also be set via respective NUXT_SPEC_* env variable,
6
+ * which takes precedence over the value from nuxt.config.ts.
7
+ */
8
+ export interface NuxtSpecOptions {
9
+ /**
10
+ * Include `@nuxt/hints` module.
11
+ * Env: `NUXT_SPEC_HINTS_ENABLED`
12
+ * @default true
13
+ */
14
+ hints?: boolean
15
+ /**
16
+ * WebSocket endpoint of an external Playwright server used by `e2e` and `browser` projects.
17
+ * Env: `NUXT_SPEC_EXTERNAL_PLAYWRIGHT`
18
+ */
19
+ externalPlaywright?: string
20
+ /** HTML test report settings */
21
+ htmlReport?: {
22
+ /**
23
+ * Generate HTML report after each test run.
24
+ * Env: `NUXT_SPEC_HTML_REPORT`
25
+ * @default true
26
+ */
27
+ enabled?: boolean
28
+ /**
29
+ * When to open the report in the default browser.
30
+ * Env: `NUXT_SPEC_HTML_REPORT_OPEN`
31
+ * @default 'failed'
32
+ */
33
+ open?: HtmlReportOpenMode
34
+ }
35
+ /**
36
+ * Plain text patterns of log messages that should be omitted.
37
+ * Env: `NUXT_SPEC_MESSAGE_FILTERS` (comma-separated, added to values from nuxt.config.ts)
38
+ */
39
+ messageFilters?: string[]
40
+ }
41
+
42
+ export interface ResolvedNuxtSpecOptions {
43
+ hints: boolean
44
+ externalPlaywright: string | undefined
45
+ htmlReport: {
46
+ enabled: boolean
47
+ open: HtmlReportOpenMode
48
+ }
49
+ messageFilters: string[]
50
+ }
51
+
52
+ export declare const NUXT_SPEC_DEFAULTS: ResolvedNuxtSpecOptions
53
+
54
+ export declare function resolveSpecOptions(
55
+ fromConfig?: NuxtSpecOptions | false | null,
56
+ env?: Record<string, string | undefined>,
57
+ ): ResolvedNuxtSpecOptions
58
+
59
+ export declare function loadSpecOptions(cwd?: string): Promise<ResolvedNuxtSpecOptions>