diff --git a/.github/workflows/test-env.yml b/.github/workflows/test-env.yml
index 9e26bf33f..6b95411a8 100644
--- a/.github/workflows/test-env.yml
+++ b/.github/workflows/test-env.yml
@@ -7,8 +7,8 @@ on:
jobs:
- test-env:
- name: Test Environments
+ test-tsc-env:
+ name: Test TypeScript Environments
runs-on: ubuntu-latest
@@ -53,3 +53,34 @@ jobs:
- name: Run tests
run: npm test
+ test-angular:
+ name: Test Angular Environments
+
+ runs-on: ubuntu-latest
+
+ env:
+ npm_config_registry: http://localhost:8043
+
+ steps:
+ - name: Use Node.js
+ uses: actions/setup-node@v1
+ with:
+ node-version: 18.x
+
+ - name: Checkout repository
+ uses: actions/checkout@v3
+ with:
+ path: "faux_modules/ethers"
+
+ - name: Copy tests to working directory
+ run: cp faux_modules/ethers/testcases/test-env/angular/* .
+
+ - name: Install and run Faux Registry
+ uses: ethers-io/hijack-npm-action@main
+
+ - name: Install packages
+ run: npm install
+
+ - name: Build project
+ run: npm run build
+
diff --git a/testcases/test-env/angular/README.md b/testcases/test-env/angular/README.md
new file mode 100644
index 000000000..07c2f0c42
--- /dev/null
+++ b/testcases/test-env/angular/README.md
@@ -0,0 +1,27 @@
+# Test
+
+This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.4.
+
+## Development server
+
+Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.
+
+## Code scaffolding
+
+Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
+
+## Build
+
+Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
+
+## Running unit tests
+
+Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
+
+## Running end-to-end tests
+
+Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
+
+## Further help
+
+To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
diff --git a/testcases/test-env/angular/angular.json b/testcases/test-env/angular/angular.json
new file mode 100644
index 000000000..b37b543b0
--- /dev/null
+++ b/testcases/test-env/angular/angular.json
@@ -0,0 +1,98 @@
+{
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
+ "version": 1,
+ "newProjectRoot": "projects",
+ "projects": {
+ "test": {
+ "projectType": "application",
+ "schematics": {},
+ "root": "",
+ "sourceRoot": "src",
+ "prefix": "app",
+ "architect": {
+ "build": {
+ "builder": "@angular-devkit/build-angular:browser",
+ "options": {
+ "outputPath": "dist/test",
+ "index": "src/index.html",
+ "main": "src/main.ts",
+ "polyfills": [
+ "zone.js"
+ ],
+ "tsConfig": "tsconfig.app.json",
+ "assets": [
+ "src/favicon.ico",
+ "src/assets"
+ ],
+ "styles": [
+ "src/styles.css"
+ ],
+ "scripts": []
+ },
+ "configurations": {
+ "production": {
+ "budgets": [
+ {
+ "type": "initial",
+ "maximumWarning": "500kb",
+ "maximumError": "1mb"
+ },
+ {
+ "type": "anyComponentStyle",
+ "maximumWarning": "2kb",
+ "maximumError": "4kb"
+ }
+ ],
+ "outputHashing": "all"
+ },
+ "development": {
+ "buildOptimizer": false,
+ "optimization": false,
+ "vendorChunk": true,
+ "extractLicenses": false,
+ "sourceMap": true,
+ "namedChunks": true
+ }
+ },
+ "defaultConfiguration": "production"
+ },
+ "serve": {
+ "builder": "@angular-devkit/build-angular:dev-server",
+ "configurations": {
+ "production": {
+ "browserTarget": "test:build:production"
+ },
+ "development": {
+ "browserTarget": "test:build:development"
+ }
+ },
+ "defaultConfiguration": "development"
+ },
+ "extract-i18n": {
+ "builder": "@angular-devkit/build-angular:extract-i18n",
+ "options": {
+ "browserTarget": "test:build"
+ }
+ },
+ "test": {
+ "builder": "@angular-devkit/build-angular:karma",
+ "options": {
+ "polyfills": [
+ "zone.js",
+ "zone.js/testing"
+ ],
+ "tsConfig": "tsconfig.spec.json",
+ "assets": [
+ "src/favicon.ico",
+ "src/assets"
+ ],
+ "styles": [
+ "src/styles.css"
+ ],
+ "scripts": []
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/testcases/test-env/angular/package.json b/testcases/test-env/angular/package.json
new file mode 100644
index 000000000..28fe9513f
--- /dev/null
+++ b/testcases/test-env/angular/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "test",
+ "version": "0.0.0",
+ "scripts": {
+ "ng": "ng",
+ "start": "ng serve",
+ "build": "ng build",
+ "watch": "ng build --watch --configuration development",
+ "test": "ng test"
+ },
+ "private": true,
+ "dependencies": {
+ "@angular/animations": "^15.2.0",
+ "@angular/common": "^15.2.0",
+ "@angular/compiler": "^15.2.0",
+ "@angular/core": "^15.2.0",
+ "@angular/forms": "^15.2.0",
+ "@angular/platform-browser": "^15.2.0",
+ "@angular/platform-browser-dynamic": "^15.2.0",
+ "@angular/router": "^15.2.0",
+ "ethers": "^6.3.0",
+ "rxjs": "~7.8.0",
+ "tslib": "^2.3.0",
+ "zone.js": "~0.12.0"
+ },
+ "devDependencies": {
+ "@angular-devkit/build-angular": "^15.2.4",
+ "@angular/cli": "~15.2.4",
+ "@angular/compiler-cli": "^15.2.0",
+ "@types/jasmine": "~4.3.0",
+ "jasmine-core": "~4.5.0",
+ "karma": "~6.4.0",
+ "karma-chrome-launcher": "~3.1.0",
+ "karma-coverage": "~2.2.0",
+ "karma-jasmine": "~5.1.0",
+ "karma-jasmine-html-reporter": "~2.0.0",
+ "typescript": "~4.9.4"
+ }
+}
diff --git a/testcases/test-env/angular/src/app/app.component.css b/testcases/test-env/angular/src/app/app.component.css
new file mode 100644
index 000000000..e69de29bb
diff --git a/testcases/test-env/angular/src/app/app.component.html b/testcases/test-env/angular/src/app/app.component.html
new file mode 100644
index 000000000..a5fd7ef11
--- /dev/null
+++ b/testcases/test-env/angular/src/app/app.component.html
@@ -0,0 +1,7 @@
+
+
Ethers v6 get network test
+
+
+
+
Network: {{ network.name }}
+
diff --git a/testcases/test-env/angular/src/app/app.component.spec.ts b/testcases/test-env/angular/src/app/app.component.spec.ts
new file mode 100644
index 000000000..a3a72a72a
--- /dev/null
+++ b/testcases/test-env/angular/src/app/app.component.spec.ts
@@ -0,0 +1,31 @@
+import { TestBed } from '@angular/core/testing';
+import { AppComponent } from './app.component';
+
+describe('AppComponent', () => {
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [
+ AppComponent
+ ],
+ }).compileComponents();
+ });
+
+ it('should create the app', () => {
+ const fixture = TestBed.createComponent(AppComponent);
+ const app = fixture.componentInstance;
+ expect(app).toBeTruthy();
+ });
+
+ it(`should have as title 'test'`, () => {
+ const fixture = TestBed.createComponent(AppComponent);
+ const app = fixture.componentInstance;
+ expect(app.title).toEqual('test');
+ });
+
+ it('should render title', () => {
+ const fixture = TestBed.createComponent(AppComponent);
+ fixture.detectChanges();
+ const compiled = fixture.nativeElement as HTMLElement;
+ expect(compiled.querySelector('.content span')?.textContent).toContain('test app is running!');
+ });
+});
diff --git a/testcases/test-env/angular/src/app/app.component.ts b/testcases/test-env/angular/src/app/app.component.ts
new file mode 100644
index 000000000..e709a2bf1
--- /dev/null
+++ b/testcases/test-env/angular/src/app/app.component.ts
@@ -0,0 +1,47 @@
+// See: https://github.com/ethers-io/ethers.js/issues/3910
+
+import { Component } from '@angular/core';
+import { ethers } from 'ethers';
+
+declare global {
+ interface Window {
+ ethereum: any;
+ }
+}
+
+@Component({
+ selector: 'app-root',
+ templateUrl: './app.component.html',
+ styleUrls: ['./app.component.css']
+})
+export class AppComponent {
+ title = 'test';
+ network?: ethers.Network;
+
+ async connect() {
+
+ if (window.ethereum == null) {
+ // If MetaMask is not installed, we use the default provider,
+ // which is backed by a variety of third-party services (such
+ // as INFURA). They do not have private keys installed so are
+ // only have read-only access
+ console.log('MetaMask not installed; using read-only defaults');
+ } else {
+ // Connect to the MetaMask EIP-1193 object. This is a standard
+ // protocol that allows Ethers access to make all read-only
+ // requests through MetaMask.
+ const provider = new ethers.BrowserProvider(window.ethereum);
+
+ const accounts = await window.ethereum.request({
+ method: 'eth_requestAccounts',
+ });
+
+ console.log('accounts: ', accounts);
+ // It also provides an opportunity to request access to write
+ // operations, which will be performed by the private key
+ // that MetaMask manages for the user.
+ this.network = await provider.getNetwork();
+ }
+ }
+
+}
diff --git a/testcases/test-env/angular/src/app/app.module.ts b/testcases/test-env/angular/src/app/app.module.ts
new file mode 100644
index 000000000..8dfc1d682
--- /dev/null
+++ b/testcases/test-env/angular/src/app/app.module.ts
@@ -0,0 +1,16 @@
+import { NgModule } from '@angular/core';
+import { BrowserModule } from '@angular/platform-browser';
+
+import { AppComponent } from './app.component';
+
+@NgModule({
+ declarations: [
+ AppComponent
+ ],
+ imports: [
+ BrowserModule
+ ],
+ providers: [],
+ bootstrap: [AppComponent]
+})
+export class AppModule { }
diff --git a/testcases/test-env/angular/src/assets/.gitkeep b/testcases/test-env/angular/src/assets/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/testcases/test-env/angular/src/favicon.ico b/testcases/test-env/angular/src/favicon.ico
new file mode 100644
index 000000000..997406ad2
Binary files /dev/null and b/testcases/test-env/angular/src/favicon.ico differ
diff --git a/testcases/test-env/angular/src/index.html b/testcases/test-env/angular/src/index.html
new file mode 100644
index 000000000..8a2f31723
--- /dev/null
+++ b/testcases/test-env/angular/src/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+ Test
+
+
+
+
+
+
+
+
diff --git a/testcases/test-env/angular/src/main.ts b/testcases/test-env/angular/src/main.ts
new file mode 100644
index 000000000..c58dc05cb
--- /dev/null
+++ b/testcases/test-env/angular/src/main.ts
@@ -0,0 +1,7 @@
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+
+import { AppModule } from './app/app.module';
+
+
+platformBrowserDynamic().bootstrapModule(AppModule)
+ .catch(err => console.error(err));
diff --git a/testcases/test-env/angular/src/styles.css b/testcases/test-env/angular/src/styles.css
new file mode 100644
index 000000000..90d4ee007
--- /dev/null
+++ b/testcases/test-env/angular/src/styles.css
@@ -0,0 +1 @@
+/* You can add global styles to this file, and also import other style files */
diff --git a/testcases/test-env/angular/tsconfig.app.json b/testcases/test-env/angular/tsconfig.app.json
new file mode 100644
index 000000000..374cc9d29
--- /dev/null
+++ b/testcases/test-env/angular/tsconfig.app.json
@@ -0,0 +1,14 @@
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "outDir": "./out-tsc/app",
+ "types": []
+ },
+ "files": [
+ "src/main.ts"
+ ],
+ "include": [
+ "src/**/*.d.ts"
+ ]
+}
diff --git a/testcases/test-env/angular/tsconfig.json b/testcases/test-env/angular/tsconfig.json
new file mode 100644
index 000000000..ed966d43a
--- /dev/null
+++ b/testcases/test-env/angular/tsconfig.json
@@ -0,0 +1,33 @@
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
+{
+ "compileOnSave": false,
+ "compilerOptions": {
+ "baseUrl": "./",
+ "outDir": "./dist/out-tsc",
+ "forceConsistentCasingInFileNames": true,
+ "strict": true,
+ "noImplicitOverride": true,
+ "noPropertyAccessFromIndexSignature": true,
+ "noImplicitReturns": true,
+ "noFallthroughCasesInSwitch": true,
+ "sourceMap": true,
+ "declaration": false,
+ "downlevelIteration": true,
+ "experimentalDecorators": true,
+ "moduleResolution": "node",
+ "importHelpers": true,
+ "target": "ES2022",
+ "module": "ES2022",
+ "useDefineForClassFields": false,
+ "lib": [
+ "ES2022",
+ "dom"
+ ]
+ },
+ "angularCompilerOptions": {
+ "enableI18nLegacyMessageIdFormat": false,
+ "strictInjectionParameters": true,
+ "strictInputAccessModifiers": true,
+ "strictTemplates": true
+ }
+}
diff --git a/testcases/test-env/angular/tsconfig.spec.json b/testcases/test-env/angular/tsconfig.spec.json
new file mode 100644
index 000000000..be7e9da76
--- /dev/null
+++ b/testcases/test-env/angular/tsconfig.spec.json
@@ -0,0 +1,14 @@
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "outDir": "./out-tsc/spec",
+ "types": [
+ "jasmine"
+ ]
+ },
+ "include": [
+ "src/**/*.spec.ts",
+ "src/**/*.d.ts"
+ ]
+}