Replies: 14 comments
-
I've run into a similar issue also in another repo. Did some digging here and it has something to do with the bundling of
If you go into the |
Beta Was this translation helpful? Give feedback.
-
@brandonroberts thanks will try this, by the way thanks for the plugin great job ^_^ |
Beta Was this translation helpful? Give feedback.
-
Found a workaround. /// <reference types="vitest" />
import { defineConfig } from 'vite';
import angular from '@analogjs/vite-plugin-angular';
export default defineConfig(({ mode }) => ({
plugins: [angular()],
test: {
globals: true,
setupFiles: ['src/test-setup.ts'],
environment: 'happy-dom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
server: {
deps: {
inline: [/fesm2022/]
}
}
},
define: {
'import.meta.vitest': mode !== 'production',
},
})); We're already doing this internally but only for cdk/fesm libraries because it slows down running the tests. |
Beta Was this translation helpful? Give feedback.
-
@brandonroberts wow this works for me, is this just a work around if using |
Beta Was this translation helpful? Give feedback.
-
@aelbore not sure if its only needed for rxjs 6.x because our tests are running fine without it on RxJS 7.x. Maybe it surfaced as a result of switching to ESM. I may add it as a config option because of the performance cost, but I'd prefer to not include it by default. |
Beta Was this translation helpful? Give feedback.
-
I ran into this error as well with RxJs 7.x. The workaround works for me. |
Beta Was this translation helpful? Give feedback.
-
What version of RxJS was it? |
Beta Was this translation helpful? Give feedback.
-
It is 7.8.1, this is the repo https://github.com/ahnpnl/monorepo-multi-apps To reproduce:
|
Beta Was this translation helpful? Give feedback.
-
Thanks. If you downlevel the // apps/ng-app/tsconfig.spec.json /* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"target": "es2016",
"types": ["node", "vitest/globals"]
},
"files": ["test/Framework/testSetup.ts"],
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
} // apps/ng-app/vitest.config.mts
import angular from '@analogjs/vite-plugin-angular';
import { defineConfig } from 'vite';
export default defineConfig(() => ({
plugins: [
angular(),
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['test/Framework/testSetup.ts'],
include: ['test/**/*.spec.ts'],
passWithNoTests: true,
},
})); |
Beta Was this translation helpful? Give feedback.
-
It also works by just adding |
Beta Was this translation helpful? Give feedback.
-
Among these workarounds, do they have the same root cause about switching to ESM like being mentioned above? |
Beta Was this translation helpful? Give feedback.
-
Yes, using ESM requires the file extensions and unless the angular libraries are transformed/inlined, it won't convert the import paths to include the extension. |
Beta Was this translation helpful? Give feedback.
-
Reading about downside of specifying inline dep above impacts the performance, we have 2 other workarounds: downleveling target vs including setup file in tsconfig, which one would be easier to understand for devs in your opinion? For me:
Is there something analogjs can do to warn users about this? |
Beta Was this translation helpful? Give feedback.
-
I think including the setup file in the tsconfig is the most straightforward path. We include a downleveled tsconfig with the application templates by default. Past that, I think the performance hit should be an opt-in that could be a flag or explained in the docs. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Please provide the environment you discovered this bug in.
stackblitz
https://stackblitz.com/edit/stackblitz-starters-yjhfgh
Just download and run it locally
Which area/package is the issue in?
vite-plugin-angular
Description
when running the test it has "Error: EISDIR: illegal operation on a directory" error.
when using "happy-dom" and "jsdom" with "[email protected]"
it works fine if
Note: not too sure if this is analogjs issue or with vite/vitest
Please provide the exception or error you saw
Other information
No response
I would be willing to submit a PR to fix this issue
Beta Was this translation helpful? Give feedback.
All reactions