Skip to content

Commit 3195183

Browse files
committed
Assert an AotPlugin instance is present in webpack compilation.
Revisit e2e tests.
1 parent ccc7aed commit 3195183

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

packages/@ngtools/webpack/src/extract_i18n_plugin.ts

+4
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ export class ExtractI18nPlugin implements Tapable {
138138
return cb(new Error('An @ngtools/webpack xi18n plugin already exist for ' +
139139
'this compilation.'));
140140
}
141+
if (!this._compilation._ngToolsWebpackPluginInstance) {
142+
return cb(new Error('An @ngtools/webpack aot plugin does not exists ' +
143+
'for this compilation'));
144+
}
141145

142146
this._compilation._ngToolsWebpackXi18nPluginInstance = this;
143147

tests/e2e/tests/i18n/extract-default.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import {join} from 'path';
22
import {ng} from '../../utils/process';
33
import {
4-
expectFileToExist, deleteFile, writeFile,
4+
expectFileToExist, writeFile,
55
expectFileToMatch
66
} from '../../utils/fs';
77

88

99
export default function() {
10-
const testComponentDir = join('src/app', 'i18n-test');
1110
return ng('generate', 'component', 'i18n-test')
12-
.then(() => deleteFile(join(testComponentDir, 'i18n-test.component.html')))
1311
.then(() => writeFile(
14-
join(testComponentDir, 'i18n-test.component.html'),
12+
join('src/app/i18n-test', 'i18n-test.component.html'),
1513
'<p i18n>Hello world</p>'))
1614
.then(() => ng('xi18n', '--no-progress'))
1715
.then(() => expectFileToExist(join('src', 'messages.xlf')))

tests/e2e/tests/i18n/extract-output.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import {join} from 'path';
22
import {ng} from '../../utils/process';
33
import {
4-
expectFileToExist, deleteFile, writeFile,
4+
expectFileToExist, writeFile,
55
expectFileToMatch
66
} from '../../utils/fs';
77

88

99
export default function() {
10-
const testComponentDir = join('src/app', 'i18n-test');
1110
return ng('generate', 'component', 'i18n-test')
12-
.then(() => deleteFile(join(testComponentDir, 'i18n-test.component.html')))
1311
.then(() => writeFile(
14-
join(testComponentDir, 'i18n-test.component.html'),
12+
join('src/app/i18n-test', 'i18n-test.component.html'),
1513
'<p i18n>Hello world</p>'))
1614
.then(() => ng('xi18n', '--no-progress', '--output-path', 'src/locale'))
1715
.then(() => expectFileToExist(join('src', 'locale', 'messages.xlf')))

tests/e2e/tests/i18n/extract-xmb.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import {join} from 'path';
22
import {ng} from '../../utils/process';
33
import {
4-
expectFileToExist, deleteFile, writeFile,
4+
expectFileToExist, writeFile,
55
expectFileToMatch
66
} from '../../utils/fs';
77

88

99
export default function() {
10-
const testComponentDir = join('src/app', 'i18n-test');
1110
return ng('generate', 'component', 'i18n-test')
12-
.then(() => deleteFile(join(testComponentDir, 'i18n-test.component.html')))
1311
.then(() => writeFile(
14-
join(testComponentDir, 'i18n-test.component.html'),
12+
join('src/app/i18n-test', 'i18n-test.component.html'),
1513
'<p i18n>Hello world</p>'))
1614
.then(() => ng('xi18n', '--no-progress', '--i18n-format', 'xmb'))
1715
.then(() => expectFileToExist(join('src', 'messages.xmb')))

0 commit comments

Comments
 (0)