1
- import { ng } from '../../../utils/process' ;
2
- import { expectFileToMatch , writeFile , createDir , appendToFile , readFile } from '../../../utils/fs' ;
3
- import { expectToFail } from '../../../utils/utils' ;
4
- import { Version } from '../../../../../packages/@angular/cli/upgrade/version' ;
5
- import { SemVer } from 'semver' ;
1
+ import { ng } from '../../../utils/process' ;
2
+ import { expectFileToMatch , writeFile , createDir , appendToFile , readFile } from '../../../utils/fs' ;
3
+ import { expectToFail } from '../../../utils/utils' ;
4
+ import { Version } from '../../../../../packages/@angular/cli/upgrade/version' ;
5
+ import { SemVer } from 'semver' ;
6
6
7
- export default function ( ) {
8
- // TODO(architect): reenable, validate, then delete this test. It is now in devkit/build-webpack.
9
- return ;
7
+ export default function ( ) {
8
+ // TODO(architect): Delete this test. It is now in devkit/build-webpack.
10
9
11
10
return Promise . resolve ( )
12
11
. then ( ( ) => createDir ( 'src/locale' ) )
@@ -25,37 +24,17 @@ export default function() {
25
24
</xliff>` ) )
26
25
. then ( ( ) => appendToFile ( 'src/app/app.component.html' ,
27
26
'<h1 i18n="An introduction header for this sample">Hello i18n!</h1>' ) )
28
- . then ( ( ) => ng ( 'build' , '--aot' , '--i18n-file' , 'src/ locale/messages.fr.xlf' , '--i18n-format' ,
27
+ . then ( ( ) => ng ( 'build' , '--aot' , '--i18n-file' , 'locale/messages.fr.xlf' , '--i18n-format' ,
29
28
'xlf' , '--i18n-locale' , 'fr' ) )
30
29
. then ( ( ) => expectFileToMatch ( 'dist/main.js' , / B o n j o u r i 1 8 n ! / ) )
31
30
. then ( ( ) => ng ( 'build' , '--aot' ) )
32
31
. then ( ( ) => expectToFail ( ( ) => expectFileToMatch ( 'dist/main.js' , / B o n j o u r i 1 8 n ! / ) ) )
33
32
. then ( ( ) => expectFileToMatch ( 'dist/main.js' , / H e l l o i 1 8 n ! / ) )
34
33
. then ( ( ) => appendToFile ( 'src/app/app.component.html' ,
35
34
'<p i18n>Other content</p>' ) )
36
- . then ( ( ) => readFile ( 'node_modules/@angular/compiler-cli/package.json' )
37
- . then ( ( compilerCliPackage ) : any => {
38
- const version = new Version ( JSON . parse ( compilerCliPackage ) . version ) ;
39
- if ( version . major === 2 ) {
40
- return expectToFail ( ( ) => ng ( 'build' , '--aot' , '--i18nFile' , 'src/locale/messages.fr.xlf' ,
41
- '--i18nFormat' , 'xlf' , '--i18n-locale' , 'fr' , '--i18n-missing-translation' , 'ignore' ) ) ;
42
- } else {
43
- return ng ( 'build' , '--aot' , '--i18nFile' , 'src/locale/messages.fr.xlf' , '--i18nFormat' ,
44
- 'xlf' , '--i18n-locale' , 'fr' , '--i18n-missing-translation' , 'ignore' )
45
- . then ( ( ) => expectFileToMatch ( 'dist/main.js' , / O t h e r c o n t e n t / ) ) ;
46
- }
47
- } )
48
- )
49
- . then ( ( ) => readFile ( 'node_modules/@angular/compiler-cli/package.json' )
50
- . then ( ( compilerCliPackage ) : any => {
51
- const version = new Version ( JSON . parse ( compilerCliPackage ) . version ) ;
52
- if ( version . isGreaterThanOrEqualTo ( new SemVer ( '4.2.0-beta.0' ) ) || version . major === 2 ) {
53
- return expectToFail ( ( ) => ng ( 'build' , '--aot' , '--i18nFile' , 'src/locale/messages.fr.xlf' ,
54
- '--i18nFormat' , 'xlf' , '--i18n-locale' , 'fr' , '--i18n-missing-translation' , 'error' ) ) ;
55
- } else {
56
- return ng ( 'build' , '--aot' , '--i18nFile' , 'src/locale/messages.fr.xlf' ,
57
- '--i18nFormat' , 'xlf' , '--i18n-locale' , 'fr' , '--i18n-missing-translation' , 'error' ) ;
58
- }
59
- } )
60
- ) ;
35
+ . then ( ( ) => ng ( 'build' , '--aot' , '--i18nFile' , 'locale/messages.fr.xlf' , '--i18nFormat' ,
36
+ 'xlf' , '--i18n-locale' , 'fr' , '--i18n-missing-translation' , 'ignore' ) )
37
+ . then ( ( ) => expectFileToMatch ( 'dist/main.js' , / O t h e r c o n t e n t / ) )
38
+ . then ( ( ) => expectToFail ( ( ) => ng ( 'build' , '--aot' , '--i18nFile' , 'locale/messages.fr.xlf' ,
39
+ '--i18nFormat' , 'xlf' , '--i18n-locale' , 'fr' , '--i18n-missing-translation' , 'error' ) ) ) ;
61
40
}
0 commit comments