We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parseModule
$ node -v v18.17.1 $ pnpm -v 8.7.5 $ cat package.json | grep magicast "magicast": "^0.3.1",
import { parseModule } from "magicast"; const mod = parseModule(` export default defineConfig({ test: { thisIsOk: { key: 111, }, "thisIsBroken": { key: 222, }, 'thisIsAlsoBroken': { key: 333, }, }, }); `); const options = mod.exports.default.$type === "function-call" ? mod.exports.default.$args[0] : mod.exports.default; console.log("test.thisIsOk", options.test.thisIsOk?.key); // ✅ console.log("test.thisIsBroken", options.test.thisIsBroken?.key); // ❌ console.log("test.thisIsAlsoBroken", options.test.thisIsAlsoBroken?.key); // ❌ // Let's see if quotes are included in key names... console.log("test.thisIsBroken#2", options.test['"thisIsBroken"']?.key); // ❌ console.log("test.thisIsAlsoBroken#2", options.test["'thisIsAlsoBroken'"]?.key); // ❌
test.thisIsOk 111 test.thisIsBroken undefined test.thisIsAlsoBroken undefined test.thisIsBroken#2 undefined test.thisIsAlsoBroken#2 undefined
It's not possible to access object properties that have quotes in their property names. Properties without quotes work fine.
In my use-case object properties can be glob-patterns so they need to be wrapped. Object keys like "**/utils/**" must be wrapped:
"**/utils/**"
import { defineConfig } from "vitest/config"; export default defineConfig({ test: { coverage: { thresholds: { // Thresholds for all files lines: 100, functions: 100, branches: 80, statements: 90, // Thresholds for utilities "**/utils/**": { lines: 80, statements: 50, }, }, }, }, });
vitest-dev/vitest#4442
No response
The text was updated successfully, but these errors were encountered:
test: failing test case for unjs#93
a71d7ea
ObjectExpression
Successfully merging a pull request may close this issue.
Environment
Reproduction
Describe the bug
It's not possible to access object properties that have quotes in their property names. Properties without quotes work fine.
In my use-case object properties can be glob-patterns so they need to be wrapped. Object keys like
"**/utils/**"
must be wrapped:Additional context
vitest-dev/vitest#4442
Logs
No response
The text was updated successfully, but these errors were encountered: