Angular 使用 Jasmine 和 Karma 获取 - 不完整:未找到规范,但将 spec.ts 文件转换为 spec.js 时出现错误加载期间错误:未捕获语法错误:无法在模块外部使用 import 语句
我的 Karma 配置文件
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: "",
frameworks: ["jasmine", "@angular-devkit/build-angular"],
plugins: [
require("karma-jasmine"),
require("karma-chrome-launcher"),
require("karma-jasmine-html-reporter"),
require("karma-coverage-istanbul-reporter"),
require("@angular-devkit/build-angular/plugins/karma"),
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: ["html", "lcovonly"],
fixWebpackSourcePaths: true,
},
files: ["src/**/*.spec.js"],
include: ["src/**/*.spec.js"],
angularCli: {
environment: "dev",
},
reporters: ["progress", …Run Code Online (Sandbox Code Playgroud)