diff --git a/.eslintrc b/.eslintrc index 1e78bf0c7..09225e0ad 100644 --- a/.eslintrc +++ b/.eslintrc @@ -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 diff --git a/package-lock.json b/package-lock.json index fb89063c4..08753c28b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17146,6 +17146,26 @@ "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", "dev": true }, + "unixify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unixify/-/unixify-1.0.0.tgz", + "integrity": "sha1-OmQcjC/7zk2mg6XHDwOkYpQMIJA=", + "dev": true, + "requires": { + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", diff --git a/package.json b/package.json index 8d2a75771..97ad9a76a 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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": [ diff --git a/test/generator.test.js b/test/generator.test.js index 2e9936b41..a31f0c292 100644 --- a/test/generator.test.js +++ b/test/generator.test.js @@ -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'); @@ -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);