-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Describe the bug
I've been using vitest to develop nuxt modules so far.
I have changed the code in this PR without changing the code around dependencies and imports. However, when I run the tests, the tests are now failing in CI with the following error code:
TypeError: generateJSON is not a function
❯ generateVueI18nOptions src/gen.ts:183:11
181| for (const [locale, localeMessages] of Object.entries(value)) {
182| genCode += `${JSON.stringify(locale)}:${
183| generateJSON(JSON.stringify(localeMessages), { type: 'bare', env: dev ? 'development' : 'production' }).code
| ^
184| },`
185| }
❯ src/gen.ts:90:37
❯ Module.generateLoaderOptions src/gen.ts:82:41
❯ test/gen.test.ts:91:16
It seems that the code I imported is undefined
.
I noticed this issue in CI.
Additional info:
- PR: fix: cannot resolve langDir path for locales file path nuxt-modules/i18n#1846
- error: https://github.com/nuxt-modules/i18n/actions/runs/4114230933/jobs/7101340300
Reproduction
Unfortunately, I could not reproduce with minimal codes, but We can reproduce realworld code.
repo: https://github.com/nuxt-modules/i18n
reproduction step:
git clone [email protected]:nuxt-modules/i18n.git
git checkout fix/1834
pnpm install
pnpm test:unit
So, you can face issue.
By the way, if we do pnpm test:unit
again, the test works correctly.
System Info
System:
OS: macOS 13.1
CPU: (10) arm64 Apple M1 Max
Memory: 86.55 MB / 64.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.19.0 - ~/.nvm/versions/node/v16.19.0/bin/node
Browsers:
Chrome: 109.0.5414.119
Firefox: 109.0
Safari: 16.2
npmPackages:
vitest: ^0.26.2 => 0.26.2
Used Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
No labels