Skip to content

Commit 6fc6a94

Browse files
Copilotrenemadsen
andcommitted
Add solution for missing styles.scss and theme.scss errors
Co-authored-by: renemadsen <[email protected]>
1 parent be91b15 commit 6fc6a94

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

PACKAGE_JSON_SETUP.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,87 @@ npm run test:ci -- --include='**/time-planning-pn/**/*.spec.ts'
534534
npm run test -- --watch=false --browsers=ChromeHeadless
535535
```
536536

537+
538+
### Issue 5: "Can't resolve 'src/styles.scss'" or "Can't resolve 'src/theme.scss'"
539+
540+
**Error messages:**
541+
```
542+
Error: Can't resolve 'src/styles.scss' in '/path/to/eform-client'
543+
Error: Can't resolve 'src/theme.scss' in '/path/to/eform-client'
544+
ERROR [karma-server]: Error: Found 1 load error
545+
```
546+
547+
**Cause:** The Angular configuration references style files that don't exist or aren't needed for running tests. This typically happens when `angular.json` specifies global styles that aren't present in the repository.
548+
549+
**Solution - Option A: Create Placeholder Files (Quick Fix)**
550+
551+
If these files are referenced but not needed for tests, create empty placeholders:
552+
553+
```bash
554+
cd eform-client
555+
touch src/styles.scss
556+
touch src/theme.scss
557+
```
558+
559+
**Solution - Option B: Update angular.json (Recommended)**
560+
561+
Modify the test configuration in `angular.json` to exclude missing style files:
562+
563+
```json
564+
{
565+
"projects": {
566+
"your-project-name": {
567+
"architect": {
568+
"test": {
569+
"options": {
570+
"styles": [],
571+
"scripts": []
572+
}
573+
}
574+
}
575+
}
576+
}
577+
}
578+
```
579+
580+
If you have existing style files that should be included, reference only those:
581+
582+
```json
583+
{
584+
"projects": {
585+
"your-project-name": {
586+
"architect": {
587+
"test": {
588+
"options": {
589+
"styles": [
590+
"src/styles.css" // Only include files that exist
591+
],
592+
"scripts": []
593+
}
594+
}
595+
}
596+
}
597+
}
598+
}
599+
```
600+
601+
**Solution - Option C: Update karma.conf.js**
602+
603+
Alternatively, you can configure Karma to ignore missing files by updating the `preprocessors` section in `karma.conf.js`:
604+
605+
```javascript
606+
module.exports = function (config) {
607+
config.set({
608+
// ... other config
609+
files: [
610+
// Only include files that exist
611+
],
612+
preprocessors: {
613+
// Add preprocessors only for existing files
614+
}
615+
});
616+
};
617+
```
537618
## Contact
538619

539620
If you need help configuring the tests, check:

0 commit comments

Comments
 (0)