Skip to content

Commit

Permalink
Chore: Remove '.serial' from all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sarvaje committed Jan 26, 2019
1 parent ad9834c commit 041e600
Show file tree
Hide file tree
Showing 40 changed files with 2,173 additions and 1,662 deletions.
3 changes: 1 addition & 2 deletions packages/connector-local/package.json
Expand Up @@ -14,7 +14,6 @@
"devDependencies": {
"@hint/parser-html": "^2.0.2",
"@types/chokidar": "^1.7.5",
"@types/mock-require": "^2.0.0",
"ava": "^1.1.0",
"cpx": "^1.5.0",
"eslint": "^5.12.1",
Expand All @@ -23,9 +22,9 @@
"eslint-plugin-typescript": "0.14.0",
"hint": "^4.3.1",
"lodash": "^4.17.11",
"mock-require": "^3.0.3",
"npm-run-all": "^4.1.5",
"nyc": "^13.1.0",
"proxyquire": "2.0.0",
"rimraf": "^2.6.3",
"sinon": "^7.2.3",
"typescript": "^3.2.4",
Expand Down
24 changes: 14 additions & 10 deletions packages/connector-local/src/connector.ts
Expand Up @@ -26,6 +26,7 @@ import { getContentTypeData, isTextMediaType, getType } from 'hint/dist/src/lib/
import { IAsyncHTMLDocument, IAsyncHTMLElement, IAsyncWindow } from 'hint/dist/src/lib/types/async-html';

import isFile from 'hint/dist/src/lib/utils/fs/is-file';
import cwd from 'hint/dist/src/lib/utils/fs/cwd';
import readFileAsync from 'hint/dist/src/lib/utils/fs/read-file-async';
import * as logger from 'hint/dist/src/lib/utils/logging';

Expand All @@ -51,7 +52,7 @@ export default class LocalConnector implements IConnector {
private engine: Engine<HTMLEvents>;
private _href: string = '';
private filesPattern: string[];
private watcher: chokidar.FSWatcher | null = null;
public watcher: chokidar.FSWatcher | null = null;

public constructor(engine: Engine<HTMLEvents>, config: object) {
this._options = Object.assign({}, defaultOptions, config);
Expand Down Expand Up @@ -113,7 +114,7 @@ export default class LocalConnector implements IConnector {

private getGitIgnore = async () => {
try {
const rawList = await readFileAsync(path.join(process.cwd(), '.gitignore'));
const rawList = await readFileAsync(path.join(cwd(), '.gitignore'));
const splitList = rawList.split('\n');

const result = splitList.reduce((total: string[], ignore: string) => {
Expand Down Expand Up @@ -233,21 +234,24 @@ export default class LocalConnector implements IConnector {
reject(err);
};

const onClose = () => {
if (this.watcher) {
this.watcher.close();
}
this.engine.clear();
resolve();
};

this.watcher
.on('add', onAdd.bind(this))
.on('change', onChange.bind(this))
.on('unlink', onUnlink.bind(this))
.on('error', onError)
.on('ready', onReady);
.on('ready', onReady)
.on('close', onClose);

// Close the watcher after press Ctrl + C
process.once('SIGINT', () => {
if (this.watcher) {
this.watcher.close();
}
this.engine.clear();
resolve();
});
process.once('SIGINT', onClose);
});
}

Expand Down

0 comments on commit 041e600

Please sign in to comment.