-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
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
LIT decorators #8
Comments
@Anmo thanks again for creating the issue! Does the Vite Babel plugin works for you?: https://www.npmjs.com/package/vite-plugin-babel import { defineConfig } from '@sand4rt/experimental-ct-web';
import babel from 'vite-plugin-babel';
export default defineConfig({
use: {
ctViteConfig: {
plugins: [
babel({
babelConfig: { plugins: ['@babel/plugin-proposal-decorators'] }
})
]
},
},
}); |
I will try this, hope today, and report back, anyway, thanks for the fast reply :) |
I assume this has been resolved. Feel free to create a new issue when needed. |
@sand4rt
The code can be found here: https://github.com/NicoVogel/nx-lit-vite/tree/feat/playwright-component-testing But here are the relevant snippets: // my-component.ts
@customElement('my-component')
export class MyComponent extends LitElement {
// ...
} /// <reference types="vitest" />
import { defineConfig, devices } from '@sand4rt/experimental-ct-web';
import babel from 'vite-plugin-babel'
export default defineConfig({
testDir: 'src',
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
reporter: 'html',
use: {
trace: 'on-first-retry',
ctViteConfig: {
// https://babeljs.io/docs/babel-plugin-proposal-decorators
// https://stackoverflow.com/questions/66032589/the-decorators-plugin-requires-a-decoratorsbeforeexport-option
plugins: [
babel({
babelConfig: {
plugins: ['@babel/plugin-proposal-decorators', {version: "legacy"}]
}
})
]
}
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
],
}); I already tried to fix it with passing the custom babel config, but it does not seem to care when I change these settings... |
@NicoVogel thanks for reporting. I think this has something to do with your monorepo / nx setup. It works as expected when i:
It seems that the components are not being built when the tests are executed with nx, hence you see the error about the decorators :/ |
Hi,
I was trying the experimental playwright with your web components implementation, but I got some errors regarding decorators
Is there a way to specify a babel plugin in the configuration? Or should this modules do it by default?
The text was updated successfully, but these errors were encountered: