-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow generating SourceFiles for files matched by a user-provide…
…d 'exclude' glob. Closes #65
- Loading branch information
Showing
8 changed files
with
145 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import test from "ava"; | ||
import {formatCode} from "./util/format-code"; | ||
import {generateRollupBundle} from "./setup/setup-rollup"; | ||
// tslint:disable:no-duplicate-string | ||
|
||
test("Is still capable of resolving SourceFiles when needed for when a file path is matched by the 'exclude' glob. #1", async t => { | ||
const bundle = await generateRollupBundle( | ||
[ | ||
{ | ||
entry: true, | ||
fileName: "index.ts", | ||
text: `\ | ||
export function foo (arg: Buffer): Buffer { | ||
return arg; | ||
} | ||
` | ||
} | ||
], | ||
{ | ||
debug: false, | ||
exclude: ["node_modules/**/*.*"] | ||
} | ||
); | ||
const { | ||
declarations: [file] | ||
} = bundle; | ||
|
||
t.deepEqual( | ||
formatCode(file.code), | ||
formatCode(`\ | ||
/// <reference types="node" /> | ||
declare function foo(arg: Buffer): Buffer; | ||
export { foo }; | ||
`) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import test from "ava"; | ||
import {formatCode} from "./util/format-code"; | ||
import {generateRollupBundle} from "./setup/setup-rollup"; | ||
// tslint:disable:no-duplicate-string | ||
|
||
test("Detects d.ts files when matched by a ParsedCommandLine. #1", async t => { | ||
const bundle = await generateRollupBundle( | ||
[ | ||
{ | ||
entry: true, | ||
fileName: "index.ts", | ||
text: `\ | ||
export const foo = globalFunc(); | ||
` | ||
}, | ||
{ | ||
entry: false, | ||
fileName: "typings/typings.d.ts", | ||
text: `\ | ||
declare function globalFunc(): string; | ||
` | ||
} | ||
], | ||
{ | ||
debug: false, | ||
exclude: ["node_modules/**/*.*"] | ||
} | ||
); | ||
const { | ||
declarations: [file] | ||
} = bundle; | ||
|
||
t.deepEqual( | ||
formatCode(file.code), | ||
formatCode(`\ | ||
declare const foo: string; | ||
export {foo}; | ||
`) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters