fix(repo): fix tests (#4617)
This commit is contained in:
parent
e003d528e1
commit
1eda4dca18
@ -38,12 +38,15 @@ describe('lint', () => {
|
|||||||
runCLI(`generate @nrwl/angular:lib ${invalidtaglib} --tags=invalidtag`);
|
runCLI(`generate @nrwl/angular:lib ${invalidtaglib} --tags=invalidtag`);
|
||||||
runCLI(`generate @nrwl/angular:lib ${validtaglib} --tags=validtag`);
|
runCLI(`generate @nrwl/angular:lib ${validtaglib} --tags=validtag`);
|
||||||
|
|
||||||
const tslint = readJson('tslint.json');
|
const eslint = readJson('.eslintrc.json');
|
||||||
tslint.rules['nx-enforce-module-boundaries'][1].depConstraints = [
|
eslint.overrides[0].rules[
|
||||||
|
'@nrwl/nx/enforce-module-boundaries'
|
||||||
|
][1].depConstraints = [
|
||||||
{ sourceTag: 'validtag', onlyDependOnLibsWithTags: ['validtag'] },
|
{ sourceTag: 'validtag', onlyDependOnLibsWithTags: ['validtag'] },
|
||||||
...tslint.rules['nx-enforce-module-boundaries'][1].depConstraints,
|
...eslint.overrides[0].rules['@nrwl/nx/enforce-module-boundaries'][1]
|
||||||
|
.depConstraints,
|
||||||
];
|
];
|
||||||
updateFile('tslint.json', JSON.stringify(tslint, null, 2));
|
updateFile('.eslintrc.json', JSON.stringify(eslint, null, 2));
|
||||||
|
|
||||||
const tsConfig = readJson('tsconfig.base.json');
|
const tsConfig = readJson('tsconfig.base.json');
|
||||||
|
|
||||||
@ -76,10 +79,10 @@ describe('lint', () => {
|
|||||||
|
|
||||||
const out = runCLI(`lint ${myapp}`, { silenceError: true });
|
const out = runCLI(`lint ${myapp}`, { silenceError: true });
|
||||||
expect(out).toContain(
|
expect(out).toContain(
|
||||||
'libraries cannot be imported by a relative or absolute path, and must begin with a npm scope'
|
'Libraries cannot be imported by a relative or absolute path, and must begin with a npm scope'
|
||||||
);
|
);
|
||||||
expect(out).toContain('imports of lazy-loaded libraries are forbidden');
|
expect(out).toContain('Imports of lazy-loaded libraries are forbidden');
|
||||||
expect(out).toContain('imports of apps are forbidden');
|
expect(out).toContain('Imports of apps are forbidden');
|
||||||
expect(out).toContain(
|
expect(out).toContain(
|
||||||
'A project tagged with "validtag" can only depend on libs tagged with "validtag"'
|
'A project tagged with "validtag" can only depend on libs tagged with "validtag"'
|
||||||
);
|
);
|
||||||
@ -582,7 +585,7 @@ describe('Move Angular Project', () => {
|
|||||||
expect(moveOutput).toContain(`CREATE apps/${newPath}/tsconfig.app.json`);
|
expect(moveOutput).toContain(`CREATE apps/${newPath}/tsconfig.app.json`);
|
||||||
expect(moveOutput).toContain(`CREATE apps/${newPath}/tsconfig.json`);
|
expect(moveOutput).toContain(`CREATE apps/${newPath}/tsconfig.json`);
|
||||||
expect(moveOutput).toContain(`CREATE apps/${newPath}/tsconfig.spec.json`);
|
expect(moveOutput).toContain(`CREATE apps/${newPath}/tsconfig.spec.json`);
|
||||||
expect(moveOutput).toContain(`CREATE apps/${newPath}/tslint.json`);
|
expect(moveOutput).toContain(`CREATE apps/${newPath}/.eslintrc.json`);
|
||||||
expect(moveOutput).toContain(`CREATE apps/${newPath}/src/favicon.ico`);
|
expect(moveOutput).toContain(`CREATE apps/${newPath}/src/favicon.ico`);
|
||||||
expect(moveOutput).toContain(`CREATE apps/${newPath}/src/index.html`);
|
expect(moveOutput).toContain(`CREATE apps/${newPath}/src/index.html`);
|
||||||
expect(moveOutput).toContain(`CREATE apps/${newPath}/src/main.ts`);
|
expect(moveOutput).toContain(`CREATE apps/${newPath}/src/main.ts`);
|
||||||
|
|||||||
@ -15,14 +15,5 @@ export function normalizePath(osSpecificPath: string): string {
|
|||||||
* Normalized path fragments and joins them
|
* Normalized path fragments and joins them
|
||||||
*/
|
*/
|
||||||
export function joinPathFragments(...fragments: string[]): string {
|
export function joinPathFragments(...fragments: string[]): string {
|
||||||
const normalizedFragments = [];
|
return normalizePath(path.join(...fragments));
|
||||||
for (let i = 0; i < fragments.length; ++i) {
|
|
||||||
if (i === 0) {
|
|
||||||
normalizedFragments.push(normalizePath(fragments[i]));
|
|
||||||
} else {
|
|
||||||
const n = normalizePath(fragments[i]);
|
|
||||||
normalizedFragments.push(n.startsWith('/') ? n.substring(1) : n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return normalizedFragments.join('/');
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,13 +93,11 @@ describe('schematic:configuration', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(project.architect.lint).toEqual({
|
expect(project.architect.lint).toEqual({
|
||||||
builder: '@angular-devkit/build-angular:tslint',
|
builder: '@nrwl/linter:eslint',
|
||||||
options: {
|
options: {
|
||||||
exclude: ['**/node_modules/**', '!libs/test-ui-lib/**/*'],
|
lintFilePatterns: [
|
||||||
tsConfig: [
|
'libs/test-ui-lib/src/**/*.ts',
|
||||||
'libs/test-ui-lib/tsconfig.lib.json',
|
'libs/test-ui-lib/src/**/*.html',
|
||||||
'libs/test-ui-lib/tsconfig.spec.json',
|
|
||||||
'libs/test-ui-lib/.storybook/tsconfig.json',
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -77,7 +77,11 @@ function updateRootTsConfig(host: Tree, options: NormalizedSchema) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.paths[options.importPath] = [
|
c.paths[options.importPath] = [
|
||||||
join(options.projectRoot, './src', 'index.' + (options.js ? 'js' : 'ts')),
|
joinPathFragments(
|
||||||
|
options.projectRoot,
|
||||||
|
'./src',
|
||||||
|
'index.' + (options.js ? 'js' : 'ts')
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user