Skip to content

Commit

Permalink
chore(misc): fix tests and schema
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed May 1, 2024
1 parent 4918741 commit 9b81b84
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
7 changes: 1 addition & 6 deletions e2e/webpack/src/webpack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,18 @@ describe('Webpack Plugin', () => {
expect(output).toMatch(/Hello/);
}, 500_000);

it('should bundle in non-sensitive NX_ environment variables', () => {
it('should bundle in NX_PUBLIC_ environment variables', () => {
const appName = uniq('app');
runCLI(`generate @nx/web:app ${appName} --bundler webpack`);
updateFile(
`apps/${appName}/src/main.ts`,
`
console.log(process.env['NX_CLOUD_ENCRYPTION_KEY']);
console.log(process.env['NX_CLOUD_ACCESS_TOKEN']);
console.log(process.env['NX_PUBLIC_TEST']);
`
);

runCLI(`build ${appName}`, {
env: {
NX_CLOUD_ENCRYPTION_KEY: 'secret',
NX_CLOUD_ACCESS_TOKEN: 'secret',
NX_PUBLIC_TEST: 'foobar',
},
});
Expand All @@ -188,7 +184,6 @@ describe('Webpack Plugin', () => {
f.startsWith('main.')
);
const content = readFile(`dist/apps/${appName}/${mainFile}`);
expect(content).not.toMatch(/secret/);
expect(content).toMatch(/foobar/);
});

Expand Down
6 changes: 0 additions & 6 deletions packages/cypress/generators.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
"aliases": ["ng-add"],
"hidden": true
},
"cypress-project": {
"factory": "./src/generators/cypress-project/cypress-project#cypressProjectGeneratorInternal",
"schema": "./src/generators/cypress-project/schema.json",
"description": "Add a Cypress E2E Project.",
"hidden": true
},
"configuration": {
"aliases": ["cypress-e2e-configuration", "e2e", "e2e-config"],
"factory": "./src/generators/configuration/configuration#configurationGeneratorInternal",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { interpolateEnvironmentVariablesToIndex } from './interpolate-env-variab

describe('interpolateEnvironmentVariablesToIndex()', () => {
const envDefaults = {
NX_VARIABLE: 'foo',
NX_PUBLIC_VARIABLE: 'foo',
SOME_OTHER_VARIABLE: 'bar',
DEPLOY_URL: 'baz',
};
Expand All @@ -14,7 +14,7 @@ describe('interpolateEnvironmentVariablesToIndex()', () => {

test('default env variables', () => {
const content = `
<div>Nx Variable: %NX_VARIABLE%</div>
<div>Nx Variable: %NX_PUBLIC_VARIABLE%</div>
<div>Some other variable: %SOME_OTHER_VARIABLE%</div>
<div>Deploy Url: %DEPLOY_URL%</div>
`;
Expand All @@ -28,7 +28,7 @@ describe('interpolateEnvironmentVariablesToIndex()', () => {

test('Deploy url set as option overrides DEPLOY_URL env variable', () => {
const content = `
<div>Nx Variable: %NX_VARIABLE%</div>
<div>Nx Variable: %NX_PUBLIC_VARIABLE%</div>
<div>Some other variable: %SOME_OTHER_VARIABLE%</div>
<div>Deploy Url: %DEPLOY_URL%</div>
`;
Expand All @@ -45,7 +45,7 @@ describe('interpolateEnvironmentVariablesToIndex()', () => {
test('No deploy url provided via either option', () => {
delete process.env.DEPLOY_URL;
const content = `
<div>Nx Variable: %NX_VARIABLE%</div>
<div>Nx Variable: %NX_PUBLIC_VARIABLE%</div>
<div>Some other variable: %SOME_OTHER_VARIABLE%</div>
<div>Deploy Url: %DEPLOY_URL%</div>
`;
Expand All @@ -60,7 +60,7 @@ describe('interpolateEnvironmentVariablesToIndex()', () => {
test('NX_ prefixed option present in index.html, but not present in process.env', () => {
delete process.env.DEPLOY_URL;
const content = `
<div>Nx Variable: %NX_VARIABLE%</div>
<div>Nx Variable: %NX_PUBLIC_VARIABLE%</div>
<div>Some other variable: %SOME_OTHER_VARIABLE%</div>
<div>Some other nx_variable: %NX_SOME_OTHER_VARIABLE%</div>
<div>Deploy Url: %DEPLOY_URL%</div>
Expand Down

0 comments on commit 9b81b84

Please sign in to comment.