Skip to content

build: create ng add integration test using ng new #27096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration/ng-add-standalone/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function (config) {
// Chrome cannot run with sandbox enabled as this test already runs within
// the Bazel sandbox environment and the sandboxes would conflict otherwise.
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
singleRun: true,
restartOnFileChange: true,
});
};
16 changes: 0 additions & 16 deletions integration/ng-add/.browserslistrc

This file was deleted.

16 changes: 0 additions & 16 deletions integration/ng-add/.editorconfig

This file was deleted.

45 changes: 0 additions & 45 deletions integration/ng-add/.gitignore

This file was deleted.

19 changes: 19 additions & 0 deletions integration/ng-add/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ npmPackageMappings = dicts.add(
},
)

# Name of the generated app.
APP_NAME = "ng-add"

node_integration_test(
name = "test",
srcs = glob(["**/*"]),
Expand All @@ -19,6 +22,22 @@ node_integration_test(
# See: https://github.com/yarnpkg/yarn/issues/2165.
# TODO(devversion): determine if a solution/workaround could live in the test runner.
"yarn install --cache-folder .yarn_cache_folder/",

# Generate a new project with the default options.
# Skip installation since we installed the dependencies already.
"yarn ng new --defaults --skip-install --style=scss --name=%s" % APP_NAME,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, potentially we can make this a shared script if we end up duplicating these steps multiple times.

# Delete the package.json that the CLI generated since we want to use the existing one.
"rm -f %s/package.json" % APP_NAME,
# Delete the Karma config since we need to use a headless browser.
"rm -f %s/karma.conf.js" % APP_NAME,
# We can't name the checked-in config `angular.json`, because the CLI doesn't allow
# `ng new` to run in a directory that has an `angular.json` already.
"mv _angular.json angular.json",
# Delete the angular.json since we have a specific config for the test.
"rm -f %s/angular.json" % APP_NAME,
# Move the generated project one level up so it can reuse the package.json and node_modules.
"mv %s/* ." % APP_NAME,
# Install Material and run the unit tests.
"yarn ng add @angular/material",
"yarn test",
],
Expand Down
27 changes: 0 additions & 27 deletions integration/ng-add/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"outputPath": "dist/ng-add",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
Expand All @@ -44,12 +44,6 @@
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
Expand Down Expand Up @@ -84,15 +78,13 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles.scss"],
"scripts": [],
"watch": false
"scripts": []
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion integration/ng-add/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function (config) {
// Chrome cannot run with sandbox enabled as this test already runs within
// the Bazel sandbox environment and the sandboxes would conflict otherwise.
browsers: ['ChromeHeadlessNoSandbox'],
singleRun: false,
singleRun: true,
restartOnFileChange: true,
});
};
10 changes: 0 additions & 10 deletions integration/ng-add/src/app/app-routing.module.ts

This file was deleted.

Loading