Skip to content

Commit

Permalink
Make snapshot stable
Browse files Browse the repository at this point in the history
  • Loading branch information
louischan-oursky committed Dec 12, 2022
1 parent 29c5258 commit 16cd64d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`does not warn any other flex-* 1`] = `"[{"source":"<input css Q-vYhk>","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":false,"warnings":[]}]"`;
exports[`does not warn any other flex-* 1`] = `"[{"source":"","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":false,"warnings":[]}]"`;

exports[`handles spaces 1`] = `"[{"source":"<input css nU8XED>","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"rule":"oursky/flex","severity":"error","text":"Expected 3-values form of flex: <flex-grow> <flex-shrink> <flex-basis>; (oursky/flex)"}]}]"`;
exports[`handles spaces 1`] = `"[{"source":"","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"endLine":1,"endColumn":19,"rule":"oursky/flex","severity":"error","text":"Expected 3-values form of flex: <flex-grow> <flex-shrink> <flex-basis>; (oursky/flex)"}]}]"`;

exports[`passes well-formed flex 1`] = `"[{"source":"<input css 6D4nmu>","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":false,"warnings":[]}]"`;
exports[`passes well-formed flex 1`] = `"[{"source":"","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":false,"warnings":[]}]"`;

exports[`warns 1-value forms 1`] = `"[{"source":"<input css uR9paM>","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"rule":"oursky/flex","severity":"error","text":"Expected 3-values form of flex: <flex-grow> <flex-shrink> <flex-basis>; (oursky/flex)"}]}]"`;
exports[`warns 1-value forms 1`] = `"[{"source":"","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"endLine":1,"endColumn":11,"rule":"oursky/flex","severity":"error","text":"Expected 3-values form of flex: <flex-grow> <flex-shrink> <flex-basis>; (oursky/flex)"}]}]"`;

exports[`warns 2-value forms 1`] = `"[{"source":"<input css GRBR9Q>","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"rule":"oursky/flex","severity":"error","text":"Expected 3-values form of flex: <flex-grow> <flex-shrink> <flex-basis>; (oursky/flex)"}]}]"`;
exports[`warns 2-value forms 1`] = `"[{"source":"","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"endLine":1,"endColumn":13,"rule":"oursky/flex","severity":"error","text":"Expected 3-values form of flex: <flex-grow> <flex-shrink> <flex-basis>; (oursky/flex)"}]}]"`;

exports[`warns flex-basis 1`] = `"[{"source":"<input css LaeHnF>","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"rule":"oursky/flex","severity":"error","text":"flex-[grow|shrink|basis] are not supported on IE 10. Use flex. (oursky/flex)"}]}]"`;
exports[`warns flex-basis 1`] = `"[{"source":"","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"endLine":1,"endColumn":17,"rule":"oursky/flex","severity":"error","text":"flex-[grow|shrink|basis] are not supported on IE 10. Use flex. (oursky/flex)"}]}]"`;

exports[`warns flex-grow 1`] = `"[{"source":"<input css kVghNh>","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"rule":"oursky/flex","severity":"error","text":"flex-[grow|shrink|basis] are not supported on IE 10. Use flex. (oursky/flex)"}]}]"`;
exports[`warns flex-grow 1`] = `"[{"source":"","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"endLine":1,"endColumn":16,"rule":"oursky/flex","severity":"error","text":"flex-[grow|shrink|basis] are not supported on IE 10. Use flex. (oursky/flex)"}]}]"`;

exports[`warns flex-shrink 1`] = `"[{"source":"<input css wJOyJN>","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"rule":"oursky/flex","severity":"error","text":"flex-[grow|shrink|basis] are not supported on IE 10. Use flex. (oursky/flex)"}]}]"`;
exports[`warns flex-shrink 1`] = `"[{"source":"","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"endLine":1,"endColumn":18,"rule":"oursky/flex","severity":"error","text":"flex-[grow|shrink|basis] are not supported on IE 10. Use flex. (oursky/flex)"}]}]"`;

exports[`warns unitless flex-basis 1`] = `"[{"source":"<input css yoyoLZ>","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"rule":"oursky/flex","severity":"error","text":"flex-basis: 0 not allowed. Please include unit. (oursky/flex)"}]}]"`;
exports[`warns unitless flex-basis 1`] = `"[{"source":"","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"endLine":1,"endColumn":20,"rule":"oursky/flex","severity":"error","text":"flex-basis: 0 not allowed. Please include unit. (oursky/flex)"}]}]"`;

exports[`warns unitless flex-basis of any number 1`] = `"[{"source":"<input css txrIOi>","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"rule":"oursky/flex","severity":"error","text":"flex-basis: 1 not allowed. Please include unit. (oursky/flex)"}]}]"`;
exports[`warns unitless flex-basis of any number 1`] = `"[{"source":"","deprecations":[],"invalidOptionWarnings":[],"parseErrors":[],"errored":true,"warnings":[{"line":1,"column":3,"endLine":1,"endColumn":20,"rule":"oursky/flex","severity":"error","text":"flex-basis: 1 not allowed. Please include unit. (oursky/flex)"}]}]"`;
9 changes: 8 additions & 1 deletion src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ function lint(code) {
},
})
.then((result) => {
return result.output;
// The source property is random.
// So we want to remove it to make the snapshot stable.
const outputString = result.output;
const output = JSON.parse(outputString);
for (const a of output) {
a.source = "";
}
return JSON.stringify(output);
});
}

Expand Down

0 comments on commit 16cd64d

Please sign in to comment.