Skip to content

Commit

Permalink
test: support testing on windows with unixify package (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Feb 4, 2021
1 parent 0915a26 commit a58781d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ rules:
space-in-parens: [2, never]
space-unary-ops: [2, {words: true, nonwords: false}]
wrap-regex: 2
linebreak-style: [2, unix]
linebreak-style: 0
semi: [2, always]
arrow-spacing: [2, {before: true, after: true}]
no-class-assign: 2
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"@semantic-release/github": "^7.0.4",
"@semantic-release/npm": "^7.0.6",
"@semantic-release/release-notes-generator": "^9.0.1",
"all-contributors-cli": "^6.14.2",
"chokidar": "^3.4.0",
"conventional-changelog-conventionalcommits": "^4.4.0",
"eslint": "^6.8.0",
Expand All @@ -84,7 +85,7 @@
"jsdoc-to-markdown": "^5.0.0",
"markdown-toc": "^1.2.0",
"semantic-release": "^17.2.2",
"all-contributors-cli": "^6.14.2"
"unixify": "^1.0.0"
},
"release": {
"branches": [
Expand Down
8 changes: 5 additions & 3 deletions test/generator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const fs = require('fs');
const path = require('path');
const Generator = require('../lib/generator');
const log = require('loglevel');
const unixify = require('unixify');

const dummyYAML = fs.readFileSync(path.resolve(__dirname, './docs/dummy.yml'), 'utf8');

Expand Down Expand Up @@ -234,9 +235,10 @@ describe('Generator', () => {
expect(filtersRegistry.registerFilters).toHaveBeenCalled();
expect(templateConfigValidator.validateTemplateConfig).toHaveBeenCalled();
expect(gen.launchHook).toHaveBeenCalledWith('generate:after');
expect(util.exists).toHaveBeenCalledWith('/path/to/template/nameOfTestTemplate/template/file.js');
expect(gen.generateFile).toHaveBeenCalledWith(asyncApiDocumentMock, 'file.js', '/path/to/template/nameOfTestTemplate/template');

expect(unixify(util.exists.mock.calls[0][0])).toEqual('/path/to/template/nameOfTestTemplate/template/file.js');
expect(gen.generateFile.mock.calls[0][0]).toEqual(asyncApiDocumentMock);
expect(gen.generateFile.mock.calls[0][1]).toEqual('file.js');
expect(unixify(gen.generateFile.mock.calls[0][2])).toEqual('/path/to/template/nameOfTestTemplate/template');
expect(util.readFile).toHaveBeenCalledTimes(0);
expect(gen.renderString).toHaveBeenCalledTimes(0);
expect(gen.generateDirectoryStructure).toHaveBeenCalledTimes(0);
Expand Down

0 comments on commit a58781d

Please sign in to comment.