Skip to content

Commit

Permalink
fix(init): Win architecture & tests (#238)
Browse files Browse the repository at this point in the history
fix(init): Win architecture & tests
  • Loading branch information
adelkahomolova authored Feb 4, 2020
2 parents d759beb + 5e3cb78 commit 0d3fbe1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ env:

matrix:
fast_finish: true
allow_failures:
- os: windows

notifications:
slack:
Expand Down
3 changes: 2 additions & 1 deletion src/commands/init.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createRootContainer } from '../inversify.config';
import { Scanner } from '../scanner';
import { PracticeImpact } from '../model';
import path from 'path';

export default class Init {
static async run() {
Expand All @@ -19,6 +20,6 @@ export default class Init {
});
const scanner = container.get(Scanner);

await scanner.init(scanPath);
await scanner.init(path.normalize(scanPath + path.sep));
}
}
6 changes: 3 additions & 3 deletions src/inspectors/FileInspector.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FileInspector } from '.';
import { createTestContainer, TestContainerContext } from '../inversify.config';

describe('GitignoreIsPresentPractice', () => {
describe('FileInspector', () => {
let fileInspector: FileInspector;
let containerCtx: TestContainerContext;

Expand All @@ -20,10 +20,10 @@ describe('GitignoreIsPresentPractice', () => {
const path = './';

try {
await fileInspector.scanFor('not.exist', path);
await fileInspector.scanFor('.gitignore', path);
fail();
} catch (error) {
expect(error.message).toEqual(`ENOENT: no such file or directory, readdir '${path}'`);
expect(error.message).toMatch(/ENOENT: no such file or directory, readdir/);
}
});
});
4 changes: 2 additions & 2 deletions src/scanner/Scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class Scanner {
* Initialize Scanner configuration
*/
async init(scanPath: string): Promise<void> {
const filePath = path.resolve(scanPath, '.dxscannerrc');
const filePath = scanPath + '.dxscannerrc';
cli.action.start(`Initializing configuration: ${filePath}.yaml`);
// check if .dxscannerrc.yaml already exists
const fileExists: boolean = await this.fileSystemService.exists(`${filePath}`);
Expand Down Expand Up @@ -333,7 +333,7 @@ export class Scanner {
yamlInitContent += `\n# ${dataObject.id}: ${dataObject.impact}`;
}
try {
await this.fileSystemService.writeFile(`/${filePath}.yaml`, yamlInitContent);
await this.fileSystemService.writeFile(`${filePath}.yaml`, yamlInitContent);
} catch (err) {
throw ErrorFactory.newInternalError(`Error during configuration file initialization: ${err.message}`);
}
Expand Down

0 comments on commit 0d3fbe1

Please sign in to comment.