Skip to content

Commit

Permalink
test(typescript): complete test cases for declarationdir on ts_projec…
Browse files Browse the repository at this point in the history
…t.bzl to include sourcemaps
  • Loading branch information
mistic committed Jul 17, 2020
1 parent 82ca0f1 commit cf8b106
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ts_project(
declaration_map = True,
outdir = "out",
rootdir = "subdir",
source_map = True,
)

filegroup(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"types": []
Expand Down
6 changes: 4 additions & 2 deletions packages/typescript/test/ts_project/declarationdir/verify.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const assert = require('assert');

const types_files = process.argv.slice(2);
const code_files = process.argv.slice(3);
const types_files = process.argv.slice(2, 4);
const code_files = process.argv.slice(4, 6);
assert.ok(types_files.some(f => f.endsWith('declarationdir/out/a.d.ts')), 'Missing a.d.ts');
assert.ok(types_files.some(f => f.endsWith('declarationdir/out/a.d.ts.map')), 'Missing a.d.ts.map');
assert.ok(code_files.some(f => f.endsWith('declarationdir/out/a.js')), 'Missing a.js');
assert.ok(code_files.some(f => f.endsWith('declarationdir/out/a.js.map')), 'Missing a.js.map');
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ts_project(
declarationdir = "out/types",
outdir = "out/code",
rootdir = "subdir",
source_map = True,
)

filegroup(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"types": []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
const assert = require('assert');

const types_files = process.argv.slice(2);
const code_files = process.argv.slice(3);
const types_files = process.argv.slice(2, 4);
const code_files = process.argv.slice(4, 6);
assert.ok(
types_files.some(f => f.endsWith('declarationdir_with_value/out/types/a.d.ts')),
'Missing a.d.ts');
assert.ok(
types_files.some(f => f.endsWith('declarationdir_with_value/out/types/a.d.ts.map')),
'Missing a.d.ts.map');
assert.ok(
code_files.some(f => f.endsWith('declarationdir_with_value/out/code/a.js')), 'Missing a.js');
assert.ok(
code_files.some(f => f.endsWith('declarationdir_with_value/out/code/a.js.map')),
'Missing a.js.map');

0 comments on commit cf8b106

Please sign in to comment.