chore: fix dev environment for Windows (#1156)

- use cross-env for jest
- escape `prettier` script
- remove snapshots that include `path.join()`

Closes #1148
This commit is contained in:
JYC 2017-11-12 14:44:10 +01:00 committed by Rhys Arkins
parent 203d419578
commit e16e2ff6f2
4 changed files with 11 additions and 99 deletions

View file

@ -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",

View file

@ -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\\"}",
],
]
`;

View file

@ -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);

View file

@ -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"