chore(repo): enable windows nightly tests (#5889)
This commit is contained in:
parent
0f4c18218e
commit
b3c36dc067
30
.github/workflows/e2e-matrix.yml
vendored
30
.github/workflows/e2e-matrix.yml
vendored
@ -17,12 +17,17 @@ jobs:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
# - windows-latest
|
||||
- windows-latest
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
os-name: ubuntu
|
||||
# - os: windows-latest
|
||||
# os-name: windows
|
||||
- os: windows-latest
|
||||
os-name: windows
|
||||
exclude:
|
||||
- os: windows-latest
|
||||
package_manager: npm
|
||||
- os: windows-latest
|
||||
package_manager: yarn
|
||||
node_version:
|
||||
- '14'
|
||||
# - '15'
|
||||
@ -31,15 +36,15 @@ jobs:
|
||||
- yarn
|
||||
- pnpm
|
||||
packages:
|
||||
- e2e-workspace
|
||||
- e2e-cli,e2e-nx-plugin,dep-graph-dep-graph-e2e
|
||||
- e2e-cypress,e2e-jest
|
||||
- e2e-react
|
||||
- e2e-next
|
||||
- e2e-gatsby
|
||||
- e2e-node
|
||||
- e2e-web,e2e-linter,e2e-storybook
|
||||
- e2e-angular
|
||||
- e2e-cli,e2e-nx-plugin,e2e-jest,e2e-linter,e2e-cypress
|
||||
- e2e-cypress
|
||||
- e2e-gatsby,e2e-react
|
||||
- e2e-next
|
||||
- e2e-node
|
||||
- e2e-web
|
||||
- e2e-storybook
|
||||
- e2e-workspace
|
||||
fail-fast: false
|
||||
|
||||
name: ${{ matrix.os-name }}/n v${{ matrix.node_version }}/${{ matrix.package_manager }} - ${{ matrix.packages }}
|
||||
@ -63,7 +68,8 @@ jobs:
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ matrix.os }}-node-${{ matrix.node-version }}-yarn-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: ${{ matrix.os }}-node-${{ matrix.node-version }}-yarn-
|
||||
restore-keys: |
|
||||
${{ matrix.os }}-node-${{ matrix.node-version }}-yarn-
|
||||
|
||||
- name: Install packages
|
||||
run: yarn install --prefer-offline --non-interactive
|
||||
|
||||
@ -2,6 +2,7 @@ process.env.SELECTED_CLI = 'angular';
|
||||
|
||||
import {
|
||||
checkFilesExist,
|
||||
isNotWindows,
|
||||
killPorts,
|
||||
newProject,
|
||||
readFile,
|
||||
@ -56,6 +57,7 @@ describe('Storybook schematics', () => {
|
||||
|
||||
describe('build storybook', () => {
|
||||
it('should execute e2e tests using Cypress running against Storybook', async () => {
|
||||
if (isNotWindows()) {
|
||||
const myapp = uniq('myapp');
|
||||
runCLI(`generate @nrwl/angular:app ${myapp} --no-interactive`);
|
||||
|
||||
@ -188,6 +190,7 @@ describe('Storybook schematics', () => {
|
||||
`<title>Storybook</title>`
|
||||
);
|
||||
expect(await killPorts()).toBeTruthy();
|
||||
}
|
||||
}, 1000000);
|
||||
|
||||
xit('should build an Angular based storybook', () => {
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import {
|
||||
checkFilesExist,
|
||||
killPorts,
|
||||
newProject,
|
||||
runCLI,
|
||||
runCLIAsync,
|
||||
|
||||
@ -2,6 +2,7 @@ import { stringUtils } from '@nrwl/workspace';
|
||||
import {
|
||||
checkFilesExist,
|
||||
createFile,
|
||||
isNotWindows,
|
||||
killPorts,
|
||||
newProject,
|
||||
promisifiedTreeKill,
|
||||
@ -345,7 +346,7 @@ describe('Next.js Applications', () => {
|
||||
`dist/apps/${appName}/public/a/b.txt`,
|
||||
`dist/apps/${appName}/public/shared/ui/hello.txt`
|
||||
);
|
||||
}, 120000);
|
||||
}, 300000);
|
||||
|
||||
it('should build with a next.config.js file in the dist folder', async () => {
|
||||
const appName = uniq('app');
|
||||
@ -374,7 +375,7 @@ describe('Next.js Applications', () => {
|
||||
|
||||
checkFilesExist(`dist/apps/${appName}/next.config.js`);
|
||||
expect(result).toContain('NODE_ENV is production');
|
||||
}, 120000);
|
||||
}, 300000);
|
||||
|
||||
it('should support --js flag', async () => {
|
||||
const appName = uniq('app');
|
||||
@ -458,6 +459,7 @@ describe('Next.js Applications', () => {
|
||||
}, 120000);
|
||||
|
||||
it('webpack5 - should be able to consume a react libs (buildable and non-buildable)', async () => {
|
||||
if (isNotWindows()) {
|
||||
const appName = uniq('app');
|
||||
const buildableLibName = uniq('lib');
|
||||
const nonBuildableLibName = uniq('lib');
|
||||
@ -523,6 +525,7 @@ describe('Next.js Applications', () => {
|
||||
checkE2E: true,
|
||||
checkWebpack5: true,
|
||||
});
|
||||
}
|
||||
}, 300000);
|
||||
|
||||
it('webpack5 - should build with a next.config.js file in the dist folder', async () => {
|
||||
|
||||
@ -54,7 +54,7 @@ describe('Node Applications', () => {
|
||||
cwd: tmpProjPath(),
|
||||
}).toString();
|
||||
expect(result).toContain('Hello World!');
|
||||
}, 60000);
|
||||
}, 300000);
|
||||
|
||||
xit('should be able to generate an express application', async () => {
|
||||
const nodeapp = uniq('nodeapp');
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import {
|
||||
checkFilesExist,
|
||||
expectTestsPass,
|
||||
isNotWindows,
|
||||
killPorts,
|
||||
newProject,
|
||||
readJson,
|
||||
runCLI,
|
||||
runCLIAsync,
|
||||
runCypressTests,
|
||||
uniq,
|
||||
workspaceConfigName,
|
||||
} from '@nrwl/e2e/utils';
|
||||
@ -60,7 +60,7 @@ describe('Nx Plugin', () => {
|
||||
const plugin = uniq('plugin-name');
|
||||
runCLI(`generate @nrwl/nx-plugin:plugin ${plugin} --linter=eslint`);
|
||||
|
||||
if (runCypressTests()) {
|
||||
if (isNotWindows()) {
|
||||
const e2eResults = runCLI(`e2e ${plugin}-e2e --no-watch --headless`);
|
||||
expect(e2eResults).toContain('Running target "e2e" succeeded');
|
||||
expect(await killPorts()).toBeTruthy();
|
||||
|
||||
@ -16,6 +16,7 @@ import isCI = require('is-ci');
|
||||
import * as path from 'path';
|
||||
import { dirSync } from 'tmp';
|
||||
const kill = require('kill-port');
|
||||
const isWindows = require('is-windows');
|
||||
import { check as portCheck } from 'tcp-port-used';
|
||||
import { parseJson } from '@nrwl/devkit';
|
||||
import chalk = require('chalk');
|
||||
@ -119,8 +120,7 @@ export function packageInstall(pkg: string, projName?: string) {
|
||||
const pm = getPackageManagerCommand({ path: cwd });
|
||||
const install = execSync(`${pm.addDev} ${pkg}`, {
|
||||
cwd,
|
||||
// ...{ stdio: ['pipe', 'pipe', 'pipe'] },
|
||||
...{ stdio: [0, 1, 2] },
|
||||
stdio: [0, 1, 2],
|
||||
env: process.env,
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
@ -189,8 +189,7 @@ export function newProject({ name = uniq('proj') } = {}): string {
|
||||
}
|
||||
return projScope;
|
||||
} catch (e) {
|
||||
console.log(`Failed to set up project for e2e tests.`);
|
||||
console.log(e.message);
|
||||
logError(`Failed to set up project for e2e tests.`, e.message);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -240,6 +239,10 @@ export function runCypressTests() {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function isNotWindows() {
|
||||
return !isWindows();
|
||||
}
|
||||
|
||||
export function runCommandAsync(
|
||||
command: string,
|
||||
opts: RunCmdOpts = {
|
||||
@ -346,7 +349,10 @@ export function runNgAdd(
|
||||
if (opts.silenceError) {
|
||||
return e.stdout.toString();
|
||||
} else {
|
||||
console.log(e.stdout.toString(), e.stderr.toString());
|
||||
logError(
|
||||
`Ng Add failed: ${command}`,
|
||||
`${e.stdout?.toString()}\n\n${e.stderr?.toString()}`
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -372,8 +378,7 @@ export function runCLI(
|
||||
''
|
||||
);
|
||||
if (process.env.VERBOSE_OUTPUT) {
|
||||
console.log('result of running:', command);
|
||||
console.log(r);
|
||||
logInfo(`result of running: ${command}`, r);
|
||||
}
|
||||
|
||||
const needsMaxWorkers = /g.*(express|nest|node|web|react):app.*/;
|
||||
@ -384,10 +389,12 @@ export function runCLI(
|
||||
return r;
|
||||
} catch (e) {
|
||||
if (opts.silenceError) {
|
||||
return e.stdout.toString() + e.stderr?.toString();
|
||||
return e.stdout?.toString() + e.stderr?.toString();
|
||||
} else {
|
||||
console.log('original command', command);
|
||||
console.log(e.stdout?.toString(), e.stderr?.toString());
|
||||
logError(
|
||||
`Original command: ${command}`,
|
||||
`${e.stdout?.toString()}\n\n${e.stderr?.toString()}`
|
||||
);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
@ -415,6 +422,8 @@ export function runCommand(command: string): string {
|
||||
}
|
||||
return r;
|
||||
} catch (e) {
|
||||
// this is intentional
|
||||
// npm ls fails if package is not found
|
||||
return e.stdout.toString() + e.stderr.toString();
|
||||
}
|
||||
}
|
||||
@ -567,9 +576,9 @@ export function logInfo(title: string, body?: string) {
|
||||
}
|
||||
|
||||
export function logError(title: string, body?: string) {
|
||||
const message = `${chalk.reset.inverse.bold.green(
|
||||
' ERROR '
|
||||
)} ${chalk.bold.red(title)}`;
|
||||
const message = `${chalk.reset.inverse.bold.red(' ERROR ')} ${chalk.bold.red(
|
||||
title
|
||||
)}`;
|
||||
return e2eConsoleLogger(message, body);
|
||||
}
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import {
|
||||
checkFilesDoNotExist,
|
||||
checkFilesExist,
|
||||
createFile,
|
||||
isNotWindows,
|
||||
killPorts,
|
||||
newProject,
|
||||
readFile,
|
||||
@ -52,7 +53,7 @@ describe('Web Components Applications', () => {
|
||||
const lintE2eResults = runCLI(`lint ${appName}-e2e`);
|
||||
expect(lintE2eResults).toContain('All files pass linting.');
|
||||
|
||||
if (runCypressTests()) {
|
||||
if (isNotWindows()) {
|
||||
const e2eResults = runCLI(`e2e ${appName}-e2e --headless`);
|
||||
expect(e2eResults).toContain('All specs passed!');
|
||||
expect(await killPorts()).toBeTruthy();
|
||||
|
||||
@ -2,6 +2,7 @@ import * as path from 'path';
|
||||
import {
|
||||
checkFilesExist,
|
||||
exists,
|
||||
isNotWindows,
|
||||
newProject,
|
||||
readFile,
|
||||
readJson,
|
||||
@ -116,6 +117,7 @@ describe('lint', () => {
|
||||
|
||||
describe('format', () => {
|
||||
it('should check and reformat the code', async () => {
|
||||
if (isNotWindows()) {
|
||||
const myapp = uniq('myapp');
|
||||
const mylib = uniq('mylib');
|
||||
|
||||
@ -181,7 +183,9 @@ describe('format', () => {
|
||||
path.normalize(`apps/${myapp}/src/app/app.component.ts`)
|
||||
);
|
||||
|
||||
stdout = runCLI(`format:check --projects=${myapp}`, { silenceError: true });
|
||||
stdout = runCLI(`format:check --projects=${myapp}`, {
|
||||
silenceError: true,
|
||||
});
|
||||
expect(stdout).toContain(path.normalize(`apps/${myapp}/src/main.ts`));
|
||||
expect(stdout).toContain(
|
||||
path.normalize(`apps/${myapp}/src/app/app.module.ts`)
|
||||
@ -238,6 +242,7 @@ describe('format', () => {
|
||||
expect(runCLI('format:check --all')).not.toContain(
|
||||
path.normalize(`apps/${myapp}/src/main.ts`)
|
||||
);
|
||||
}
|
||||
}, 90000);
|
||||
});
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import type { NxJsonConfiguration } from '@nrwl/devkit';
|
||||
import {
|
||||
getPackageManagerCommand,
|
||||
getSelectedPackageManager,
|
||||
isNotWindows,
|
||||
listFiles,
|
||||
newProject,
|
||||
readFile,
|
||||
@ -468,14 +469,15 @@ describe('affected:*', () => {
|
||||
});
|
||||
|
||||
describe('affected (with git)', () => {
|
||||
let myapp = uniq('myapp');
|
||||
let myapp2 = uniq('myapp');
|
||||
let mylib = uniq('mylib');
|
||||
let myapp;
|
||||
let myapp2;
|
||||
let mylib;
|
||||
|
||||
beforeAll(() => newProject());
|
||||
afterAll(() => removeProject({ onlyOnCI: true }));
|
||||
|
||||
it('should not affect other projects by generating a new project', () => {
|
||||
beforeEach(() => {
|
||||
myapp = uniq('myapp');
|
||||
myapp2 = uniq('myapp');
|
||||
mylib = uniq('mylib');
|
||||
newProject();
|
||||
const nxJson: NxJsonConfiguration = readJson('nx.json');
|
||||
|
||||
delete nxJson.implicitDependencies;
|
||||
@ -487,6 +489,19 @@ describe('affected (with git)', () => {
|
||||
runCommand(
|
||||
`git add . && git commit -am "initial commit" && git checkout -b master`
|
||||
);
|
||||
});
|
||||
afterAll(() => removeProject({ onlyOnCI: true }));
|
||||
|
||||
function generateAll() {
|
||||
runCLI(`generate @nrwl/angular:app ${myapp}`);
|
||||
runCLI(`generate @nrwl/angular:app ${myapp2}`);
|
||||
runCLI(`generate @nrwl/angular:lib ${mylib}`);
|
||||
runCommand(`git add . && git commit -am "add all"`);
|
||||
}
|
||||
|
||||
it('should not affect other projects by generating a new project', () => {
|
||||
// TODO: investigate why affected gives different results on windows
|
||||
if (isNotWindows()) {
|
||||
runCLI(`generate @nrwl/angular:app ${myapp}`);
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
runCommand(`git add . && git commit -am "add ${myapp}"`);
|
||||
@ -500,44 +515,52 @@ describe('affected (with git)', () => {
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).toContain(mylib);
|
||||
runCommand(`git add . && git commit -am "add ${mylib}"`);
|
||||
}
|
||||
}, 1000000);
|
||||
|
||||
it('should detect changes to projects based on the nx.json', () => {
|
||||
// TODO: investigate why affected gives different results on windows
|
||||
if (isNotWindows()) {
|
||||
generateAll();
|
||||
const nxJson: NxJsonConfiguration = readJson('nx.json');
|
||||
|
||||
nxJson.projects[myapp].tags = ['tag'];
|
||||
updateFile('nx.json', JSON.stringify(nxJson));
|
||||
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
runCommand(`git add . && git commit -am "add tag to ${myapp}"`);
|
||||
}
|
||||
});
|
||||
|
||||
it('should detect changes to projects based on the workspace.json', () => {
|
||||
// TODO: investigate why affected gives different results on windows
|
||||
if (isNotWindows()) {
|
||||
generateAll();
|
||||
const workspaceJson = readJson(workspaceConfigName());
|
||||
|
||||
workspaceJson.projects[myapp].prefix = 'my-app';
|
||||
updateFile(workspaceConfigName(), JSON.stringify(workspaceJson));
|
||||
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).not.toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
runCommand(`git add . && git commit -am "change prefix for ${myapp}"`);
|
||||
}
|
||||
});
|
||||
|
||||
it('should affect all projects by removing projects', () => {
|
||||
generateAll();
|
||||
const workspaceJson = readJson(workspaceConfigName());
|
||||
const nxJson = readJson('nx.json');
|
||||
|
||||
delete workspaceJson.projects[mylib];
|
||||
updateFile(workspaceConfigName(), JSON.stringify(workspaceJson));
|
||||
|
||||
const nxJson = readJson('nx.json');
|
||||
delete nxJson.projects[mylib];
|
||||
updateFile('nx.json', JSON.stringify(nxJson));
|
||||
|
||||
expect(runCLI('affected:apps')).toContain(myapp);
|
||||
expect(runCLI('affected:apps')).toContain(myapp2);
|
||||
expect(runCLI('affected:libs')).not.toContain(mylib);
|
||||
runCommand(`git add . && git commit -am "remove ${mylib}"`);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -153,6 +153,7 @@
|
||||
"import-fresh": "^3.1.0",
|
||||
"injection-js": "^2.4.0",
|
||||
"is-ci": "^3.0.0",
|
||||
"is-windows": "^1.0.2",
|
||||
"jasmine-core": "~2.99.1",
|
||||
"jasmine-marbles": "~0.6.0",
|
||||
"jasmine-spec-reporter": "~4.2.1",
|
||||
|
||||
@ -48,7 +48,7 @@ export async function conversionGenerator(
|
||||
|
||||
if (projectConfig.projectType === 'application') {
|
||||
await addLintingToApplication(host, {
|
||||
linter: 'eslint' as any,
|
||||
linter: 'eslint',
|
||||
name: projectName,
|
||||
appProjectRoot: projectConfig.root,
|
||||
js,
|
||||
|
||||
@ -13,7 +13,7 @@ describe('<%= pluginName %> e2e', () => {
|
||||
|
||||
const result = await runNxCommandAsync(`build ${plugin}`);
|
||||
expect(result.stdout).toContain('Executor ran');
|
||||
}, 30000)
|
||||
}, 120000)
|
||||
|
||||
describe('--directory', () => {
|
||||
it('should create src in the specified directory', async () => {
|
||||
@ -23,7 +23,7 @@ describe('<%= pluginName %> e2e', () => {
|
||||
`generate <%=npmPackageName%>:<%= pluginName %> ${plugin} --directory subdir`
|
||||
);
|
||||
expect(() => checkFilesExist(`libs/subdir/${plugin}/src/index.ts`)).not.toThrow();
|
||||
}, 30000);
|
||||
}, 120000);
|
||||
});
|
||||
|
||||
describe('--tags', () => {
|
||||
@ -35,6 +35,6 @@ describe('<%= pluginName %> e2e', () => {
|
||||
);
|
||||
const nxJson = readJson('nx.json');
|
||||
expect(nxJson.projects[plugin].tags).toEqual(['e2etag', 'e2ePackage']);
|
||||
}, 30000);
|
||||
}, 120000);
|
||||
});
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user