nx/e2e/vue/src/vue-ts-solution.test.ts
Jack Hsu a8de7df0e0
feat(js): update vue/node app and lib generators to support TS solutions (#29299)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #

---------

Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com>
2024-12-12 15:43:14 -05:00

76 lines
1.7 KiB
TypeScript

import {
cleanupProject,
getSelectedPackageManager,
newProject,
runCLI,
uniq,
updateFile,
updateJson,
} from '@nx/e2e/utils';
describe('Vue Plugin', () => {
let proj: string;
const pm = getSelectedPackageManager();
beforeAll(() => {
proj = newProject({
packages: ['@nx/vue'],
preset: 'ts',
});
if (pm === 'pnpm') {
updateFile(
'pnpm-workspace.yaml',
`
packages:
- 'apps/**'
- 'packages/**'
`
);
} else {
updateJson('package.json', (json) => {
json.workspaces = ['apps/**', 'packages/**'];
return json;
});
}
});
afterAll(() => cleanupProject());
it('should serve application in dev mode', async () => {
const app = uniq('app');
const lib = uniq('lib');
runCLI(
`generate @nx/vue:app apps/${app} --unitTestRunner=vitest --e2eTestRunner=playwright --linter=eslint`
);
runCLI(
`generate @nx/vue:lib packages/${lib} --bundler=vite --unitTestRunner=vitest --linter=eslint`
);
// app and lib generators don't have specs by default, add some stubs
updateFile(
`apps/${app}/src/foo.spec.ts`,
`
test('it should run', () => {
expect(true).toBeTruthy();
});
`
);
updateFile(
`packages/${lib}/src/foo.spec.ts`,
`
test('it should run', () => {
expect(true).toBeTruthy();
});
`
);
expect(() => runCLI(`lint ${app}`)).not.toThrow();
expect(() => runCLI(`test ${app}`)).not.toThrow();
expect(() => runCLI(`build ${app}`)).not.toThrow();
expect(() => runCLI(`lint ${lib}`)).not.toThrow();
expect(() => runCLI(`test ${lib}`)).not.toThrow();
expect(() => runCLI(`build ${lib}`)).not.toThrow();
}, 300_000);
});