cleanup(nx): clean up scripts and e2e tests
This commit is contained in:
parent
1f5f0c2933
commit
e51c7a4069
@ -19,7 +19,7 @@ install:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then yarn checkformat --head=$TRAVIS_PULL_REQUEST_SHA --base=$(git merge-base HEAD $TRAVIS_BRANCH); fi'
|
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then yarn checkformat --head=$TRAVIS_PULL_REQUEST_SHA --base=$(git merge-base HEAD $TRAVIS_BRANCH); fi'
|
||||||
- yarn test
|
- yarn test:all
|
||||||
- yarn e2e
|
- yarn e2e
|
||||||
- yarn checkcommit
|
- yarn checkcommit
|
||||||
- yarn checkimports
|
- yarn checkimports
|
||||||
|
|||||||
@ -41,22 +41,10 @@ To make sure your changes do not break any unit tests, run the following:
|
|||||||
yarn test
|
yarn test
|
||||||
```
|
```
|
||||||
|
|
||||||
To test the schematics only, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
yarn test:schematics
|
|
||||||
```
|
|
||||||
|
|
||||||
To test the Nx packages only, run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
yarn test:nx
|
|
||||||
```
|
|
||||||
|
|
||||||
For example, if you need to only run the **ngrx/ngrx.spec.ts** test suite, provide a path to the specific spec file, run:
|
For example, if you need to only run the **ngrx/ngrx.spec.ts** test suite, provide a path to the specific spec file, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn test:schematics angular/src/schematics/ngrx/ngrx
|
yarn test angular/src/schematics/ngrx/ngrx
|
||||||
```
|
```
|
||||||
|
|
||||||
### Running E2E Tests
|
### Running E2E Tests
|
||||||
@ -78,7 +66,7 @@ yarn e2e affected
|
|||||||
To build Nx on Windows, you need to use WSL.
|
To build Nx on Windows, you need to use WSL.
|
||||||
|
|
||||||
- Run `yarn install` in WSL. Yarn will compile several dependencies. If you don't run `install` in WSL, they will be compiled for Windows.
|
- Run `yarn install` in WSL. Yarn will compile several dependencies. If you don't run `install` in WSL, they will be compiled for Windows.
|
||||||
- Run `yarn test:schematics` and other commands in WSL.
|
- Run `yarn test` and other commands in WSL.
|
||||||
|
|
||||||
## Submission Guidelines
|
## Submission Guidelines
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import {
|
|||||||
uniq,
|
uniq,
|
||||||
updateFile,
|
updateFile,
|
||||||
runCLI
|
runCLI
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
|
|
||||||
describe('Affected', () => {
|
describe('Affected', () => {
|
||||||
it('should print, build, and test affected apps', () => {
|
it('should print, build, and test affected apps', () => {
|
||||||
@ -9,7 +9,7 @@ import {
|
|||||||
exists,
|
exists,
|
||||||
ensureProject,
|
ensureProject,
|
||||||
uniq
|
uniq
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
|
|
||||||
describe('Command line', () => {
|
describe('Command line', () => {
|
||||||
it('lint should ensure module boundaries', () => {
|
it('lint should ensure module boundaries', () => {
|
||||||
@ -8,7 +8,7 @@ import {
|
|||||||
uniq,
|
uniq,
|
||||||
runsInWSL,
|
runsInWSL,
|
||||||
newProject
|
newProject
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
|
|
||||||
describe('Cypress E2E Test runner', () => {
|
describe('Cypress E2E Test runner', () => {
|
||||||
describe('project scaffolding', () => {
|
describe('project scaffolding', () => {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { ensureProject, uniq, runCommand, checkFilesExist } from '../utils';
|
import { ensureProject, uniq, runCommand, checkFilesExist } from './utils';
|
||||||
|
|
||||||
describe('Delegate to CLI', () => {
|
describe('Delegate to CLI', () => {
|
||||||
it('should delegate to the Angular CLI all non-standard commands', async () => {
|
it('should delegate to the Angular CLI all non-standard commands', async () => {
|
||||||
@ -4,7 +4,7 @@ import {
|
|||||||
runCLI,
|
runCLI,
|
||||||
uniq,
|
uniq,
|
||||||
updateFile
|
updateFile
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
|
|
||||||
describe('DowngradeModule', () => {
|
describe('DowngradeModule', () => {
|
||||||
it('should generate a downgradeModule setup', async () => {
|
it('should generate a downgradeModule setup', async () => {
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { runCLIAsync, ensureProject, uniq, runCLI } from '../utils';
|
import { runCLIAsync, ensureProject, uniq, runCLI } from './utils';
|
||||||
|
|
||||||
describe('Jest', () => {
|
describe('Jest', () => {
|
||||||
it('should be able test projects using jest', async done => {
|
it('should be able test projects using jest', async done => {
|
||||||
@ -4,7 +4,7 @@ import {
|
|||||||
ensureProject,
|
ensureProject,
|
||||||
uniq,
|
uniq,
|
||||||
patchKarmaToWorkOnWSL
|
patchKarmaToWorkOnWSL
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
|
|
||||||
describe('Karma', () => {
|
describe('Karma', () => {
|
||||||
it('should be able to generate a testable library using karma', async done => {
|
it('should be able to generate a testable library using karma', async done => {
|
||||||
@ -8,7 +8,7 @@ import {
|
|||||||
runCommand,
|
runCommand,
|
||||||
runNgNew,
|
runNgNew,
|
||||||
updateFile
|
updateFile
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
|
|
||||||
describe('Nrwl Convert to Nx Workspace', () => {
|
describe('Nrwl Convert to Nx Workspace', () => {
|
||||||
beforeEach(cleanup);
|
beforeEach(cleanup);
|
||||||
@ -8,7 +8,7 @@ import {
|
|||||||
runsInWSL,
|
runsInWSL,
|
||||||
uniq,
|
uniq,
|
||||||
updateFile
|
updateFile
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
import { toClassName } from '@nrwl/workspace';
|
import { toClassName } from '@nrwl/workspace';
|
||||||
|
|
||||||
describe('Nrwl Workspace', () => {
|
describe('Nrwl Workspace', () => {
|
||||||
@ -5,7 +5,7 @@ import {
|
|||||||
uniq,
|
uniq,
|
||||||
ensureProject,
|
ensureProject,
|
||||||
readJson
|
readJson
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
|
|
||||||
describe('ngrx', () => {
|
describe('ngrx', () => {
|
||||||
it('should work', async () => {
|
it('should work', async () => {
|
||||||
@ -1,18 +1,16 @@
|
|||||||
import {
|
import { execSync, fork, spawn } from 'child_process';
|
||||||
newProject,
|
|
||||||
runCLI,
|
|
||||||
copyMissingPackages,
|
|
||||||
exists,
|
|
||||||
runCLIAsync,
|
|
||||||
updateFile,
|
|
||||||
readJson,
|
|
||||||
ensureProject,
|
|
||||||
uniq
|
|
||||||
} from '../utils';
|
|
||||||
import { fork, spawn, execSync } from 'child_process';
|
|
||||||
import * as http from 'http';
|
import * as http from 'http';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as treeKill from 'tree-kill';
|
import * as treeKill from 'tree-kill';
|
||||||
|
import {
|
||||||
|
ensureProject,
|
||||||
|
exists,
|
||||||
|
readJson,
|
||||||
|
runCLI,
|
||||||
|
runCLIAsync,
|
||||||
|
uniq,
|
||||||
|
updateFile
|
||||||
|
} from './utils';
|
||||||
|
|
||||||
function getData(): Promise<any> {
|
function getData(): Promise<any> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
@ -30,7 +28,7 @@ function getData(): Promise<any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe('Node Applications', () => {
|
describe('Node Applications', () => {
|
||||||
it('should be able to generate an express application', async done => {
|
fit('should be able to generate an express application', async done => {
|
||||||
ensureProject();
|
ensureProject();
|
||||||
const nodeapp = uniq('nodeapp');
|
const nodeapp = uniq('nodeapp');
|
||||||
runCLI(`generate @nrwl/express:app ${nodeapp}`);
|
runCLI(`generate @nrwl/express:app ${nodeapp}`);
|
||||||
@ -49,7 +47,6 @@ describe('Node Applications', () => {
|
|||||||
updateFile(`apps/${nodeapp}/src/assets/file.txt`, ``);
|
updateFile(`apps/${nodeapp}/src/assets/file.txt`, ``);
|
||||||
const jestResult = await runCLIAsync(`test ${nodeapp}`);
|
const jestResult = await runCLIAsync(`test ${nodeapp}`);
|
||||||
expect(jestResult.stderr).toContain('Test Suites: 1 passed, 1 total');
|
expect(jestResult.stderr).toContain('Test Suites: 1 passed, 1 total');
|
||||||
|
|
||||||
await runCLIAsync(`build ${nodeapp}`);
|
await runCLIAsync(`build ${nodeapp}`);
|
||||||
|
|
||||||
expect(exists(`./tmp/proj/dist/apps/${nodeapp}/main.js`)).toBeTruthy();
|
expect(exists(`./tmp/proj/dist/apps/${nodeapp}/main.js`)).toBeTruthy();
|
||||||
@ -57,13 +54,8 @@ describe('Node Applications', () => {
|
|||||||
exists(`./tmp/proj/dist/apps/${nodeapp}/assets/file.txt`)
|
exists(`./tmp/proj/dist/apps/${nodeapp}/assets/file.txt`)
|
||||||
).toBeTruthy();
|
).toBeTruthy();
|
||||||
expect(exists(`./tmp/proj/dist/apps/${nodeapp}/main.js.map`)).toBeTruthy();
|
expect(exists(`./tmp/proj/dist/apps/${nodeapp}/main.js.map`)).toBeTruthy();
|
||||||
|
|
||||||
const server = fork(
|
const server = fork(
|
||||||
path.join(
|
path.join(__dirname, '../../tmp/proj', `./dist/apps/${nodeapp}/main.js`),
|
||||||
__dirname,
|
|
||||||
'../../../tmp/proj',
|
|
||||||
`./dist/apps/${nodeapp}/main.js`
|
|
||||||
),
|
|
||||||
[],
|
[],
|
||||||
{
|
{
|
||||||
cwd: './tmp/proj',
|
cwd: './tmp/proj',
|
||||||
@ -71,7 +63,6 @@ describe('Node Applications', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
expect(server).toBeTruthy();
|
expect(server).toBeTruthy();
|
||||||
|
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
server.stdout.once('data', async data => {
|
server.stdout.once('data', async data => {
|
||||||
expect(data.toString()).toContain('Listening at http://localhost:3333');
|
expect(data.toString()).toContain('Listening at http://localhost:3333');
|
||||||
@ -100,7 +91,6 @@ describe('Node Applications', () => {
|
|||||||
`${nodeapp}:waitAndPrint`
|
`${nodeapp}:waitAndPrint`
|
||||||
];
|
];
|
||||||
updateFile('angular.json', JSON.stringify(config));
|
updateFile('angular.json', JSON.stringify(config));
|
||||||
|
|
||||||
const process = spawn(
|
const process = spawn(
|
||||||
'node',
|
'node',
|
||||||
['./node_modules/.bin/ng', 'serve', nodeapp],
|
['./node_modules/.bin/ng', 'serve', nodeapp],
|
||||||
@ -108,7 +98,6 @@ describe('Node Applications', () => {
|
|||||||
cwd: './tmp/proj'
|
cwd: './tmp/proj'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
let collectedOutput = '';
|
let collectedOutput = '';
|
||||||
process.stdout.on('data', async (data: Buffer) => {
|
process.stdout.on('data', async (data: Buffer) => {
|
||||||
collectedOutput += data.toString();
|
collectedOutput += data.toString();
|
||||||
@ -144,11 +133,7 @@ describe('Node Applications', () => {
|
|||||||
expect(exists(`./tmp/proj/dist/apps/${nestapp}/main.js.map`)).toBeTruthy();
|
expect(exists(`./tmp/proj/dist/apps/${nestapp}/main.js.map`)).toBeTruthy();
|
||||||
|
|
||||||
const server = fork(
|
const server = fork(
|
||||||
path.join(
|
path.join(__dirname, '../../tmp/proj', `./dist/apps/${nestapp}/main.js`),
|
||||||
__dirname,
|
|
||||||
'../../../tmp/proj',
|
|
||||||
`./dist/apps/${nestapp}/main.js`
|
|
||||||
),
|
|
||||||
[],
|
[],
|
||||||
{
|
{
|
||||||
cwd: './tmp/proj',
|
cwd: './tmp/proj',
|
||||||
@ -8,7 +8,7 @@ import {
|
|||||||
checkFilesExist,
|
checkFilesExist,
|
||||||
renameFile,
|
renameFile,
|
||||||
readJson
|
readJson
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
import { serializeJson } from '@nrwl/workspace';
|
import { serializeJson } from '@nrwl/workspace';
|
||||||
|
|
||||||
describe('React Applications', () => {
|
describe('React Applications', () => {
|
||||||
@ -4,7 +4,7 @@ import {
|
|||||||
runCLI,
|
runCLI,
|
||||||
uniq,
|
uniq,
|
||||||
updateFile
|
updateFile
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
|
|
||||||
describe('Upgrade', () => {
|
describe('Upgrade', () => {
|
||||||
it('should generate an UpgradeModule setup', async () => {
|
it('should generate an UpgradeModule setup', async () => {
|
||||||
@ -4,7 +4,7 @@ import {
|
|||||||
runCLI,
|
runCLI,
|
||||||
runCLIAsync,
|
runCLIAsync,
|
||||||
uniq
|
uniq
|
||||||
} from '../utils';
|
} from './utils';
|
||||||
|
|
||||||
describe('Web Components Applications', () => {
|
describe('Web Components Applications', () => {
|
||||||
it('should be able to generate a web app', async () => {
|
it('should be able to generate a web app', async () => {
|
||||||
@ -15,9 +15,8 @@
|
|||||||
"linknpm": "./scripts/link.sh",
|
"linknpm": "./scripts/link.sh",
|
||||||
"nx-release": "./scripts/nx-release.js",
|
"nx-release": "./scripts/nx-release.js",
|
||||||
"copy": "./scripts/copy.sh",
|
"copy": "./scripts/copy.sh",
|
||||||
"test:schematics": "yarn linknpm fast && ./scripts/test_schematics.sh",
|
"test": "yarn linknpm fast && ./scripts/test.sh",
|
||||||
"test:nx": "yarn linknpm fast && ./scripts/test_nx.sh",
|
"test:all": "yarn linknpm fast && ./scripts/test_angular_runtime.sh && ./scripts/test.sh",
|
||||||
"test": "yarn linknpm fast && ./scripts/test_nx.sh && ./scripts/test_schematics.sh",
|
|
||||||
"checkformat": "./scripts/check_format.sh",
|
"checkformat": "./scripts/check_format.sh",
|
||||||
"checkimports": "node ./scripts/check-imports.js",
|
"checkimports": "node ./scripts/check-imports.js",
|
||||||
"documentation": "./scripts/documentation/documentation.sh && yarn format && ./scripts/documentation/check-documentation.sh"
|
"documentation": "./scripts/documentation/documentation.sh && yarn format && ./scripts/documentation/check-documentation.sh"
|
||||||
|
|||||||
@ -11,13 +11,13 @@ cp -r packages/angular/dist build/packages/angular
|
|||||||
rm -rf packages/angular/dist
|
rm -rf packages/angular/dist
|
||||||
|
|
||||||
echo "Compiling Typescript..."
|
echo "Compiling Typescript..."
|
||||||
./node_modules/.bin/ngc
|
./node_modules/.bin/tsc
|
||||||
echo "Compiled Typescript"
|
echo "Compiled Typescript"
|
||||||
|
|
||||||
rm build/packages/angular/testing/nrwl-angular-testing.metadata.json
|
# rm build/packages/angular/testing/nrwl-angular-testing.metadata.json
|
||||||
rm build/packages/angular/testing/index.metadata.json
|
# rm build/packages/angular/testing/index.metadata.json
|
||||||
rm build/packages/workspace/index.metadata.json
|
# rm build/packages/workspace/index.metadata.json
|
||||||
rm build/packages/workspace/testing.metadata.json
|
# rm build/packages/workspace/testing.metadata.json
|
||||||
|
|
||||||
#TODO This is a temporary hack until we can publish named umds
|
#TODO This is a temporary hack until we can publish named umds
|
||||||
sed -i.bak "s/define(\[/define('@nrwl\/angular',\[/" build/packages/angular/bundles/nrwl-angular.umd.js
|
sed -i.bak "s/define(\[/define('@nrwl\/angular',\[/" build/packages/angular/bundles/nrwl-angular.umd.js
|
||||||
|
|||||||
@ -5,9 +5,9 @@ rm -rf tmp
|
|||||||
mkdir tmp
|
mkdir tmp
|
||||||
|
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
jest --maxWorkers=1 ./build/e2e/schematics/$1.test.js
|
jest --maxWorkers=1 ./build/e2e/$1.test.js
|
||||||
else
|
else
|
||||||
jest --maxWorkers=1 ./build/e2e/schematics
|
jest --maxWorkers=1 ./build/e2e/*.test.js
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user