infra frontendTesting: tsconfig.test.json doesn't work in a standalone extension, and webpack.config.js is left behind
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
Research direction
Start with the frontendTesting module definition in src/steps/gen-ext-scaffolder.ts and inspect the generated tsconfig.test.json, webpack.config.cjs, and js/package.json. Compare the generated TypeScript includes and shim path with the standalone extension setup described in the issue, and check how the generator handles the old webpack config. Done means a standalone extension gets working test type-checking, only the intended webpack config, and a focused package file diff.
Written by the indexing model from the issue text.
Description
Running flarum-cli infra frontendTesting -n (3.0.15) on an existing standalone (Composer-installed) Flarum 2 extension gives a setup where yarn test runs, but the tests don't type-check and an old file is left behind:
js/tsconfig.test.jsonpoints at the monorepo'snode_modules."files": ["../../../node_modules/@flarum/jest-config/shims.d.ts"]only resolves inside flarum/framework. In a standalone extension it should be./node_modules/@flarum/jest-config/shims.d.ts, as the testing docs show.js/tsconfig.test.jsonreplaces the baseincludewith["tests/**/*"]. Tests that import the extension'ssrcthen lose core's global typings (../vendor/*/*/js/dist-typings/@types/**/*) and the extension's own declaration files.tsc -p tsconfig.test.json --noEmitfails withCannot find name 'm',Cannot find name 'flarum', and errors on model attributes added through declaration merging. Repeating the baseincludewithtestsadded fixes it:"include": ["src/**/*", "tests/**/*", "../vendor/*/*/js/dist-typings/@types/**/*", "@types/**/*"],js/webpack.config.jsis left in place next to the newjs/webpack.config.cjs. The module adds the.cjsfile (needed now that"type": "module"is set) but doesn't remove the.jsone, which the docs say to rename.- Minor:
js/package.jsonis rewritten with 4-space indentation, so the whole file shows up in the diff.
3.x has the same skeleton tsconfig.test.json and the same frontendTesting module definition in src/steps/gen-ext-scaffolder.ts.
- Dominant language
- TypeScript
- Stars
- 47
- Forks
- 4
- Avg merge
- 8m
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from flarum/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 3/5 1-2 days Newbie friendliness 20/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ranxianglei/billion-context#7597 ·
Maintainers usually reply within 1 day
-
kubernetes-ingestor: fetchCRDMapping() runs even when crossplane.enabled is false, logging a 403 ERROR every runPossibly taken @kc9ddi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
TeraSky-OSS/backstage-plugins#228 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
zmkfirmware/zmk#3571 ·
Maintainers usually reply within 10 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPossibly taken @lijy91 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
libnativeapi/nativeapi#53 · 1 reaction ·
Maintainers usually reply within 1 day