Skip to content

Commit

Permalink
feat(core): adding option to use global imports e.g. polyfills
Browse files Browse the repository at this point in the history
fix #41
  • Loading branch information
Igmat committed Feb 28, 2018
1 parent 7f7ae9a commit 8871185
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/baset-core/src/testGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export class TestGroup {
private references = new WeakMap<object, string>();
private pattern: RegExp;
private readerChain: AbstractReader[];
private allImports: string[];
constructor(
pattern: string | RegExp,
private options: ITestGroupOptions,
Expand All @@ -37,8 +38,10 @@ export class TestGroup {

return new reader(pluginsOptions[readerName]);
});
const baseliner: IBaselinerConstructor = require(path.resolve(baselinerName)).default;
this.baseliner = new baseliner(pluginsOptions[baselinerName]);
this.allImports = [
options.environment,
...options.imports,
].filter((importName): importName is string => !!importName);
}

match = (filePath: string) =>
Expand All @@ -52,9 +55,7 @@ export class TestGroup {
builtin: ['*'],
context: 'sandbox',
external: true,
import: this.environment
? [this.environment]
: undefined,
import: this.allImports,
},
compiler: compiler.compile,
sourceExtensions: compiler.extensions,
Expand Down

0 comments on commit 8871185

Please sign in to comment.