Skip to content

Commit 76d0115

Browse files
committed
test: simplify test sourcemaps e2e test
(cherry picked from commit 59fe830)
1 parent 23095e9 commit 76d0115

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

tests/legacy-cli/e2e/tests/test/test-sourcemap.ts

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { writeFile } from '../../utils/fs';
22
import { ng } from '../../utils/process';
3-
import { updateJsonFile } from '../../utils/project';
43

54
export default async function () {
65
await writeFile(
@@ -12,46 +11,19 @@ export default async function () {
1211
`,
1312
);
1413

15-
await updateJsonFile('angular.json', (configJson) => {
16-
const appArchitect = configJson.projects['test-project'].architect;
17-
appArchitect.test.options.sourceMap = {
18-
scripts: true,
19-
};
20-
});
21-
22-
// when sourcemaps are 'on' the stacktrace will point to the spec.ts file.
23-
try {
24-
await ng('test', '--watch', 'false');
25-
throw new Error('ng test should have failed.');
26-
} catch (error) {
27-
if (!error.message.includes('app.component.spec.ts')) {
28-
throw error;
29-
}
30-
}
31-
32-
await updateJsonFile('angular.json', (configJson) => {
33-
const appArchitect = configJson.projects['test-project'].architect;
34-
appArchitect.test.options.sourceMap = true;
35-
});
36-
3714
// when sourcemaps are 'on' the stacktrace will point to the spec.ts file.
3815
try {
39-
await ng('test', '--watch', 'false');
16+
await ng('test', '--no-watch', '--source-map');
4017
throw new Error('ng test should have failed.');
4118
} catch (error) {
4219
if (!error.message.includes('app.component.spec.ts')) {
4320
throw error;
4421
}
4522
}
4623

47-
await updateJsonFile('angular.json', (configJson) => {
48-
const appArchitect = configJson.projects['test-project'].architect;
49-
appArchitect.test.options.sourceMap = false;
50-
});
51-
5224
// when sourcemaps are 'off' the stacktrace won't point to the spec.ts file.
5325
try {
54-
await ng('test', '--watch', 'false');
26+
await ng('test', '--no-watch', '--no-source-map');
5527
throw new Error('ng test should have failed.');
5628
} catch (error) {
5729
if (!error.message.includes('main.js')) {

0 commit comments

Comments
 (0)