Skip to content

Commit

Permalink
test(sources): basic source maps test
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman committed Jul 25, 2019
1 parent 2361462 commit 63cf3f4
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
.cdp-profile/
.headless-profile/
.DS_Store
node_modules/
/node_modules/
out/
24 changes: 24 additions & 0 deletions src/test/sources/sourcesTest-tests-basic-source-map.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
reason : new
source : {
name : index.ts
path : ${workspaceFolder}/web/browserify/index.ts
sourceReference : <number>
}
}
{
reason : new
source : {
name : module1.ts
path : ${workspaceFolder}/web/browserify/module1.ts
sourceReference : <number>
}
}
{
reason : new
source : {
name : module2.ts
path : ${workspaceFolder}/web/browserify/module2.ts
sourceReference : <number>
}
}
12 changes: 12 additions & 0 deletions src/test/sources/sourcesTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,16 @@ export function addTests(testRunner) {
p.log(await p.dap.loadedSources({}), 'Loaded sources: ');
p.assertLog();
});

it('basic source map', async({p}: {p: TestP}) => {
await p.launchUrl('index.html');
p.addScriptTag('browserify/bundle.js');
const sources = await Promise.all([
p.waitForSource('index.ts'),
p.waitForSource('module1.ts'),
p.waitForSource('module2.ts'),
]);
sources.forEach(source => p.log(source));
p.assertLog();
});
}
1 change: 1 addition & 0 deletions testWorkspace/node_modules/browser-pack/_prelude.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions testWorkspace/web/browserify/browserify.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script src='bundle.js'></script>
19 changes: 19 additions & 0 deletions testWorkspace/web/browserify/bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions testWorkspace/web/browserify/bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions testWorkspace/web/browserify/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as m1 from './module1';
import * as m2 from './module2';

console.log(m1.kModule1 + m2.kModule2);

1 change: 1 addition & 0 deletions testWorkspace/web/browserify/module1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const kModule1 = 1;
1 change: 1 addition & 0 deletions testWorkspace/web/browserify/module2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const kModule2 = 2;

0 comments on commit 63cf3f4

Please sign in to comment.