web
web copied to clipboard
Web Test Runner TypeError: Failed to fetch dynamically imported module
Using Angular CLI 17.3.7 version
Steps
Inside the package.json file
"scripts":{
"test:wt": "web-test-runner --config projects/project1/web-test-runner.config.mjs"
}
Install "@web/test-runner": "0.18.0"
web-test-runner.config.mjs Code export default{ files:' projects/project1/src/**/*.spec.ts', nodeResolve:true };
While running inside the terminal by this command npm run test:wt getting error below.
Browser logs: TypeError: Failed to fetch dynamically imported module:http://localhost:8000/src/app/test.spec.ts Could not import your test module . Check the browser logs or open the browser in debug mode Error while running tests.
I can not get web-test-runner to get work and I am not sure where the fault lies.
Please note that .ts files are not supported by default, you can enable them with esbuild plugin:
import { esbuildPlugin } from '@web/dev-server-esbuild';
export default{
files: 'projects/project1/src/**/*.spec.ts',
nodeResolve:true,
plugins: [esbuildPlugin({ ts: true })],
};