Skip to content

Commit af0ef74

Browse files
committed
test: remove common-tags dependency from E2E tests
The `common-tags` development dependency was only used in several E2E tests. Removing the usage of the dependency also allows it to be removed as a development dependency from the root `package.json`.
1 parent 175cd51 commit af0ef74

File tree

18 files changed

+232
-279
lines changed

18 files changed

+232
-279
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
"browserslist": "^4.9.1",
129129
"cacache": "15.3.0",
130130
"chokidar": "^3.5.2",
131-
"common-tags": "^1.8.0",
132131
"copy-webpack-plugin": "10.2.4",
133132
"core-js": "3.21.1",
134133
"critters": "0.0.16",

tests/legacy-cli/e2e/tests/basic/scripts-array.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { oneLineTrim } from 'common-tags';
21
import { appendToFile, expectFileToMatch, writeMultipleFiles } from '../../utils/fs';
32
import { ng } from '../../utils/process';
43
import { updateJsonFile } from '../../utils/project';
@@ -53,13 +52,13 @@ export default async function () {
5352
// index.html lists the right bundles
5453
await expectFileToMatch(
5554
'dist/test-project/index.html',
56-
oneLineTrim`
57-
<script src="runtime.js" type="module"></script>
58-
<script src="polyfills.js" type="module"></script>
59-
<script src="scripts.js" defer></script>
60-
<script src="renamed-script.js" defer></script>
61-
<script src="vendor.js" type="module"></script>
62-
<script src="main.js" type="module"></script>
63-
`,
55+
[
56+
'<script src="runtime.js" type="module"></script>',
57+
'<script src="polyfills.js" type="module"></script>',
58+
'<script src="scripts.js" defer></script>',
59+
'<script src="renamed-script.js" defer></script>',
60+
'<script src="vendor.js" type="module"></script>',
61+
'<script src="main.js" type="module"></script>',
62+
].join(''),
6463
);
6564
}

