|
8 | 8 |
|
9 | 9 | import { EmptyTree } from '@angular-devkit/schematics'; |
10 | 10 | import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; |
| 11 | +import { getWorkspaceTargets, updateWorkspaceTargets } from './update-workspace-config_spec'; |
11 | 12 |
|
12 | 13 | // tslint:disable-next-line: no-any |
13 | 14 | function overrideJsonFile(tree: UnitTestTree, path: string, newContent: object) { |
@@ -64,6 +65,32 @@ describe('Migration to version 9', () => { |
64 | 65 | expect(files).toEqual(['src/main.ts', 'src/polyfills.ts']); |
65 | 66 | }); |
66 | 67 |
|
| 68 | + it('should resolve paths correctly even if they are using windows separators', async () => { |
| 69 | + const tree2 = await schematicRunner |
| 70 | + .runExternalSchematicAsync( |
| 71 | + require.resolve('../../collection.json'), |
| 72 | + 'application', |
| 73 | + { |
| 74 | + name: 'another-app', |
| 75 | + }, |
| 76 | + tree, |
| 77 | + ) |
| 78 | + .toPromise(); |
| 79 | + |
| 80 | + const tsCfgPath = 'projects/another-app/tsconfig.app.json'; |
| 81 | + overrideJsonFile(tree2, tsCfgPath, defaultTsConfigOptions); |
| 82 | + const config = getWorkspaceTargets(tree2, 'another-app'); |
| 83 | + config.build.options.main = 'projects\\another-app\\src\\main.ts'; |
| 84 | + config.build.options.polyfills = 'projects\\another-app\\src\\polyfills.ts'; |
| 85 | + config.build.options.tsConfig = 'projects\\another-app\\tsconfig.app.json'; |
| 86 | + updateWorkspaceTargets(tree2, config, 'another-app'); |
| 87 | + |
| 88 | + const tree3 = await schematicRunner.runSchematicAsync('workspace-version-9', {}, tree2.branch()).toPromise(); |
| 89 | + const { exclude, files } = JSON.parse(tree3.readContent(tsCfgPath)); |
| 90 | + expect(exclude).toBeUndefined(); |
| 91 | + expect(files).toEqual(['src/main.ts', 'src/polyfills.ts']); |
| 92 | + }); |
| 93 | + |
67 | 94 | it('should update apps tsConfig when tsconfig has include', async () => { |
68 | 95 | const tsConfigContent = { |
69 | 96 | ...defaultTsConfigOptions, |
|
0 commit comments