Skip to content

Commit

Permalink
test(nx-heroku): add extra e2e test to run deploy executor with minim…
Browse files Browse the repository at this point in the history
…al options
  • Loading branch information
getlarge committed May 1, 2024
1 parent a79346a commit f59a28a
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion e2e/nx-heroku-e2e/tests/nx-heroku.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,45 @@ describe('nx-heroku e2e', () => {
expect(project.targets?.deploy?.options?.email).toEqual(HEROKU_EMAIL);
}, 120000);

it('should create target and deploy the app successfully', async () => {
it('should create target and deploy an app with simple configuration successfully', async () => {
const { projectName, getProjectConfig, updateProjectConfig } =
await createProject();

projects.push(projectName);
// restore the environment variables to be expanded by the executor
process.env.HEROKU_API_KEY = process.env.HEROKU_API_KEY_PREV;
process.env.HEROKU_EMAIL = process.env.HEROKU_EMAIL_PREV;
// configure the target
await runNxCommandAsync(
`generate @getlarge/nx-heroku:deploy ${projectName} --appNamePrefix=aloes`
);
const project = getProjectConfig();
project.targets!.deploy.options = {
...(project.targets!.deploy.options || {}),
procfile: `web: node dist/apps/${projectName}/main.js`,
buildPacks: ['heroku/nodejs'],
apiKey: HEROKU_API_KEY,
email: HEROKU_EMAIL,
variables: {
// used in postbuild.js
PROJECT_NAME: projectName,
},
useForce: true,
serviceUser: '[email protected]',
debug: true,
};
updateProjectConfig(project);
prepareProjectForDeployment(projectName);
// run the target
const { stderr, stdout } = await runNxCommandAsync(
`deploy ${projectName} --verbose`,
{ silenceError: true }
);
console.warn(stdout, stderr);
expect(stdout).toContain('Deployment successful.');
}, 100000);

it('should create target and deploy the app with complex configuration successfully', async () => {
const { projectName, getProjectConfig, updateProjectConfig } =
await createProject();

Expand Down

0 comments on commit f59a28a

Please sign in to comment.