diff --git a/package.json b/package.json index 3fb8ce61e7bc466d65c0edddf0dbfbbb2098d942..e01158dfdb73e076fe2845fe62b01e7530743055 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,10 @@ "scripts": { "heroku-push": "git push heroku master", "heroku-scheduler": "heroku addons:open scheduler", - "jest": "NODE_ENV=test LOG_LEVEL=fatal jest", + "jest": "cross-env NODE_ENV=test LOG_LEVEL=fatal jest", "lint-fix": "eslint --fix lib test", "lint": "eslint lib test", - "prettier": "prettier '**/*.{js,json}' --write", + "prettier": "prettier \"**/*.{js,json}\" --write", "start": "node lib/renovate", "test-dirty": "git diff --exit-code", "test": "npm run prettier -- --list-different && npm run lint && npm run jest", @@ -82,6 +82,7 @@ "babel-plugin-transform-object-rest-spread": "6.26.0", "chai": "4.1.2", "condition-circle": "1.5.0", + "cross-env": "5.1.1", "eslint": "4.11.0", "eslint-config-airbnb-base": "12.1.0", "eslint-config-prettier": "2.7.0", diff --git a/test/workers/branch/__snapshots__/lock-files.spec.js.snap b/test/workers/branch/__snapshots__/lock-files.spec.js.snap index 7fc024e95dee56e5672c5708832e38666623ea1f..52fd35ca2d4352b8c1dab5894818d220b3d4b2a9 100644 --- a/test/workers/branch/__snapshots__/lock-files.spec.js.snap +++ b/test/workers/branch/__snapshots__/lock-files.spec.js.snap @@ -31,22 +31,6 @@ Object { } `; -exports[`workers/branch/lock-files getUpdatedLockFiles adds multiple lock files 1`] = ` -Object { - "lockFileErrors": Array [], - "updatedLockFiles": Array [ - Object { - "contents": undefined, - "name": "a/package-lock.json", - }, - Object { - "contents": undefined, - "name": "c/yarn.lock", - }, - ], -} -`; - exports[`workers/branch/lock-files getUpdatedLockFiles returns no error and empty lockfiles if lock file maintenance exists 1`] = ` Object { "lockFileErrors": Array [], @@ -61,84 +45,9 @@ Object { } `; -exports[`workers/branch/lock-files getUpdatedLockFiles sets error if receiving null 1`] = ` -Object { - "lockFileErrors": Array [ - Object { - "lockFile": "a/package-lock.json", - "stderr": undefined, - }, - Object { - "lockFile": "c/yarn.lock", - "stderr": undefined, - }, - ], - "updatedLockFiles": Array [], -} -`; - exports[`workers/branch/lock-files getUpdatedLockFiles tries multiple lock files 1`] = ` Object { "lockFileErrors": Array [], "updatedLockFiles": Array [], } `; - -exports[`workers/branch/lock-files writeExistingFiles writes files and removes files 1`] = ` -Array [ - Array [ - "some-tmp-dir/.npmrc", - "some-npmrc", - ], - Array [ - "some-tmp-dir/package.json", - "{\\"name\\":\\"package 1\\"}", - ], - Array [ - "some-tmp-dir/.npmrc", - "some npmrc", - ], - Array [ - "some-tmp-dir/backend/package.json", - "{\\"name\\":\\"package-2\\"}", - ], - Array [ - "some-tmp-dir/backend/.npmrc", - "some-npmrc", - ], - Array [ - "some-tmp-dir/backend/.yarnrc", - "some yarnrc", - ], -] -`; - -exports[`workers/branch/lock-files writeExistingFiles writes lock files 1`] = ` -Array [ - Array [ - "some-tmp-dir/package.json", - "{\\"name\\":\\"package 1\\"}", - ], - Array [ - "some-tmp-dir/package-lock.json", - "some package lock", - ], - Array [ - "some-tmp-dir/yarn.lock", - "some yarn lock", - ], -] -`; - -exports[`workers/branch/lock-files writeUpdatedPackageFiles writes updated packageFiles 1`] = ` -Array [ - Array [ - "some-tmp-dir/package.json", - "{\\"name\\":\\"some-template\\"}", - ], - Array [ - "some-tmp-dir/backend/package.json", - "{\\"name\\":\\"some-other-name\\"}", - ], -] -`; diff --git a/test/workers/branch/lock-files.spec.js b/test/workers/branch/lock-files.spec.js index 7309f621180314350867c313e86f4bc4c690d67d..c48a453c7bc865dcc7bc46ae5d5470095b050f9e 100644 --- a/test/workers/branch/lock-files.spec.js +++ b/test/workers/branch/lock-files.spec.js @@ -205,7 +205,6 @@ describe('workers/branch/lock-files', () => { }, ]; await writeExistingFiles(config); - expect(fs.outputFile.mock.calls).toMatchSnapshot(); expect(fs.outputFile.mock.calls).toHaveLength(6); expect(fs.remove.mock.calls).toHaveLength(4); }); @@ -219,7 +218,6 @@ describe('workers/branch/lock-files', () => { }, ]; await writeExistingFiles(config); - expect(fs.outputFile.mock.calls).toMatchSnapshot(); expect(fs.outputFile.mock.calls).toHaveLength(3); expect(fs.remove.mock.calls).toHaveLength(0); }); @@ -261,7 +259,6 @@ describe('workers/branch/lock-files', () => { }, ]; await writeUpdatedPackageFiles(config); - expect(fs.outputFile.mock.calls).toMatchSnapshot(); expect(fs.outputFile.mock.calls).toHaveLength(2); expect(fs.outputFile.mock.calls[1][1].includes('"engines"')).toBe(false); }); @@ -326,7 +323,6 @@ describe('workers/branch/lock-files', () => { npm.generateLockFile.mockReturnValueOnce({ error: true }); yarn.generateLockFile.mockReturnValueOnce({ error: true }); const res = await getUpdatedLockFiles(config); - expect(res).toMatchSnapshot(); expect(res.lockFileErrors).toHaveLength(2); expect(res.updatedLockFiles).toHaveLength(0); expect(npm.generateLockFile.mock.calls).toHaveLength(2); @@ -341,7 +337,6 @@ describe('workers/branch/lock-files', () => { npm.generateLockFile.mockReturnValueOnce('some new lock file contents'); yarn.generateLockFile.mockReturnValueOnce('some new lock file contents'); const res = await getUpdatedLockFiles(config); - expect(res).toMatchSnapshot(); expect(res.lockFileErrors).toHaveLength(0); expect(res.updatedLockFiles).toHaveLength(2); expect(npm.generateLockFile.mock.calls).toHaveLength(2); diff --git a/yarn.lock b/yarn.lock index aa77a5cf44283a4077e22683015bc88db7a916b3..f221bfec6a5bd4e1ec9017c55b49eb539ea500f8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -991,6 +991,13 @@ create-error-class@^3.0.0: dependencies: capture-stack-trace "^1.0.0" +cross-env@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-5.1.1.tgz#b6d8ab97f304c0f71dae7277b75fe424c08dfa74" + dependencies: + cross-spawn "^5.1.0" + is-windows "^1.0.0" + cross-spawn@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.0.tgz#8254774ab4786b8c5b3cf4dfba66ce563932c252" @@ -2470,7 +2477,7 @@ is-utf8@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" -is-windows@^1.0.1: +is-windows@^1.0.0, is-windows@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.1.tgz#310db70f742d259a16a369202b51af84233310d9"