Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): sourceMap option not working in t…
Browse files Browse the repository at this point in the history
…ests

Fixes #13766
  • Loading branch information
Alan Agius authored and mgechev committed Feb 26, 2019
1 parent 3420f66 commit 324b256
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Expand Up @@ -60,8 +60,8 @@ export function getTestConfig(
const { styles, scripts } = wco.buildOptions.sourceMap;

extraPlugins.push(getSourceMapDevTool(
styles,
scripts,
scripts || false,
styles || false,
false,
true,
));
Expand Down
29 changes: 29 additions & 0 deletions tests/legacy-cli/e2e/tests/test/test-sourcemap.ts
@@ -0,0 +1,29 @@
import { writeFile } from '../../utils/fs';
import { execAndWaitForOutputToMatch, killAllProcesses } from '../../utils/process';
import { updateJsonFile } from '../../utils/project';

export default async function () {
await updateJsonFile('angular.json', configJson => {
const appArchitect = configJson.projects['test-project'].architect;
appArchitect.test.options.sourceMap = {
scripts: true,
};
});

await writeFile('src/app/app.component.spec.ts', `
it('show fail', () => {
expect(undefined).toBeTruthy();
});
`);

// when sourcemaps are not working the stacktrace won't point to the spec.ts file.
try {
await execAndWaitForOutputToMatch(
'ng',
['test', '--watch', 'false'],
/app\.component\.spec\.ts/,
);
} finally {
killAllProcesses();
}
}

0 comments on commit 324b256

Please sign in to comment.