Skip to content

Commit

Permalink
chore(angular): remove superfluous test (#28694)
Browse files Browse the repository at this point in the history
We always use .mts extension. It is not conditional anymore.

(cherry picked from commit 668913e)
  • Loading branch information
yjaaidi authored and FrozenPandaz committed Nov 14, 2024
1 parent 47c9ac5 commit 303cadf
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -509,68 +509,6 @@ export default defineConfig({
"
`;
exports[`app --unit-test-runner vitest should generate vite.config.mts if package type is module 1`] = `
"/// <reference types='vitest' />
import { defineConfig } from 'vite';
import angular from '@analogjs/vite-plugin-angular';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
export default defineConfig({
root: __dirname,
cacheDir: '../node_modules/.vite/my-app',
plugins: [angular(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
test: {
watch: false,
globals: true,
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
setupFiles: ['src/test-setup.ts'],
reporters: ['default'],
coverage: {
reportsDirectory: '../coverage/my-app',
provider: 'v8',
},
},
});
"
`;
exports[`app --unit-test-runner vitest should generate vite.config.mts if workspace package type is module 1`] = `
"/// <reference types='vitest' />
import { defineConfig } from 'vite';
import angular from '@analogjs/vite-plugin-angular';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
export default defineConfig({
root: __dirname,
cacheDir: '../node_modules/.vite/my-app',
plugins: [angular(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
test: {
watch: false,
globals: true,
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
setupFiles: ['src/test-setup.ts'],
reporters: ['default'],
coverage: {
reportsDirectory: '../coverage/my-app',
provider: 'v8',
},
},
});
"
`;
exports[`app angular compat support should import "ApplicationConfig" from "@angular/platform-browser" 1`] = `
"import { ApplicationConfig } from '@angular/core';
import { provideRouter } from '@angular/router';
Expand Down
52 changes: 0 additions & 52 deletions packages/angular/src/generators/application/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -768,58 +768,6 @@ describe('app', () => {
expect(devDependencies['@analogjs/vite-plugin-angular']).toBeDefined();
expect(devDependencies['@analogjs/vitest-angular']).toBeDefined();
});

it('should generate vite.config.mts if package type is module', async () => {
writeJson(appTree, 'my-app/package.json', {
name: 'my-app',
type: 'module',
});

await generateApp(appTree, 'my-app', {
skipFormat: false,
unitTestRunner: UnitTestRunner.Vitest,
});

expect(
appTree.read('my-app/vite.config.mts', 'utf-8')
).toMatchSnapshot();
});

it('should generate vite.config.mts if workspace package type is module', async () => {
updateJson(appTree, 'package.json', (json) => ({
...json,
type: 'module',
}));

await generateApp(appTree, 'my-app', {
skipFormat: false,
unitTestRunner: UnitTestRunner.Vitest,
});

expect(
appTree.read('my-app/vite.config.mts', 'utf-8')
).toMatchSnapshot();
});

it('should not override build configuration when using vitest as a test runner', async () => {
await generateApp(appTree, 'my-app', {
unitTestRunner: UnitTestRunner.Vitest,
});
const { targets } = readProjectConfiguration(appTree, 'my-app');
expect(targets.build.executor).toBe(
'@angular-devkit/build-angular:application'
);
});

it('should not override serve configuration when using vitest as a test runner', async () => {
await generateApp(appTree, 'my-app', {
unitTestRunner: UnitTestRunner.Vitest,
});
const { targets } = readProjectConfiguration(appTree, 'my-app');
expect(targets.serve.executor).toBe(
'@angular-devkit/build-angular:dev-server'
);
});
});

describe('none', () => {
Expand Down

0 comments on commit 303cadf

Please sign in to comment.