create-analog 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template-angular-v14/README.md +5 -1
- package/template-angular-v14/angular.json +1 -0
- package/template-angular-v14/package.json +4 -2
- package/template-angular-v14/src/app/app.component.spec.ts +5 -5
- package/template-angular-v14/src/test.ts +4 -18
- package/template-angular-v14/tsconfig.spec.json +3 -11
- package/template-angular-v14/vite.config.ts +17 -3
package/package.json
CHANGED
|
@@ -14,7 +14,11 @@ Run `yarn dev` for a dev server. Navigate to `http://localhost:3000/`. The appli
|
|
|
14
14
|
|
|
15
15
|
Run `yarn build` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
16
16
|
|
|
17
|
+
## Test
|
|
18
|
+
|
|
19
|
+
Run `yarn test` to run unit tests with [Vitest](https://vitest.dev).
|
|
20
|
+
|
|
17
21
|
## Community
|
|
18
22
|
|
|
19
23
|
- Join the [Discord](https://discord.gg/mKC2Ec48U5)
|
|
20
|
-
- Visit the [GitHub Repo](https://github.com/analogjs/analog)
|
|
24
|
+
- Visit and Star the [GitHub Repo](https://github.com/analogjs/analog)
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"start": "npm run dev",
|
|
8
8
|
"build": "vite build",
|
|
9
9
|
"watch": "vite build --watch",
|
|
10
|
-
"test": "
|
|
10
|
+
"test": "vitest",
|
|
11
11
|
"postinstall": "vite optimize"
|
|
12
12
|
},
|
|
13
13
|
"private": true,
|
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
"@angular-devkit/build-angular": "^14.0.3",
|
|
30
30
|
"@angular/cli": "~14.0.3",
|
|
31
31
|
"@angular/compiler-cli": "^14.0.0",
|
|
32
|
+
"jsdom": "^20.0.0",
|
|
32
33
|
"typescript": "~4.7.2",
|
|
33
|
-
"vite": "^2.9.13"
|
|
34
|
+
"vite": "^2.9.13",
|
|
35
|
+
"vitest": "^0.17.0"
|
|
34
36
|
}
|
|
35
37
|
}
|
|
@@ -8,26 +8,26 @@ describe('AppComponent', () => {
|
|
|
8
8
|
imports: [
|
|
9
9
|
RouterTestingModule,
|
|
10
10
|
AppComponent
|
|
11
|
-
]
|
|
11
|
+
]
|
|
12
12
|
}).compileComponents();
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
it('should create the app', () => {
|
|
16
16
|
const fixture = TestBed.createComponent(AppComponent);
|
|
17
17
|
const app = fixture.componentInstance;
|
|
18
18
|
expect(app).toBeTruthy();
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
it(`should have
|
|
21
|
+
it(`should have an initial count of 0`, () => {
|
|
22
22
|
const fixture = TestBed.createComponent(AppComponent);
|
|
23
23
|
const app = fixture.componentInstance;
|
|
24
|
-
expect(app.
|
|
24
|
+
expect(app.count).toEqual(0);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
it('should render title', () => {
|
|
28
28
|
const fixture = TestBed.createComponent(AppComponent);
|
|
29
29
|
fixture.detectChanges();
|
|
30
30
|
const compiled = fixture.nativeElement as HTMLElement;
|
|
31
|
-
expect(compiled.querySelector('
|
|
31
|
+
expect(compiled.querySelector('h1')?.textContent).toContain('Vite + Angular');
|
|
32
32
|
});
|
|
33
33
|
});
|
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import '@analogjs/vite-plugin-angular/setup-vitest';
|
|
2
2
|
|
|
3
|
-
import 'zone.js/testing';
|
|
4
|
-
import { getTestBed } from '@angular/core/testing';
|
|
5
3
|
import {
|
|
6
4
|
BrowserDynamicTestingModule,
|
|
7
|
-
platformBrowserDynamicTesting
|
|
5
|
+
platformBrowserDynamicTesting,
|
|
8
6
|
} from '@angular/platform-browser-dynamic/testing';
|
|
7
|
+
import { getTestBed } from '@angular/core/testing';
|
|
9
8
|
|
|
10
|
-
declare const require: {
|
|
11
|
-
context(path: string, deep?: boolean, filter?: RegExp): {
|
|
12
|
-
<T>(id: string): T;
|
|
13
|
-
keys(): string[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// First, initialize the Angular testing environment.
|
|
18
9
|
getTestBed().initTestEnvironment(
|
|
19
10
|
BrowserDynamicTestingModule,
|
|
20
|
-
platformBrowserDynamicTesting()
|
|
11
|
+
platformBrowserDynamicTesting()
|
|
21
12
|
);
|
|
22
|
-
|
|
23
|
-
// Then we find all the tests.
|
|
24
|
-
const context = require.context('./', true, /\.spec\.ts$/);
|
|
25
|
-
// And load the modules.
|
|
26
|
-
context.keys().forEach(context);
|
|
@@ -3,16 +3,8 @@
|
|
|
3
3
|
"extends": "./tsconfig.json",
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"outDir": "./out-tsc/spec",
|
|
6
|
-
"types": [
|
|
7
|
-
"jasmine"
|
|
8
|
-
]
|
|
6
|
+
"types": ["node", "vitest/globals"]
|
|
9
7
|
},
|
|
10
|
-
"files": [
|
|
11
|
-
|
|
12
|
-
"src/polyfills.ts"
|
|
13
|
-
],
|
|
14
|
-
"include": [
|
|
15
|
-
"src/**/*.spec.ts",
|
|
16
|
-
"src/**/*.d.ts"
|
|
17
|
-
]
|
|
8
|
+
"files": ["src/test.ts", "src/polyfills.ts"],
|
|
9
|
+
"include": ["src/**/*.spec.ts", "src/**/*.d.ts"]
|
|
18
10
|
}
|
|
@@ -1,17 +1,31 @@
|
|
|
1
|
+
/// <reference types="vitest" />
|
|
2
|
+
|
|
1
3
|
import { defineConfig } from 'vite';
|
|
2
4
|
import angular from '@analogjs/vite-plugin-angular';
|
|
3
5
|
|
|
4
6
|
// https://vitejs.dev/config/
|
|
5
|
-
export default defineConfig({
|
|
7
|
+
export default defineConfig(({ mode }) => ({
|
|
6
8
|
root: 'src',
|
|
7
9
|
publicDir: 'assets',
|
|
8
10
|
build: {
|
|
9
11
|
outDir: `../dist/my-app`,
|
|
10
12
|
emptyOutDir: true,
|
|
11
|
-
target: 'es2020'
|
|
13
|
+
target: 'es2020',
|
|
12
14
|
},
|
|
13
15
|
resolve: {
|
|
14
16
|
mainFields: ['module'],
|
|
15
17
|
},
|
|
16
18
|
plugins: [angular()],
|
|
17
|
-
|
|
19
|
+
test: {
|
|
20
|
+
globals: true,
|
|
21
|
+
environment: 'jsdom',
|
|
22
|
+
setupFiles: ['test.ts'],
|
|
23
|
+
include: ['**/*.spec.ts'],
|
|
24
|
+
cache: {
|
|
25
|
+
dir: `../node_modules/.vitest`,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
define: {
|
|
29
|
+
'import.meta.vitest': mode !== 'production',
|
|
30
|
+
},
|
|
31
|
+
}));
|