graphql-engine/frontend/apps/nx/internal-plugin-e2e/tests/nx-internal-plugin.spec.ts
Nicolas Beaussart 41d5bf2a19 frontend: setup internal executor to create the assetLoader
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7612
GitOrigin-RevId: 4da8b7a642af3795ef9c31939e2d14ef7a755013
2023-01-20 16:05:52 +00:00

62 lines
2.0 KiB
TypeScript

import {
checkFilesExist,
ensureNxProject,
readJson,
runNxCommandAsync,
uniq,
} from '@nrwl/nx-plugin/testing';
describe('nx-internal-plugin e2e', () => {
// Setting up individual workspaces per
// test can cause e2e runs to take a long time.
// For this reason, we recommend each suite only
// consumes 1 workspace. The tests should each operate
// on a unique project in the workspace, such that they
// are not dependant on one another.
beforeAll(() => {
ensureNxProject('@hasura/internal-plugin', 'dist/libs/nx/internal-plugin');
});
afterAll(() => {
// `nx reset` kills the daemon, and performs
// some work which can help clean up e2e leftovers
runNxCommandAsync('reset');
});
it.skip('should create nx-internal-plugin', async () => {
const project = uniq('nx-internal-plugin');
await runNxCommandAsync(
`generate @hasura/internal-plugin:nx-internal-plugin ${project}`
);
const result = await runNxCommandAsync(`build ${project}`);
expect(result.stdout).toContain('Executor ran');
}, 120000);
describe.skip('--directory', () => {
it('should create src in the specified directory', async () => {
const project = uniq('nx-internal-plugin');
await runNxCommandAsync(
`generate @hasura/internal-plugin:nx-internal-plugin ${project} --directory subdir`
);
expect(() =>
checkFilesExist(`libs/subdir/${project}/src/index.ts`)
).not.toThrow();
}, 120000);
});
describe.skip('--tags', () => {
it('should add tags to the project', async () => {
const projectName = uniq('nx-internal-plugin');
ensureNxProject(
'@hasura/internal-plugin',
'dist/libs/nx/internal-plugin'
);
await runNxCommandAsync(
`generate @hasura/internal-plugin:nx-internal-plugin ${projectName} --tags e2etag,e2ePackage`
);
const project = readJson(`libs/${projectName}/project.json`);
expect(project.tags).toEqual(['e2etag', 'e2ePackage']);
}, 120000);
});
});