test: fix ngcc integration tests in windows (#30297)
``` //packages/compiler-cli/ngcc/test:integration ``` Partially addresses #29785 PR Close #30297
This commit is contained in:
parent
1bd4891c9a
commit
18c0ba5272
|
@ -23,7 +23,7 @@ export class NodeJSFileSystem implements FileSystem {
|
||||||
readdir(path: AbsoluteFsPath): PathSegment[] { return fs.readdirSync(path) as PathSegment[]; }
|
readdir(path: AbsoluteFsPath): PathSegment[] { return fs.readdirSync(path) as PathSegment[]; }
|
||||||
lstat(path: AbsoluteFsPath): fs.Stats { return fs.lstatSync(path); }
|
lstat(path: AbsoluteFsPath): fs.Stats { return fs.lstatSync(path); }
|
||||||
stat(path: AbsoluteFsPath): fs.Stats { return fs.statSync(path); }
|
stat(path: AbsoluteFsPath): fs.Stats { return fs.statSync(path); }
|
||||||
pwd() { return AbsoluteFsPath.fromUnchecked(process.cwd()); }
|
pwd() { return AbsoluteFsPath.from(process.cwd()); }
|
||||||
copyFile(from: AbsoluteFsPath, to: AbsoluteFsPath): void { cp(from, to); }
|
copyFile(from: AbsoluteFsPath, to: AbsoluteFsPath): void { cp(from, to); }
|
||||||
moveFile(from: AbsoluteFsPath, to: AbsoluteFsPath): void { mv(from, to); }
|
moveFile(from: AbsoluteFsPath, to: AbsoluteFsPath): void { mv(from, to); }
|
||||||
ensureDir(path: AbsoluteFsPath): void { mkdir('-p', path); }
|
ensureDir(path: AbsoluteFsPath): void { mkdir('-p', path); }
|
||||||
|
|
|
@ -92,7 +92,7 @@ export class EntryPointFinder {
|
||||||
entryPoints.push(...this.getEntryPointsForPackage(packagePath));
|
entryPoints.push(...this.getEntryPointsForPackage(packagePath));
|
||||||
|
|
||||||
// Also check for any nested node_modules in this package
|
// Also check for any nested node_modules in this package
|
||||||
const nestedNodeModulesPath = AbsoluteFsPath.resolve(packagePath, 'node_modules');
|
const nestedNodeModulesPath = AbsoluteFsPath.join(packagePath, 'node_modules');
|
||||||
if (this.fs.exists(nestedNodeModulesPath)) {
|
if (this.fs.exists(nestedNodeModulesPath)) {
|
||||||
entryPoints.push(...this.walkDirectoryForEntryPoints(nestedNodeModulesPath));
|
entryPoints.push(...this.walkDirectoryForEntryPoints(nestedNodeModulesPath));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AbsoluteFsPath} from '@angular/compiler-cli/src/ngtsc/path';
|
import {AbsoluteFsPath} from '@angular/compiler-cli/src/ngtsc/path';
|
||||||
import {existsSync, readFileSync, readdirSync, statSync, writeFileSync} from 'fs';
|
import {existsSync, readFileSync, readdirSync, statSync, symlinkSync} from 'fs';
|
||||||
import * as mockFs from 'mock-fs';
|
import * as mockFs from 'mock-fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
import {getAngularPackagesFromRunfiles, resolveNpmTreeArtifact} from '../../../test/runfile_helpers';
|
import {getAngularPackagesFromRunfiles, resolveNpmTreeArtifact} from '../../../test/runfile_helpers';
|
||||||
import {NodeJSFileSystem} from '../../src/file_system/node_js_file_system';
|
import {NodeJSFileSystem} from '../../src/file_system/node_js_file_system';
|
||||||
|
@ -333,10 +334,15 @@ describe('ngcc main()', () => {
|
||||||
|
|
||||||
|
|
||||||
function createMockFileSystem() {
|
function createMockFileSystem() {
|
||||||
|
const typeScriptPath = path.join(process.env.RUNFILES !, 'typescript');
|
||||||
|
if (!existsSync(typeScriptPath)) {
|
||||||
|
symlinkSync(resolveNpmTreeArtifact('typescript'), typeScriptPath, 'junction');
|
||||||
|
}
|
||||||
|
|
||||||
mockFs({
|
mockFs({
|
||||||
'/node_modules/@angular': loadAngularPackages(),
|
'/node_modules/@angular': loadAngularPackages(),
|
||||||
'/node_modules/rxjs': loadDirectory(resolveNpmTreeArtifact('rxjs', 'index.js')),
|
'/node_modules/rxjs': loadDirectory(resolveNpmTreeArtifact('rxjs')),
|
||||||
'/node_modules/tslib': loadDirectory(resolveNpmTreeArtifact('tslib', 'tslib.js')),
|
'/node_modules/tslib': loadDirectory(resolveNpmTreeArtifact('tslib')),
|
||||||
'/node_modules/test-package': {
|
'/node_modules/test-package': {
|
||||||
'package.json': '{"name": "test-package", "es2015": "./index.js", "typings": "./index.d.ts"}',
|
'package.json': '{"name": "test-package", "es2015": "./index.js", "typings": "./index.d.ts"}',
|
||||||
// no metadata.json file so not compiled by Angular.
|
// no metadata.json file so not compiled by Angular.
|
||||||
|
|
Loading…
Reference in New Issue