UNPKG

816 BPlain TextView Raw
1import {bind, provide} from 'angular2/src/core/di';
2import {Options} from './common';
3
4export * from './common';
5export {SeleniumWebDriverAdapter} from './src/webdriver/selenium_webdriver_adapter';
6
7var fs = require('fs');
8
9// TODO(tbosch): right now we bind the `writeFile` method
10// in benchpres/benchpress.es6. This does not work for Dart,
11// find another way...
12// Note: Can't do the `require` call in a facade as it can't be loaded into the browser
13// for our unit tests via karma.
14Options.DEFAULT_PROVIDERS.push(bind(Options.WRITE_FILE).toValue(writeFile));
15
16function writeFile(filename, content): Promise<any> {
17 return new Promise(function(resolve, reject) {
18 fs.writeFile(filename, content, (error) => {
19 if (error) {
20 reject(error);
21 } else {
22 resolve();
23 }
24 });
25 })
26}