小编Max*_*rav的帖子

Angular:仅在 ng build --prod 上构建 ES2015

我希望生产构建输出只产生 ES2015 构建而不是 ES5 构建。

我正在使用带有常春藤渲染引擎的 Angular 8。

我还附上了我的angular.json、browserslist、tsconfig.json文件。

angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "front-end-inventory": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss"
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/front-end-inventory",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "aot": true,
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/manifest.webmanifest",
              "src/.htaccess"
            ],
            "styles": [
              "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
              "src/styles.scss"
            ],
            "scripts": [
              "./node_modules/jquery/dist/jquery.slim.min.js"
            ]
          },
          "configurations": {
            "production": { …
Run Code Online (Sandbox Code Playgroud)

javascript typescript ecmascript-6 angular-cli angular

16
推荐指数
1
解决办法
1万
查看次数

Laravel:在列中使用布尔值创建的工厂无法通过 mysql 数据库中的assertDatabaseHas 测试用例

问题

我的表示包含 has_value 和 has_condition 列,它们是由 laravel 在 MySQL 中创建的布尔类型。在示例表的 Factory 中,我将 faker 值设置为布尔值。在测试用例中,我已经按原样传递了 faker 值。laravel 正确存储该值,但使用assertDatabaseHas 的测试用例失败,因为MySQL 将值存储为数值,但伪造者提供了布尔值。

设置

移民

Schema::create('sample', function (Blueprint $table) {
   $table->unsignedBigInteger();
   $table->boolean('has_value')->default(false);
   $table->boolean('has_condition')->default(false);
});
Run Code Online (Sandbox Code Playgroud)

模型

class Sample extends Model {
  
   /**
     * The attributes that aren't mass assignable.
     *
     * @var array
     */
    protected $guarded = ['id', 'created_at', 'updated_at'];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'has_condition' …
Run Code Online (Sandbox Code Playgroud)

php mysql phpunit laravel

5
推荐指数
1
解决办法
4996
查看次数