Reputation: 1892
Have explored everywhere but hasn't find a reliable way to solve it, so decided to post a question.
When running in Angular 15, everything works fine; but once upgraded to Angular 17, it detects none unit test and says "Executed 0 of 0 SUCCESS".
Before that message, I also got the following error message. Perhaps the are relevant.
node:fs/promises - Error: Module build failed: UnhandledSchemeError: Reading from "node:fs/promises" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
node:fs - Error: Module build failed: UnhandledSchemeError: Reading from "node:fs" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
node:path - Error: Module build failed: UnhandledSchemeError: Reading from "node:path" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
node:url - Error: Module build failed: UnhandledSchemeError: Reading from "node:url" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
I have created a new and separated Angular 17 project to compare the configuration, but nothing seems to be obviously different. The unit tests themselves can be detected in the new project so they should be fine.
Posting some configuration code here. Also let me know if any further information is needed.
karma.conf.js:
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
'karma-jasmine',
'karma-chrome-launcher',
'karma-jasmine-html-reporter',
'karma-coverage',
'karma-junit-reporter',
'@angular-devkit/build-angular/plugins/karma'
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage'),
type: 'lcov',
subdir: '.',
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true,
check: {
global: {
statements: 80,
branches: 80,
functions: 80,
lines: 80
}
}
},
reporters: ['progress', 'junit', 'kjhtml','coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromiumHeadless',
flags: ['--no-sandbox']
}
},
junitReporter : {
outputDir : './junit/test-reports'
},
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
The "test" section in angular.json:
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"codeCoverage": true,
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.webmanifest"
],
"styles": [
"src/styles.scss",
"src/styles/spartacus/storefinder.scss",
"src/styles/spartacus/user.scss",
"src/styles/spartacus/qualtrics-embedded-feedback.scss",
"src/styles/spartacus/product.scss",
"src/styles/spartacus/pdf-invoices.scss"
],
"scripts": []
}
},
Upvotes: 1
Views: 330
Reputation: 108
Angular behaves weird sometimes after an upgrade, have you tried closing the editor ,(maybe even as far as restarting), then running ng test again
Upvotes: 0