tests/legacy-cli/e2e/tests/basic/styles-array.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { oneLineTrim } from 'common-tags';
21
import { expectFileToMatch, writeMultipleFiles } from '../../utils/fs';
32
import { ng } from '../../utils/process';
43
import { updateJsonFile } from '../../utils/project';
@@ -36,10 +35,7 @@ export default async function () {
3635
await expectFileToMatch('dist/test-project/renamed-lazy-style.css', '.pre-rename-lazy-style');
3736
await expectFileToMatch(
3837
'dist/test-project/index.html',
39-
oneLineTrim`
40-
<link rel="stylesheet" href="styles.css">
41-
<link rel="stylesheet" href="renamed-style.css">
42-
`,
38+
'<link rel="stylesheet" href="styles.css"><link rel="stylesheet" href="renamed-style.css">',
4339
);
4440

4541
// Non injected styles should be listed under lazy chunk files

tests/legacy-cli/e2e/tests/build/polyfills.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { oneLineTrim } from 'common-tags';
21
import {
32
expectFileSizeToBeUnder,
43
expectFileToExist,

tests/legacy-cli/e2e/tests/build/styles/imports.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import { writeMultipleFiles, expectFileToMatch, replaceInFile } from '../../../utils/fs';
22
import { expectToFail } from '../../../utils/utils';
33
import { ng } from '../../../utils/process';
4-
import { stripIndents } from 'common-tags';
54
import { updateJsonFile } from '../../../utils/project';
6-
import { getGlobalVariable } from '../../../utils/env';
75

86
export default function () {
97
// TODO(architect): Delete this test. It is now in devkit/build-angular.
@@ -15,24 +13,22 @@ export default function () {
1513
promise = promise.then(() => {
1614
return (
1715
writeMultipleFiles({
18-
[`src/styles.${ext}`]: stripIndents`
16+
[`src/styles.${ext}`]: `
1917
@import './imported-styles.${ext}';
2018
body { background-color: #00f; }
2119
`,
22-
[`src/imported-styles.${ext}`]: stripIndents`
20+
[`src/imported-styles.${ext}`]: `
2321
p { background-color: #f00; }
2422
`,
25-
[`src/app/app.component.${ext}`]: stripIndents`
23+
[`src/app/app.component.${ext}`]: `
2624
@import './imported-component-styles.${ext}';
2725
.outer {
2826
.inner {
2927
background: #fff;
3028
}
3129
}
3230
`,
33-
[`src/app/imported-component-styles.${ext}`]: stripIndents`
34-
h1 { background: #000; }
35-
`,
31+
[`src/app/imported-component-styles.${ext}`]: 'h1 { background: #000; }',
3632
})
3733
// change files to use preprocessor
3834
.then(() =>

tests/legacy-cli/e2e/tests/build/styles/less.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,18 @@ import {
66
} from '../../../utils/fs';
77
import { expectToFail } from '../../../utils/utils';
88
import { ng } from '../../../utils/process';
9-
import { stripIndents } from 'common-tags';
109
import { updateJsonFile } from '../../../utils/project';
1110

1211
export default function () {
1312
// TODO(architect): Delete this test. It is now in devkit/build-angular.
1413

1514
return writeMultipleFiles({
16-
'src/styles.less': stripIndents`
15+
'src/styles.less': `
1716
@import './imported-styles.less';
1817
body { background-color: blue; }
1918
`,
20-
'src/imported-styles.less': stripIndents`
21-
p { background-color: red; }
22-
`,
23-
'src/app/app.component.less': stripIndents`
19+
'src/imported-styles.less': 'p { background-color: red; }',
20+
'src/app/app.component.less': `
2421
.outer {
2522
.inner {
2623
background: #fff;

tests/legacy-cli/e2e/tests/build/styles/loaders.ts

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,39 @@ import {
22
writeMultipleFiles,
33
deleteFile,
44
expectFileToMatch,
5-
replaceInFile
5+
replaceInFile,
66
} from '../../../utils/fs';
77
import { ng } from '../../../utils/process';
8-
import { stripIndents } from 'common-tags';
98
import { updateJsonFile } from '../../../utils/project';
109
import { expectToFail } from '../../../utils/utils';
1110

12-
export default function () {
13-
return writeMultipleFiles({
14-
'src/styles.scss': stripIndents`
11+
export default async function () {
12+
await writeMultipleFiles({
13+
'src/styles.scss': `
1514
@import './imported-styles.scss';
1615
body { background-color: blue; }
1716
`,
18-
'src/imported-styles.scss': stripIndents`
19-
p { background-color: red; }
20-
`,
21-
'src/app/app.component.scss': stripIndents`
22-
.outer {
23-
.inner {
24-
background: #fff;
25-
}
17+
'src/imported-styles.scss': 'p { background-color: red; }',
18+
'src/app/app.component.scss': `
19+
.outer {
20+
.inner {
21+
background: #fff;
2622
}
27-
`})
28-
.then(() => deleteFile('src/app/app.component.css'))
29-
.then(() => updateJsonFile('angular.json', workspaceJson => {
30-
const appArchitect = workspaceJson.projects['test-project'].architect;
31-
appArchitect.build.options.styles = [
32-
{ input: 'src/styles.scss' },
33-
];
34-
}))
35-
.then(() => replaceInFile('src/app/app.component.ts',
36-
'./app.component.css', './app.component.scss'))
37-
.then(() => ng('build', '--configuration=development'))
38-
.then(() => expectToFail(() => expectFileToMatch('dist/test-project/styles.css', /exports/)))
39-
.then(() => expectToFail(() => expectFileToMatch('dist/test-project/main-es5.js',
40-
/".*module\.exports.*\.outer.*background:/)));
23+
}
24+
`,
25+
});
26+
27+
await deleteFile('src/app/app.component.css');
28+
await updateJsonFile('angular.json', (workspaceJson) => {
29+
const appArchitect = workspaceJson.projects['test-project'].architect;
30+
appArchitect.build.options.styles = [{ input: 'src/styles.scss' }];
31+
});
32+
await replaceInFile('src/app/app.component.ts', './app.component.css', './app.component.scss');
33+
34+
await ng('build', '--configuration=development');
35+
36+
await expectToFail(() => expectFileToMatch('dist/test-project/styles.css', /exports/));
37+
await expectToFail(() =>
38+
expectFileToMatch('dist/test-project/main.js', /".*module\.exports.*\.outer.*background:/),
39+
);
4140
}

tests/legacy-cli/e2e/tests/build/styles/material-import.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { stripIndents } from 'common-tags';
21
import { getGlobalVariable } from '../../../utils/env';
32
import { replaceInFile, writeMultipleFiles } from '../../../utils/fs';
43
import { installWorkspacePackages } from '../../../utils/packages';
@@ -25,12 +24,9 @@ export default async function () {
2524

2625
for (const ext of ['css', 'scss', 'less', 'styl']) {
2726
await writeMultipleFiles({
28-
[`src/styles.${ext}`]: stripIndents`
29-
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
30-
`,
31-
[`src/app/app.component.${ext}`]: stripIndents`
32-
@import "~@angular/material/prebuilt-themes/indigo-pink.css";
33-
`,
27+
[`src/styles.${ext}`]: '@import "~@angular/material/prebuilt-themes/indigo-pink.css";',
28+
[`src/app/app.component.${ext}`]:
29+
'@import "~@angular/material/prebuilt-themes/indigo-pink.css";',
3430
});
3531

3632
// change files to use preprocessor
@@ -48,12 +44,9 @@ export default async function () {
4844
// run build app
4945
await ng('build', '--source-map', '--configuration=development');
5046
await writeMultipleFiles({
51-
[`src/styles.${ext}`]: stripIndents`
52-
@import "@angular/material/prebuilt-themes/indigo-pink.css";
53-
`,
54-
[`src/app/app.component.${ext}`]: stripIndents`
55-
@import "@angular/material/prebuilt-themes/indigo-pink.css";
56-
`,
47+
[`src/styles.${ext}`]: '@import "@angular/material/prebuilt-themes/indigo-pink.css";',
48+
[`src/app/app.component.${ext}`]:
49+
'@import "@angular/material/prebuilt-themes/indigo-pink.css";',
5750
});
5851

5952
await ng('build', '--configuration=development');

tests/legacy-cli/e2e/tests/build/styles/scss.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,18 @@ import {
66
} from '../../../utils/fs';
77
import { expectToFail } from '../../../utils/utils';
88
import { ng } from '../../../utils/process';
9-
import { stripIndents } from 'common-tags';
109
import { updateJsonFile } from '../../../utils/project';
1110

1211
export default function () {
1312
// TODO(architect): Delete this test. It is now in devkit/build-angular.
1413

1514
return writeMultipleFiles({
16-
'src/styles.scss': stripIndents`
15+
'src/styles.scss': `
1716
@import './imported-styles.scss';
1817
body { background-color: blue; }
1918
`,
20-
'src/imported-styles.scss': stripIndents`
21-
p { background-color: red; }
22-
`,
23-
'src/app/app.component.scss': stripIndents`
19+
'src/imported-styles.scss': 'p { background-color: red; }',
20+
'src/app/app.component.scss': `
2421
.outer {
2522
.inner {
2623
background: #fff;

tests/legacy-cli/e2e/tests/build/styles/stylus.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,18 @@ import {
66
} from '../../../utils/fs';
77
import { expectToFail } from '../../../utils/utils';
88
import { ng } from '../../../utils/process';
9-
import { stripIndents } from 'common-tags';
109
import { updateJsonFile } from '../../../utils/project';
1110

1211
export default function () {
1312
// TODO(architect): Delete this test. It is now in devkit/build-angular.
1413

1514
return writeMultipleFiles({
16-
'src/styles.styl': stripIndents`
15+
'src/styles.styl': `
1716
@import './imported-styles.styl';
1817
body { background-color: blue; }
1918
`,
20-
'src/imported-styles.styl': stripIndents`
21-
p { background-color: red; }
22-
`,
23-
'src/app/app.component.styl': stripIndents`
19+
'src/imported-styles.styl': 'p { background-color: red; }',
20+
'src/app/app.component.styl': `
2421
.outer {
2522
.inner {
2623
background: #fff;

0 commit comments

Comments
 (0)