Browse Source

fix tests

pull/62/head
Nicolas Beaussart 6 years ago
parent
commit
53f3899635
  1. 58
      src/tests/add/__snapshots__/prettier.spec.ts.snap
  2. 9
      src/tests/add/prettier.spec.ts

58
src/tests/add/__snapshots__/prettier.spec.ts.snap

@ -195,15 +195,6 @@ exports[`nbx add:prettier should work with tslint and commits and with an empty
`; `;
exports[`nbx add:prettier should work with tslint and commits and with an empty config 2`] = ` exports[`nbx add:prettier should work with tslint and commits and with an empty config 2`] = `
"<html>
<body>
<a>testokiii</a>
</body>
</html>
"
`;
exports[`nbx add:prettier should work with tslint and commits and with an empty config 3`] = `
Array [ Array [
"Adding prettier as a dev dependency", "Adding prettier as a dev dependency",
"The step was done without any error.", "The step was done without any error.",
@ -236,15 +227,6 @@ exports[`nbx add:prettier should work with tslint and commits and with an existi
`; `;
exports[`nbx add:prettier should work with tslint and commits and with an existing extends as array 2`] = ` exports[`nbx add:prettier should work with tslint and commits and with an existing extends as array 2`] = `
"<html>
<body>
<a>testokiii</a>
</body>
</html>
"
`;
exports[`nbx add:prettier should work with tslint and commits and with an existing extends as array 3`] = `
Array [ Array [
"Adding prettier as a dev dependency", "Adding prettier as a dev dependency",
"The step was done without any error.", "The step was done without any error.",
@ -277,15 +259,6 @@ exports[`nbx add:prettier should work with tslint and commits and with an existi
`; `;
exports[`nbx add:prettier should work with tslint and commits and with an existing extends as string 2`] = ` exports[`nbx add:prettier should work with tslint and commits and with an existing extends as string 2`] = `
"<html>
<body>
<a>testokiii</a>
</body>
</html>
"
`;
exports[`nbx add:prettier should work with tslint and commits and with an existing extends as string 3`] = `
Array [ Array [
"Adding prettier as a dev dependency", "Adding prettier as a dev dependency",
"The step was done without any error.", "The step was done without any error.",
@ -318,15 +291,6 @@ exports[`nbx add:prettier should work with tslint and commits and with an existi
`; `;
exports[`nbx add:prettier should work with tslint and commits and with an existing rules config 2`] = ` exports[`nbx add:prettier should work with tslint and commits and with an existing rules config 2`] = `
"<html>
<body>
<a>testokiii</a>
</body>
</html>
"
`;
exports[`nbx add:prettier should work with tslint and commits and with an existing rules config 3`] = `
Array [ Array [
"Adding prettier as a dev dependency", "Adding prettier as a dev dependency",
"The step was done without any error.", "The step was done without any error.",
@ -349,6 +313,28 @@ Array [
] ]
`; `;
exports[`nbx add:prettier should work with tslint and commits and with only lint with l flag 1`] = `
Array [
"Adding tslint-config-prettier as a dev dependency",
"The step was done without any error.",
"Adding tslint-plugin-prettier as a dev dependency",
"The step was done without any error.",
"Updating tslint.json",
"The step was done without any error.",
]
`;
exports[`nbx add:prettier should work with tslint and commits and with only lint with onlyLint flag 1`] = `
Array [
"Adding tslint-config-prettier as a dev dependency",
"The step was done without any error.",
"Adding tslint-plugin-prettier as a dev dependency",
"The step was done without any error.",
"Updating tslint.json",
"The step was done without any error.",
]
`;
exports[`nbx add:prettier should work without commits 1`] = ` exports[`nbx add:prettier should work without commits 1`] = `
"<html> "<html>
<body> <body>

9
src/tests/add/prettier.spec.ts

@ -10,7 +10,7 @@ import {
TestRun, TestRun,
} from '../test-helpers.spec'; } from '../test-helpers.spec';
jest.setTimeout(90000);
jest.setTimeout(6000);
const beforeCreateHtml = async () => { const beforeCreateHtml = async () => {
filesystem.write('test.html', '<html><body><a>testokiii</a></body></html>'); filesystem.write('test.html', '<html><body><a>testokiii</a></body></html>');
@ -62,10 +62,10 @@ export const expectEslintWithParams = ({
expectGitCommits({ expectGitCommits({
before: async () => { before: async () => {
filesystem.write(eslintName, eslintJson); filesystem.write(eslintName, eslintJson);
await beforeCreateHtml();
if (onlyLint) { if (onlyLint) {
prompts.inject([true, true]); prompts.inject([true, true]);
} else { } else {
await beforeCreateHtml();
prompts.inject([true, '**/*.{js,vue,json,ts,tsx,md,yml,html}', true]); prompts.inject([true, '**/*.{js,vue,json,ts,tsx,md,yml,html}', true]);
} }
}, },
@ -156,10 +156,10 @@ export const expectTslintWithParams = ({
expectGitCommits({ expectGitCommits({
before: async () => { before: async () => {
filesystem.write('tslint.json', tslintJson); filesystem.write('tslint.json', tslintJson);
await beforeCreateHtml();
if (onlyLint) { if (onlyLint) {
prompts.inject([true, true]); prompts.inject([true, true]);
} else { } else {
await beforeCreateHtml();
prompts.inject([true, '**/*.{js,vue,json,ts,tsx,md,yml,html}', true]); prompts.inject([true, '**/*.{js,vue,json,ts,tsx,md,yml,html}', true]);
} }
}, },
@ -250,7 +250,6 @@ testCli({
'There is no package.json not found in the current folder', 'There is no package.json not found in the current folder',
before: async () => { before: async () => {
filesystem.remove('package.json'); filesystem.remove('package.json');
prompts.inject([true, '**/*.{js,vue,json,ts,tsx,md,yml,html}']);
}, },
}), }),
}, },
@ -264,7 +263,7 @@ testCli({
}, },
}, },
before: async () => { before: async () => {
prompts.inject([true, '**/*.{js,vue,json,ts,tsx,md,yml,html}']);
prompts.inject([true]);
}, },
}), }),
}, },

Loading…
Cancel
Save