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